问题
We are using elastic search cluster with 2 nodes. The index seems to be out of sync. For an index, each node has different count of documents. The objective is to always keep the cluster in sync. First node can see the second node but second node cannot see the first node in the cluster.
Is there any way to force sync the cluster so that the data in each node is same?
回答1:
If you need the data in two nodes, use replication. That way a copy of the data of each shard is made on the other node. Beware though, this is not master-slave. If your index has multiple shards, one node can have the primary of one shard and the replica of another. The closest you can get is to have an index with one shard and one replica. Than both nodes would have the data.
Another option could be to create snapshots in one cluster (of one node) and restore them in the other cluster (of one node). Of course there is a lag in the synchronisation this way. With just two nodes this would not be the preferred solution.
来源:https://stackoverflow.com/questions/27723587/elastic-search-cluster-sync-issue-each-node-is-having-different-values-for-an-i