Repository: couchdb-documentation Updated Branches: refs/heads/master eb4eab621 -> 1e5b636a2
Add cluster placement reference info Closes COUCHDB-2944 Project: http://git-wip-us.apache.org/repos/asf/couchdb-documentation/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-documentation/commit/1e5b636a Tree: http://git-wip-us.apache.org/repos/asf/couchdb-documentation/tree/1e5b636a Diff: http://git-wip-us.apache.org/repos/asf/couchdb-documentation/diff/1e5b636a Branch: refs/heads/master Commit: 1e5b636a25df9061ba9d6988435e9cdef2145fa4 Parents: eb4eab6 Author: Joan Touzet <woh...@apache.org> Authored: Wed Aug 31 14:47:24 2016 -0400 Committer: Joan Touzet <woh...@apache.org> Committed: Wed Aug 31 14:47:24 2016 -0400 ---------------------------------------------------------------------- src/cluster/databases.rst | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-documentation/blob/1e5b636a/src/cluster/databases.rst ---------------------------------------------------------------------- diff --git a/src/cluster/databases.rst b/src/cluster/databases.rst index f50cb45..aaf2807 100644 --- a/src/cluster/databases.rst +++ b/src/cluster/databases.rst @@ -41,3 +41,38 @@ Deleteing a database .. code-block:: bash curl -X DELETE "http://xxx.xxx.xxx.xxx:5984/database-name --user admin-user + +Placing a database on specific nodes +==================================== + +In BigCouch, the predecessor to CouchDB 2.0's clustering functionality, there +was the concept of zones. CouchDB 2.0 carries this forward with cluster +placement rules. + +First, each node must be labelled with a zone attribute. This defines which +zone each node is in. You do this by editing the node's document in the +``/nodes`` database, which is accessed through the "back-door" (5986) port. +Add a key value pair of the form: + +.. code-block:: text + + "zone": "metro-dc-a" + +Do this for all of the nodes in your cluster. + +In your config file (local.ini or default.ini) on each node, define a +consistent cluster-wide setting like: + +.. code-block:: text + + [cluster] + placement = metro-dc-a:2,metro-dc-b:1 + +In this example, it will ensure that two replicas for a shard will be hosted +on nodes with the zone attribute set to ``metro-dc-a`` and one replica will +be hosted on a new wiht the zone attribute set to ``metro-dc-b``. + +Note that you can also use this system to ensure certain nodes in the cluster +do not host *any* replicas for newly created databases, by giving them a zone +attribute that does not appear in the ``[cluster]`` placement string. +