To join an existing cluster name and any working node should be set. In case of a single cluster path might be omitted, data_dir will be used as the cluster path. For all subsequent clusters path needs to be set and it should be available.
JOIN CLUSTER posts AT '10.12.1.35:9312'POST /cli -d "
JOIN CLUSTER posts AT '10.12.1.35:9312'
"$params = [
'cluster' => 'posts',
'body' => [
'10.12.1.35:9312'
]
];
$response = $client->cluster->join($params);utilsApi.sql('mode=raw&query=JOIN CLUSTER posts AT \'10.12.1.35:9312\''){u'error': u'', u'total': 0, u'warning': u''}res = await utilsApi.sql('mode=raw&query=JOIN CLUSTER posts AT \'10.12.1.35:9312\'');{"total":0,"error":"","warning":""}utilsApi.sql("mode=raw&query=JOIN CLUSTER posts AT '10.12.1.35:9312'");A node joins a cluster by getting the data from the node provided and, if successful, it updates node lists in all the other cluster nodes similar to ALTER CLUSTER … UPDATE nodes. This list is used to rejoin nodes to the cluster on restart.
There are two lists of nodes. One is used to rejoin nodes to the
cluster on restart, it is updated across all nodes same way as ALTER
CLUSTER … UPDATE nodes does. JOIN CLUSTER does the same
update automatically. Cluster
status shows this list as cluster_post_nodes_set. The
second list is a list of all active nodes used for replication. This
list doesn’t require manual management. ALTER
CLUSTER … UPDATE nodes actually copies this list of nodes to the
list of nodes used to rejoin on restart. Cluster
status shows this list as cluster_post_nodes_view.
When nodes are located at different network segments or in different datacenters nodes option may be set explicitly. That allows to minimize traffic between nodes and to use gateway nodes for datacenters intercommunication. The following command joins an existing cluster using the nodes option.
Note: that when this syntax is used,
cluster_post_nodes_setlist is not updated automatically. Use ALTER CLUSTER … UPDATE nodes to update it.
JOIN CLUSTER click_query 'clicks_mirror1:9312;clicks_mirror2:9312;clicks_mirror3:9312' as nodesPOST /cli -d "
JOIN CLUSTER click_query 'clicks_mirror1:9312;clicks_mirror2:9312;clicks_mirror3:9312' as nodes
"$params = [
'cluster' => 'posts',
'body' => [
'nodes' => 'clicks_mirror1:9312;clicks_mirror2:9312;clicks_mirror3:9312'
]
];
$response = $client->cluster->join($params);utilsApi.sql('mode=raw&query=JOIN CLUSTER click_query \'clicks_mirror1:9312;clicks_mirror2:9312;clicks_mirror3:9312\' as nodes'){u'error': u'', u'total': 0, u'warning': u''}res = await utilsApi.sql('mode=raw&query=JOIN CLUSTER click_query \'clicks_mirror1:9312;clicks_mirror2:9312;clicks_mirror3:9312\' as nodes');{"total":0,"error":"","warning":""}utilsApi.sql("mode=raw&query=JOIN CLUSTER click_query 'clicks_mirror1:9312;clicks_mirror2:9312;clicks_mirror3:9312' as nodes");JOIN CLUSTER completes when a node receives all the
necessary data to be in sync with all the other nodes in the
cluster.