1>拉取镜像
docker pull elasticsearch:7.6.2
2>创建数据挂在目录,以及配置ElasticSearch集群配置文件
mkdir /docker/ES
mkdir /docker/ES/data1
mkdir /docker/ES/data2
mkdir /docker/ES/data3
mkdir /docker/ES/config
在config文件夹下创建配置文件
touch es1.yml es2.yml es3.yml
编辑es1.yml文件
vi es1.yml
cluster.name: hzmt-es-cluster
node.name: es-node1
network.bind_host: 0.0.0.0
network.publish_host: 192.168.10.122
http.port: 9200
transport.tcp.port: 9300
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
discovery.zen.minimum_master_nodes: 2
discovery.seed_hosts: ["192.168.10.122:9300","192.168.10.122:9301","192.168.10.122:9302"]
cluster.initial_master_nodes: ["es-node1","es-node2","es-node3"]
vi es2.yml
cluster.name: hzmt-es-cluster
node.name: es-node1
network.bind_host: 0.0.0.0
network.publish_host: 192.168.10.122
http.port: 9200
transport.tcp.port: 9300
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
discovery.zen.minimum_master_nodes: 2
discovery.seed_hosts: ["192.168.10.122:9300","192.168.10.122:9301","192.168.10.122:9302"]
cluster.initial_master_nodes: ["es-node1","es-node2","es-node3"]
vi es3.yml
cluster.name: hzmt-es-cluster
node.name: es-node1
network.bind_host: 0.0.0.0
network.publish_host: 192.168.10.122
http.port: 9200
transport.tcp.port: 9300
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
discovery.zen.minimum_master_nodes: 2
discovery.seed_hosts: ["192.168.10.122:9300","192.168.10.122:9301","192.168.10.122:9302"]
cluster.initial_master_nodes: ["es-node1","es-node2","es-node3"]
添加防火墙:
firewall-cmd --add-port=9300/tcp
firewall-cmd --add-port=9301/tcp
firewall-cmd --add-port=9302/tcp
改变创建的文件夹权限:
chmod 777 data1 data2 data3
3>启动ElasticSearch集群容器
docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9200:9200 -p 9300:9300 -v /docker/ES/config/es1.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /docker/ES/data1:/usr/share/elasticsearch/data --name ES01 elasticsearch:7.6.2
docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9201:9201 -p 9301:9301 -v /docker/ES/config/es2.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /docker/ES/data2:/usr/share/elasticsearch/data --name ES02 elasticsearch:7.6.2
docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9202:9202 -p 9302:9302 -v /docker/ES/config/es3.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /docker/ES/data3:/usr/share/elasticsearch/data --name ES03 elasticsearch:7.6.2
4>查看es是否启动成功
curl 127.0.0.1:9200
或者在你浏览器输入  src="https://img2020.cnblogs.com/blog/1752043/202007/1752043-20200702153238715-1969520357.png" alt="" loading="lazy">
5>查看集群健康状态
curl ‘127.0.0.1:9200/_cat/health?pretty=true‘
或者在浏览器输入 docker pull mobz/elasticsearch-head:5
启动容器 docker run -d -p 9100:9100 --name es-manager mobz/elasticsearch-head:5
浏览器访 src="https://img2020.cnblogs.com/blog/1752043/202007/1752043-20200702153350080-1450024584.png" alt="" loading="lazy">
(如果是阿里云服务器,记得在安全组中加端口策略开放相应的端口号)
白驹过隙,当看到比你优秀的人比你还努力的时候,你也会越来越优秀,相信越努力越幸运!
centos7下的docker安装ES集群agora、 aca、 雨果、 这类跨境电商卖家风险加大,别把自己玩进去了……、 37万件"中国造"商品被亚马逊召回,产品安全问题再引关注、 亚马逊跟卖是什么?2019年亚马逊如何跟卖以及如何防止跟卖?、 珠海体验式培训、 珠海体验式培训、 珠海体验式培训、
No comments:
Post a Comment