Enable cluster auto-assembly through a seedlist #1658
This introduces a new config setting which allows an administrator to configure an initial list of nodes that should be contacted when a node boots up:
If configured, CouchDB will add every node in the seedlist to the
We also modify the
Once the status flips to "ok" the endpoint will return 200 and it's safe to direct requests to the new node.
You'll notice that the PR currently has no tests. I wanted to put it up for review while I familiarize myself with the latest bits of the test suite and see what I can contribute.
This introduces a new config setting which allows an administrator to configure an initial list of nodes that should be contacted when a node boots up: [cluster] seedlist = email@example.com,firstname.lastname@example.org,email@example.com If configured, CouchDB will add every node in the seedlist to the _nodes DB automatically, which will trigger a distributed Erlang connection and a replication of the internal system databases to the local node. This eliminates the need to explicitly add each node using the HTTP API.
This patch adds a new gen_server whose only job is to download the system DBs (_nodes, _dbs, _users) from the nodes in the seedlist, and then set a flag once it has downloaded a complete copy. Once the flag is set we can confidently allow the node to handle HTTP requests.
nickva left a comment •
Looks good. Nice work!
I tested by starting a disconnected cluster:
Created some dbs in node1. Then stopped, it, editedd the seedlist with node1 as the only seed. Restarted the disconnected cluster.
Cluster connected as expected and _dbs was synchronized.
While seeding response on node2 and node3 was 404:
It did actually show an error. I think I might have seen a rexi_DOWN in the log possibly from it.
But it did finish correctly and