https://blog.csdn.net/feng12345zi/article/details/80367907
https://www.jianshu.com/p/991c74a1bbf7
https://www.cnblogs.com/areyouready/p/8962829.html
指定容器ip
docker network create --driver bridge --subnet=172.18.12.0/16 --gateway=172.18.1.1 mynet
docker run --name es1 -e "ES_JAVA_OPTS=-Xms256m -Xmx256m" -p 9200:9200 -p 9300:9300 --network=mynetwork --ip 172.72.1.1 -v $PWD/es1/conf/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -d elasticsearch:6.4.3
docker run --name es2 -e "ES_JAVA_OPTS=-Xms256m -Xmx256m" -p 9201:9201 -p 9301:9301 --network=mynetwork --ip 172.72.1.2 -v $PWD/es2/conf/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -d elasticsearch:6.4.3
docker run --name es3 -e "ES_JAVA_OPTS=-Xms256m -Xmx256m" -p 9202:9202 -p 9302:9302 --network=mynetwork --ip 172.72.1.3 -v $PWD/es3/conf/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -d elasticsearch:6.4.3
安装完后发现相互之前发现不了,然后关掉防火墙就好了
firewall-cmd --state
systemctl stop firewalld.service
cluster.name: "docker-cluster"
network.bind_host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
node.name: es-node1
minimum_master_nodes need to be explicitly set when bound on a public IP
set to 1 to allow single node clusters
Details: https://github.com/elastic/elasticsearch/pull/17288
discovery.zen.minimum_master_nodes: 2
公网id
network.publish_host: 192.168.199.152
其他节点位置
discovery.zen.ping.unicast.hosts: ["192.169.199.152:9300","192.168.199.152:9301","192.168.199.152:9302"]
path.data
path.data: /usr/share/elasticsearch/data
path.logs
path.logs: /usr/share/elasticsearch/logs