在单台服务器上创建多个节点的ES集群

一. 创建自定义网络,用于部署ES集群

docker network create --subnet=172.18.0.0/16 --gateway=172.18.0.1 talnet 

二. ES配置文件

节点1: es1.yml

 cluster.name: cluster-name  node.name: es-node1 netwotk.host: 0.0.0.0   network.bind_host: 172.18.0.2  network.publish_host: 172.18.0.2  http.port: 7200  transport.tcp.port: 7300  http.cors.enabled: true  http.cors.allow-origin: "*"  node.master: true  node.data: true   discovery.seed_hosts: ["172.18.0.2:7300","172.18.0.3:7301"] cluster.initial_master_nodes: ["172.18.0.2","172.18.0.3"] 

节点二:es2.yml

 cluster.name: cluster-name  node.name: es-node2   network.bind_host: 172.18.0.3  network.publish_host: 172.18.0.3  http.port: 7201  transport.tcp.port: 7301  http.cors.enabled: true  http.cors.allow-origin: "*"  node.master: true  node.data: true   discovery.seed_hosts: ["172.18.0.2:7300","172.18.0.3:7301"] cluster.initial_master_nodes: ["172.18.0.2","172.18.0.3"] 

三. 启动

启动节点一:

docker run -e ES_JAVA_OPTS="-Xms1024m -Xmx1024m" -p 7200:7200 -p 7300:7300 \ -v /data/es1.yml:/usr/share/elasticsearch/config/elasticsearch.yml \ -v /data/data1:/usr/share/elasticsearch/data --network=talnet --ip 172.18.0.2 --name ES01 es_ik:7.4.2 

启动节点二:

docker run -e ES_JAVA_OPTS="-Xms1024m -Xmx1024m" -p 7201:7201 -p 7301:7301 \ -v /data/es2.yml:/usr/share/elasticsearch/config/elasticsearch.yml \ -v /data/data2:/usr/share/elasticsearch/data --network=talnet --ip 172.18.0.3 --name ES02 es_ik:7.4.2 

四. 验证集群

-> curl http://127.0.0.1:7201/_cat/nodes\?v ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name 172.18.0.3 31 97 0 1.03 0.46 0.17 dilm - es-node2 172.18.0.2 31 97 0 1.03 0.46 0.17 dilm * es-node1 

原文链接:https://blog.csdn.net/num270710/article/details/106902995/

原创文章,作者:优速盾-小U,如若转载,请注明出处:https://www.cdnb.net/bbs/archives/7051

(0)
上一篇 2022年10月13日 20:17
下一篇 2022年10月13日

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

优速盾注册领取大礼包www.cdnb.net
/sitemap.xml