码迷,mamicode.com
首页 > 其他好文 > 详细

1、ES部署(docker方式)

时间:2020-08-05 00:02:07      阅读:75      评论:0      收藏:0      [点我收藏+]

标签:dir   tcp   net   ges   cal   ret   max   tab   head   

1、部署elaseticsearch

1.1、docker下载

docker pull elasticsearch

docker images

mkdir -p /usr/local/elasticsearch/{config,logs/{node0,node1,node2},data/{node0,node1,node2}}

 

cd /usr/local/elasticsearch/config

touch es0.yml es1.yml es2.yml

 

 chmod -R 777 /usr/local/elasticsearch/data/*

 chmod -R 777 /usr/local/elasticsearch/logs/*

 chmod -R 777 /usr/local/elasticsearch/config/*

 

echo vm.max_map_count=221 >> /etc/sysctl.conf

 

sysctl -p

 

1.2、es配置

 

vi es0.yml

cluster.name: elasticsearch-cluster

 

node.name: es-node1

node.master: true

node.data: true  

 

network.bind_host: 0.0.0.0

network.publish_host: 192.168.30.128

 

http.port: 9200

transport.tcp.port: 9300

 

http.cors.enabled: true

http.cors.allow-origin: "*"

 

discovery.zen.ping.unicast.hosts: ["192.168.30.128:9300","192.168.30.128:9301","192.168.30.128:9302"]

discovery.zen.minimum_master_nodes: 2

 

 

 

 

vi es1.yml

uster.name: elasticsearch-cluster

 

node.name: es-node2

node.master: true

node.data: true

 

network.bind_host: 0.0.0.0

network.publish_host: 192.168.30.128

 

http.port: 9201

transport.tcp.port: 9301

 

http.cors.enabled: true

http.cors.allow-origin: "*"

 

discovery.zen.ping.unicast.hosts: ["192.168.30.128:9300","192.168.30.128:9301","192.168.30.128:9302"]

discovery.zen.minimum_master_nodes: 2

 

 

 

vi es2.yml

cluster.name: elasticsearch-cluster

 

node.name: es-node3

node.master: true

node.data: true

 

network.bind_host: 0.0.0.0

network.publish_host: 192.168.30.128

 

http.port: 9202

transport.tcp.port: 9302

 

http.cors.enabled: true

http.cors.allow-origin: "*"

 

discovery.zen.ping.unicast.hosts: ["192.168.30.128:9300","192.168.30.128:9301","192.168.30.128:9302"]

discovery.zen.minimum_master_nodes: 2

 

1.3、ES容器启动

docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9200:9200 -p 9300:9300 -v /usr/local/elasticsearch/config/es0.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /usr/local/elasticsearch/data/node0:/usr/share/elasticsearch/data --name ES01 elasticsearch

 

 

docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9201:9201 -p 9301:9301 -v /usr/local/elasticsearch/config/es1.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /usr/local/elasticsearch/data/node1:/usr/share/elasticsearch/data --name ES02 elasticsearch

 

 

docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9202:9202 -p 9302:9302 -v /usr/local/elasticsearch/config/es2.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /usr/local/elasticsearch/data/node2:/usr/share/elasticsearch/data --name ES03

 

1.4、查看集群状态:

http://192.168.30.128:9200/_cat/nodes?pretty

 

 

2、安装elasticsearch-head

docker pull mobz/elasticsearch-head:5

docker run -d -p 9100:9100 --name es-manager  mobz/elasticsearch-head:5

 

2.2、访问es:

http://192.168.30.128:9100/

 

1、ES部署(docker方式)

标签:dir   tcp   net   ges   cal   ret   max   tab   head   

原文地址:https://www.cnblogs.com/whxiao/p/13435747.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!