我们与ElasticSearch合作,但在这样做时,我们在群集环境中丢失了数据。我们使用ES 2.4.0。
有谁可以说我们缺少什么?
我们的情景是:
使用以下配置打开Elastic Server-1和Server-2, 他们在一个集群中。
Server-1上的索引文档:
curl -XPUT' 20.20.20.5:9200 / ert / post / 1' -d' { "用户":" easlan", " postDate":" 01-16-2015", " body":"在ElasticSearch Cluster中添加数据" , " title":" ElasticSearch Cluster Test - 1" }'
查找Server-1或Server-2上的索引文档:结果总数为1(按预期方式):
curl -XGET' 20.20.20.5:9200 / ert / post / _search?q = user:easlan& pretty = true' curl -XGET' 20.20.20.6:9200 / ert / post / _search?q = user:easlan& pretty = true'
然后关闭Server-1
通过Server-2索引新文档:
curl -XPUT' 20.20.20.6:9200 / ert / post / 2' -d' { "用户":" easlan", " postDate":" 01-16-2015", " body":"在ElasticSearch Cluster中添加数据" , " title":" ElasticSearch Cluster Test - 2" }'
查找Server-2上的索引文档:结果总数为2:
curl -XGET' 20.20.20.6:9200 / ert / post / _search?q = user:easlan& pretty = true'
关闭Server-2
Open Server-1
查找Server-1上的索引文档:结果总数为1(正如预期的那样,因为server-2已关闭):
curl -XGET' 20.20.20.5:9200 / ert / post / _search?q = user:easlan& pretty = true'
然后再次打开Server-2。在Server-1或Server-2上查找索引文档。我们希望看到结果总数为2,但是当我们看时,结果得到1。即使我们再次重启其中两个,结果仍然是1:
curl -XGET' 20.20.20.5:9200 / ert / post / _search?q = user:easlan& pretty = true' curl -XGET' 20.20.20.6:9200 / ert / post / _search?q = user:easlan& pretty = true'
我们的配置:
*** Server-1 ****
cluster.name: ESCluster
node.master: true
node.name: "es1"
node.data: true
network.bind_host: ["127.0.0.1","20.20.20.5"]
network.publish_host: "20.20.20.5"
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["20.20.20.5","20.20.20.6"]
discovery.zen.minimum_master_nodes: 1
*** Server-2 ****
cluster.name: ESCluster
node.master: true
node.name: "es2"
node.data: true
network.bind_host: ["127.0.0.1","20.20.20.6"]
network.publish_host: "20.20.20.6"
discovery.zen.ping.multicast.enabled: false
discovery.zen.ping.unicast.hosts: ["20.20.20.5","20.20.20.6"]
discovery.zen.minimum_master_nodes: 1
答案 0 :(得分:1)