- 已关闭。**此问题为not about programming or software development。当前不接受答案。
此问题似乎与a specific programming problem, a software algorithm, or software tools primarily used by programmers无关。如果您认为此问题与another Stack Exchange site的主题有关,您可以留下评论,说明在何处可以回答此问题。
2天前关闭。
Improve this question
用Mac和Docker在单机上安装es集群,只有一个节点加入了集群,另外两个节点没有,我试了很多方法都没能解决,谷歌和百度的答案都解决不了我的问题。
本人简介如下:
cluster.name: elasticsearch-cluster
node.name: es-node1
network.bind_host: 0.0.0.0
network.publish_host: 127.0.0.1
http.port: 9201
transport.tcp.port: 9301
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["127.0.0.1:9301","127.0.0.1:9302","127.0.0.1:9303"]
discovery.zen.minimum_master_nodes: 2
cluster.initial_master_nodes: es-node1
使用的命令按顺序执行:一个节点:
docker运行-e ES_JAVA_OPTS ="-Xms340m-Xmx340m"--网络estnet-d-p 9201:9201-p 9301:9301-v/用户/v_刘小建/桌面/项目/esCluster/es1/es1.yml:/usr/share/elasticsearch/config/elasticsearch. yml-v/用户/v_刘小建/桌面/项目/esCluster/es1/data1:/usr/share/elasticsearch/data--名称es1 b0e9f9f047e6
二节点
docker运行-e ES_JAVA_OPTS ="-Xms340m-Xmx340m"--网络estnet-d-p 9202:9202-p 9302:9302-v/用户/v_刘小建/桌面/项目/esCluster/es2/es2.yml:/usr/share/elasticsearch/config/elasticsearch. yml-v/用户/v_刘小建/桌面/项目/esCluster/es2/data1:/usr/share/elasticsearch/data--名称es2 b0e9f9f047e6
三节点
docker运行-e ES_JAVA_OPTS ="-Xms340m-Xmx340m"--网络estnet-d-p 9203:9203-p 9303:9303-v/用户/v_刘小建/桌面/项目/esCluster/es3/es3.yml:/usr/share/elasticsearch/config/elasticsearch. yml-v/用户/v_刘小建/桌面/项目/esCluster/es3/data1:/usr/share/elasticsearch/data--名称es3 b0e9f9f047e6
创建后重新启动
Docker重启es1 es2 es3
接入后节点节点
http://127.0.0.1:9202/* *
{"名称":"es-node2","群集名称":"ElasticSearch-集群","集群_uuid":"na","版本":* *{"编号":"7.1.1","构建风格":"默认","构建类型":"docker"、"build_hash":"7a013de","构建日期":"2019年5月23日T14:04:00.380842Z","构建_快照":* * 错误**,"lucene版本":"8.0.0"、"最低线兼容性版本":"6.8.0","最小索引兼容性版本":"6.0.0-beta1"},标语:"您知道,用于搜索"}
之后http://127.0.0.1:9202/_cat/nodes?v appear
**
{"错误":{"根本原因":* *[{**"类型":"主机未发现异常","原因":* * 空}],"类型":"主机未发现异常","原因":* * 空},"状态":* * 503人
查看Docker日志并查找:
码头日志-f es2
{"type": "server", "timestamp": "2022-12-29T09:59:26,424+0000", "level": "WARN", "component": "o.e.c.c.ClusterFormationFailureHelper", "cluster.name": "elasticsearch-cluster", "node.name": "es-node2", "message": "master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and this node must discover master-eligible nodes [es-node1] to bootstrap a cluster: have discovered []; discovery will continue using [127.0.0.1:9301, 127.0.0.1:9303] from hosts providers and [{es-node2}{Xe_kGfwwRaCWf1WDoTPdtw}{xxa6ahWHTXGhO6prYnlERg}{127.0.0.1}{127.0.0.1:9302}{ml.machine_memory=4125892608, xpack.installed=true, ml.max_open_jobs=20}] from last-known cluster state; node term 0, last-accepted version 0 in term 0" }
container可以互相ping通,主节点无法连接的原因是什么?
es版本:7.1.1
1条答案
按热度按时间uelo1irk1#
由于您将容器设置为通过
estestnet
网络进行通信,因此请将弹性配置从www.example.com更改127.0.0.1为基于DNS的es1、es2、es3另一种解决方案是将
--network estestnet
更改为--network host