当前位置: 首页 > 工具软件 > plugins > 使用案例 >

please check that any required plugins are installed, or check the breaking changes documentation f

池砚文
2023-12-01

今天在部署es集群的时候,发现它报了下面这样的一个错误:

"Caused by: java.lang.IllegalArgumentException: unknown setting [discovery.send_hosts] please check that any required plugins are installed, or check the breaking changes documentation for removed settings",
"at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:532) ~[elasticsearch-7.6.2.jar:7.6.2]",
"at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:477) ~[elasticsearch-7.6.2.jar:7.6.2]",
"at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:448) ~[elasticsearch-7.6.2.jar:7.6.2]",
"at org.elasticsearch.common.settings.AbstractScopedSettings.validate(AbstractScopedSettings.java:419) ~[elasticsearch-7.6.2.jar:7.6.2]",
"at org.elasticsearch.common.settings.SettingsModule.<init>(SettingsModule.java:149) ~[elasticsearch-7.6.2.jar:7.6.2]",
"at org.elasticsearch.node.Node.<init>(Node.java:356) ~[elasticsearch-7.6.2.jar:7.6.2]",
"at org.elasticsearch.node.Node.<init>(Node.java:257) ~[elasticsearch-7.6.2.jar:7.6.2]",
"at org.elasticsearch.bootstrap.Bootstrap$5.<init>(Bootstrap.java:221) ~[elasticsearch-7.6.2.jar:7.6.2]",
"at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:221) ~[elasticsearch-7.6.2.jar:7.6.2]",
"at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:349) ~[elasticsearch-7.6.2.jar:7.6.2]",
"at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:170) ~[elasticsearch-7.6.2.jar:7.6.2]",

开始的时候,我以为是JDK的问题,当我在linux上面重新安装了一个JDK之后,发现还是没有解决根本的问题,错误依然存在。后来,我就开始查看自己写的快速部署ES集群的脚本,集群shell脚本如下:

for port in $(seq 1 3); \
do \
mkdir -p /mydata/elasticsearch/master-${port}/config
mkdir -p /mydata/elasticsearch/master-${port}/data
chmod -R 777 /mydata/elasticsearch/master-${port}
cat <<EOF> /mydata/elasticsearch/master-${port}/config/elasticsearch.yml
cluster.name: my-es
node.name: es-master-${port}
node.master: true 
node.data: false 
network.host: 0.0.0.0
http.host: 0.0.0.0 
http.port: 920${port}
transport.tcp.port: 930${port}
discovery.zen.ping_timeout: 10s
discovery.send_hosts: ["172.18.12.21:9301","172.18.12.22:9302","172.18.12.23:9303"]
cluster.initial_master_nodes: ["172.18.12.21"]
EOF
docker run --name elasticsearch-node-${port} \
 -p 920${port}:920${port} -p 930${port}:930${port} \
 --network=mynet --ip 172.18.12.2${port} \
 -e ES_JAVA_OPTS="-Xms300m -Xmx300m" \
 -v /mydata/elasticsearch/master-${port}/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
 -v /mydata/elasticsearch/master-${port}/plugins:/usr/share/elasticsearch/plugins \
 --privileged=true \
 -d elasticsearch:7.6.2
done

发现脚本里面有一个discovery.send_hosts,这个是去设置集群节点IP的,可是错误里面显示又没有这个设置,然后百度了一下,我将discovery.send_hosts替换成了discovery.zen.ping.unicast.hosts,修改之后的脚本如下:

for port in $(seq 1 3); \
do \
mkdir -p /mydata/elasticsearch/master-${port}/config
mkdir -p /mydata/elasticsearch/master-${port}/data
chmod -R 777 /mydata/elasticsearch/master-${port}
cat <<EOF> /mydata/elasticsearch/master-${port}/config/elasticsearch.yml
cluster.name: my-es
node.name: es-master-${port}
node.master: true 
node.data: false 
network.host: 0.0.0.0
http.host: 0.0.0.0 
http.port: 920${port}
transport.tcp.port: 930${port}
discovery.zen.ping_timeout: 10s
discovery.zen.ping.unicast.hosts: ["172.18.12.21:9301","172.18.12.22:9302","172.18.12.23:9303"]
discovery.zen.minimum_master_nodes: 2
cluster.initial_master_nodes: ["172.18.12.21"]
EOF
docker run --name elasticsearch-node-${port} \
 -p 920${port}:920${port} -p 930${port}:930${port} \
 --network=mynet --ip 172.18.12.2${port} \
 -e ES_JAVA_OPTS="-Xms300m -Xmx300m" \
 -v /mydata/elasticsearch/master-${port}/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
 -v /mydata/elasticsearch/master-${port}/plugins:/usr/share/elasticsearch/plugins \
 --privileged=true \
 -d elasticsearch:7.6.2
done

然后我再运行这个脚本,发现成功启动了ES集群。

discovery.seed_hosts是一种新的配置方式,
discovery.zen.ping.unicast.hosts是一种过时的配置方式,可以在 elasticsearch.yml 配置文件中使用discovery.zen.ping.unicast.hosts静态设置设置主机列表。
discovery.zen.ping.unicast.hosts: [“host1”, “host2”]
具体的值是一个主机数组或逗号分隔的字符串。
因为我的shell脚本里面配置的都是写在elasticsearch.yml这个配置文件中,是静态设置的主机列表,故需要使用discovery.zen.ping.unicast.hosts来进行设置。

在调试的过程中,可能需要频繁的创建docker容器或者删除docker容器,现在将调试命令贡献给大家,大家可以按需使用:

查询docker运行日志:
docker logs 容器id

批量停止es集群容器:
docker stop $(docker ps -a | grep elasticsearch-node-* | awk ‘{ print $1}’)

批量删除es集群容器:
docker rm $(docker ps -a | grep elasticsearch-node-* | awk ‘{ print $1}’)

 类似资料:

相关阅读

相关文章

相关问答