前言
Reference documents:
- Elasticsearch 7.1.1 cluster + configuration authentication (linux): https://www.cnblogs.com/wmht/p/11045025.html
- Windows ElasticSearch 7.6.0 cluster construction: https://blog.csdn.net/csdn565973850/article/details/104772551/
- ElasticSearch7.1.1 cluster construction: https://blog.csdn.net/qq_27512271/article/details/98740135
状况描述
The three local es are all started, but when the head is ip+端口
connected, which one is connected will be displayed below.
The cerebro
same is true through connection.
下面是我的配置(错误配置示例)
#集群名称,三台集群,要配置相同的集群名称!!!
cluster.name: my-application
#节点名称
node.name: node-3 #是不是有资格主节点
node.master: true
#是否存储数据
node.data: true
#最⼤集群节点数
node.max_local_storage_nodes: 3 #⽹关地址
# 监听地址,用于访问该es
network.host: localhost
#端⼝
http.port: 9202
#内部节点之间沟通端⼝
transport.tcp.port: 9302
#es7.x 之后新增的配置,写⼊候选主节点的设备地址,在开启服务后可以被选为主节点
discovery.seed_hosts: ["localhost:9300", "localhost:9301", "localhost:9302"]
#es7.x 之后新增的配置,初始化⼀个新的集群时需要此配置来选举master
cluster.initial_master_nodes: ["node-1", "node-2","node-3"] #数据和存储路径
path.data: D:\\Elasticsearch\\es-cluster\\elasticsearch-7.8.1_node3\\data
path.logs: D:\\Elasticsearch\\es-cluster\\elasticsearch-7.8.1_node3\\logs
# 是否支持跨域,是:true,在使用head插件时需要此配置
http.cors.enabled: true
# “*” 表示支持所有域名
http.cors.allow-origin: "*"
action.destructive_requires_name: true
action.auto_create_index: .security,.monitoring*,.watches,.triggered_watches,.watcher-history*
xpack.security.enabled: false
xpack.monitoring.enabled: true
xpack.graph.enabled: false
xpack.watcher.enabled: false
xpack.ml.enabled: false
In the configuration, the ip was changed and changed again, but it was never successful.
解决思路
Because before the es cluster, the zookeeper cluster was built locally in the window, so the path of the data and logs file address is written by referring to that.
I checked a few more articles this morning and found that the addresses inside were all /opt/xxxxxx.Note: the key point, right slash...
There is really no way, so I tried to change the address to this. The modified configuration:
#集群名称,三台集群,要配置相同的集群名称!!!
cluster.name: my-application
#节点名称
node.name: node-3 #是不是有资格主节点
node.master: true
#是否存储数据
node.data: true
#最⼤集群节点数
node.max_local_storage_nodes: 3 #⽹关地址
# 监听地址,用于访问该es
network.host: localhost
#端⼝
http.port: 9202
#内部节点之间沟通端⼝
transport.tcp.port: 9302
#es7.x 之后新增的配置,写⼊候选主节点的设备地址,在开启服务后可以被选为主节点
discovery.seed_hosts: ["localhost:9300", "localhost:9301", "localhost:9302"]
#es7.x 之后新增的配置,初始化⼀个新的集群时需要此配置来选举master
cluster.initial_master_nodes: ["node-1", "node-2","node-3"] #数据和存储路径
path.data: /opt/elasticsearch/data
path.logs: /opt/elasticsearch/logs
# 是否支持跨域,是:true,在使用head插件时需要此配置
http.cors.enabled: true
# “*” 表示支持所有域名
http.cors.allow-origin: "*"
action.destructive_requires_name: true
action.auto_create_index: .security,.monitoring*,.watches,.triggered_watches,.watcher-history*
xpack.security.enabled: false
xpack.monitoring.enabled: true
xpack.graph.enabled: false
xpack.watcher.enabled: false
xpack.ml.enabled: false
Launch success page
After refreshing cerebro
, there are three directly displayed below:
refreshhead
总结
In addition to the conventional configuration, the key point: the path configuration of data and logs. If this configuration is wrong, there is no error prompt when starting