我正在尝试使集群的健康状况变为绿色。根据以下弹性搜索文档:When you add more nodes to a cluster, it automatically allocates replica shards. When all primary and replica shards are active, the cluster state changes to green.
来源:https ://www.elastic.co/guide/en/elasticsearch/reference/current/add-elasticsearch-nodes.html
因此,我使用以下配置文件创建了 2 个 elasticsearch 实例:
# Config File 1
cluster.name : PL
node.name : "Node-1"
node.master : true
node.data : true
network.host : "127.0.0.1"
http.port : 9200
discovery.zen.ping.unicast.hosts : ["127.0.0.1:9200", "127.0.0.1:9201"]
discovery.zen.minimum_master_nodes : 2
# Config File 2
cluster.name : PL
node.name : "Node-2"
node.master : true
node.data : true
network.host : "127.0.0.1"
http.port : 9201
discovery.zen.ping.unicast.hosts : ["127.0.0.1:9200", "127.0.0.1:9201"]
discovery.zen.minimum_master_nodes : 2
通过运行以下 curl 命令:curl -GETX localhost:9200/_cluster/health?pretty=true
我应该根据 elasticsearch 文档(见下面的链接)在我的集群上有 2 个节点。但是,我的节点数仍为 1。
来源:https ://www.elastic.co/guide/en/elasticsearch/guide/current/_add_failover.html