Docker安装部署es集群

Docker安装部署es集群:
环境准备:已安装docker的centos服务器一台
1. 拉取es版本
docker pull elasticsearch:5.6.8
2. 新建文件夹 数据挂载目录 和 配置文件目录
[root@localhost es]# mkdir data1
[root@localhost es]# mkdir data2
[root@localhost es]# mkdir data3
[root@localhost es]# cd config/
[root@localhost config]# touch es1.yml
[root@localhost config]# vim es1.yml

es1.yml文件

cluster.name: elasticsearch-cluster
node.name: es-node1
network.bind_host: 0.0.0.0
network.publish_host: 192.168.1.110
http.port: 9200
transport.tcp.port: 9300
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["192.168.1.110:9300","192.168.1.110:9301","192.168.1.110:9302"]
discovery.zen.minimum_master_nodes: 2
es2.yml文件

cluster.name: elasticsearch-cluster
node.name: es-node2
network.bind_host: 0.0.0.0
network.publish_host: 192.168.1.110
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: ["192.168.1.110:9300","192.168.1.110:9301","192.168.1.110:9302"]
discovery.zen.minimum_master_nodes: 2
es3.yml文件

cluster.name: elasticsearch-cluster
node.name: es-node3
network.bind_host: 0.0.0.0
network.publish_host: 192.168.1.110
http.port: 9202
transport.tcp.port: 9302
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["192.168.1.110:9300","192.168.1.110:9301","192.168.1.110:9302"]
discovery.zen.minimum_master_nodes: 2

3. 调高jvm线程数限制
vim /etc/sysctl.conf
加入
vm.max_map_count=262144

执行生效
sysctl –p
4. 启动es集群
docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9200:9200 -p 9300:9300 -v /home/soft/ES/config/es1.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /home/soft/ES/data1:/usr/share/elasticsearch/data --name ES01 elasticsearch:5.6.8

docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9201:9201 -p 9301:9301 -v /home/soft/ES/config/es2.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /home/soft/ES/data2:/usr/share/elasticsearch/data --name ES02 elasticsearch:5.6.8

docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9202:9202 -p 9302:9302 -v /home/soft/ES/config/es3.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /home/soft/ES/data3:/usr/share/elasticsearch/data --name ES03 elasticsearch:5.6.8

5. 可以使用google(elasticsearch-head.crx)插件连接集群查看:

Docker安装部署es集群

上一篇:CodeForces - 55D Beautiful numbers(数位DP+Hash)题解


下一篇:JSP学习——原理