I am trying to setup a CouchDB cluster with some Raspberry Pi for a edge computing project. But all I did until now wasn't successful. I don't get a cluster working correctly.
This is what I did: I followed the setup guide from http://docs.couchdb.org/en/2.0.0/install/unix.html#
in combination with: https://medium.com/linagora-engineering/setting-up-a-couchdb-2-cluster-on-centos-7-8cbf32ae619f#.eopseqi4h
- Installing the dependencies - worked without error
./configure
- worked without errormake release
- worked without errorFollowing the guide: Add couchdb user:
adduser --system --no-create-home --shell /bin/bash --group --gecos "CouchDB Administrator" couchdb
worked without error
mv rel/couchdb /usr/local/
- worked without errorchown -R couchdb:couchdb /usr/local/couchdb
- didn't work in first place - no usergroup couchdb - added usergroupchanged node-name in /usr/local/couchdb/etc/vm.args:
-name n1.couch.local
added-kernel inet_dist_listen_min 9100
and-kernel inet_dist_listen_max 9200
- didn't work - changed back to couchdb@localhoststaring db
su - couchdb cd /usr/local/couchdb ./bin/couchdb
-didn't work for me in first place, su pw - Authentication failed - switched user by
sudo su
andsu - couchdb
db starts - runs, but throws error (ignored error for now, because db is running):
[error] 2017-02-17T12:34:26.672758Z couchdb@localhost emulator ------ -- Error in process <0.354.0> on node 'couchdb@localhost' with exit value: {database_does_not_exist, [{mem3_shards,load_shards_from_db,"_users", [{file,"src/mem3_shards.erl"},{line,327}]}, {mem3_shards,load_shards_from_disk,1,[{file,"src/mem3_shards.erl"}, {line,315}]},{mem3_shards,load_shards_from_disk... [notice] 2017-02-17T12:34:26.672918Z couchdb@localhost <0.353.0> ---- ---- chttpd_auth_cache changes listener died database_does_not_exist at mem3_shards:load_shards_from_db/6(line:327) <= mem3_shards:load_shards_from_disk/1(line:315) <= mem3_shards:load_shards_from_disk/2(line:331) <= mem3_shards:for_docid/3(line:87) <= fabric_doc_open:go/3(line:38) <= chttpd_auth_cache:ensure_auth_ddoc_exists/2(line:187) <= chttpd_auth_cache:listen_for_changes/1(line:134)
prepared two Raspberry Pi (2 CouchDB nodes) for cluster mode:
curl -X PUT http://127.0.0.1:5984/_node/couchdb@localhost/ _config/admins/admin -d '"conmonmrp"'`
answer:
"-pbkdf2-9ec43ace4195ee45a37773c9dfc2aba9380468cb, cddfb98dd1b2416dea2b53dc9fe9a31b,10"
and
`curl -X PUT http://127.0.0.1:5984/_node/couchdb@localhost/ _config/chttpd/bind_address -d '"0.0.0.0"'`
- answer:
"0.0.0.0"
seems like commands have been accepted
Went on localhost:5984/_utils/ and tried to setup cluster - entered credentials (did not change IP and port) and added another node by IP (network IP, i.e. 10.228.101.210), created cluster to finish setup - fauxton accepted that without an error.
trying to get all nodes in the cluster by localhost:5984/_membership/ results in:
{"all_nodes":["couchdb@localhost"],"cluster_nodes": ["couchdb@10.228.101.210","couchdb@localhost"]}`
trying to add a database on one node and see it on another one doesn't work
I'am really new to that CouchDB thing at all, but I need to get that cluster running. I hope, my discription helps to find the problem. Altogether I got the feeling, that I am missing or missunderstandig an important point on that.
Best regards from Hamburg, DE
After having some trouble with setting up the cluster, a friend found the problem. It is necessary to change the name of the node in the /couchdb/etc/vm.args file. As I read in another post it is illegal to name it @localhost. I changed that to the IP-address of the device.
After that, everything works fine for me now.
Remember also, when setting up a cluster and finding issues when adding or restarting, etc... Make sure your "cookie" doesn't have spaces.
来源:https://stackoverflow.com/questions/42298919/setup-couchdb-2-0-cluster