jcoglan commented on PR #5869:
URL: https://github.com/apache/couchdb/pull/5869#issuecomment-4048410118
I have tried the things @nickva suggest via the following steps. I believe
the results look fine but would appreciate others double checking them.
1. Check out the repo at this PR's branch
2. Check out two other copies of the repo at `admin/main`, I used commit
`c570deff373d7f9b1c14db34e981312b09ff71aa`
3. On each one, apply the following patch:
```diff
diff --git a/rel/overlay/etc/vm.args b/rel/overlay/etc/vm.args
index b4167be7b..ca8f562dd 100644
--- a/rel/overlay/etc/vm.args
+++ b/rel/overlay/etc/vm.args
@@ -43,6 +43,8 @@
# Which interfaces should the node listen on?
-kernel inet_dist_use_interface {127,0,0,1}
+-kernel inet_dist_listen_min 9100
+-kernel inet_dist_listen_max 9200
# Tell kernel and SASL not to log anything
-kernel error_logger silent
```
4. On each copy, run: `git clean -ffdx ; ./configure --dev
--disable-spidermonkey --js-engine quickjs ; make ; ./dev/run -a a:a -n1
--erlang-cookie biscuit --node-number-seed $n` with `n` from `1` to `3` for
each copy
5. Run the following script to connect them into a cluster:
```bash
#!/bin/bash
source ~/.shell/couchdb
username='a'
password='a'
CDB_AUTH="$username:$password"
pwhash='"-pbkdf2:sha256-761a5edaa8635ae1fce1185d477cff666e137e5f2fe4d65037a8e08f380f67ab,b0e91baaa60de5da82be8bcd7acb4ab9,600000"'
uuid1='"019ce2e0305a7a9c9c8b4b50e992c097"'
uuid2='"019ce2e0305a7cd0861784fd28c84d67"'
for n in $(seq 1 3) ; do
CDB_PORT="${n}5984"
cdb '/_node/_local/_config/admins/a' -X PUT -d "$pwhash"
cdb '/_node/_local/_config/chttpd/bind_address' -X PUT -d '"0.0.0.0"'
cdb '/_node/_local/_config/couchdb/uuid' -X PUT -d "$uuid1"
cdb '/_node/_local/_config/chttpd_auth/secret' -X PUT -d "$uuid2"
cdb '/_node/_local/_config/cluster/q' -X PUT -d '"1"'
cdb '/_node/_local/_config/cluster/n' -X PUT -d '"3"'
done
CDB_PORT=15984
ip='127.0.0.1'
cdb '/_cluster_setup' -X POST -d @- <<JSON
{
"action": "enable_cluster",
"bind_address": "0.0.0.0",
"username": "$username",
"password": "$password",
"node_count": "3"
}
JSON
for n in $(seq 2 3) ; do
cdb '/_cluster_setup' -X POST -d @- <<JSON
{
"action": "enable_cluster",
"bind_address": "0.0.0.0",
"username": "$username",
"password": "$password",
"port": $CDB_PORT,
"node_count": "3",
"remote_node": "$ip",
"remote_current_user": "$username",
"remote_current_password": "$password"
}
JSON
cdb '/_cluster_setup' -X POST -d @- <<JSON
{
"action": "add_node",
"host": "$ip",
"port": ${n}5984,
"username": "$username",
"password": "$password"
}
JSON
done
cdb '/_cluster_setup' -X POST -d '{ "action": "finish_cluster" }'
cdb '/_membership' | jq
```
`cdb` is a helper from my shell environment which you can simulate using:
```bash
cdb () { curl -gsu "$CDB_AUTH" -H 'content-type: application/json'
"http://127.0.0.1:${CDB_PORT}$1" "${@:2}" ; }
```
6. Create a DB with some docs in it:
```bash
CDB_PORT=15984
cdb '/mydb' -X DELETE ; cdb '/mydb' -X PUT ; for n in {1..100} ; do cdb
"/mydb/doc-$n" -X PUT -d '{ "value": '$n' }' ; done
```
7. Try using `_find` and `_explain` against each server:
```bash
CDB_PORT=15984 # or 25984, 35984
cdb '/mydb/_find' -X POST -d '{ "selector": { "value": { "$gt": 3, "$lt": 7
} } }'
cdb '/mydb/_explain' -X POST -d '{ "selector": { "value": { "$gt": 3, "$lt":
7 } } }'
```
8. Try filtered changes:
```bash
CDB_PORT=15984 # or 25984, 35984
cdb '/mydb/_changes?filter=_selector' -X POST -d '{ "selector": { "value": {
"$gt": 3, "$lt": 7 } } }'
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]