Centos 使用Docker 部署ES 集群

1, 准备三台Linux服务器

1) 所有服务器都已安装docker

192.168.0.25 node1  主节点
192.168.0.104 node2 子节点
192.168.0.204 node3 子节点

2) 都下载es镜像

docker pull elasticsearch:7.9.3

修改系统配置都需要修改

vi /etc/sysctl.conf
## vm.max_map_count = 262144 修改或者增加这个配置

2, 部署服务

2.1 node1

执行以下命令

mkdir /var/lib/es/node1/plugins
mkdir /var/lib/es/node1/plugins
chmod 777 -R /var/lib/es/node1
docker run -d \
  --name=node1 \
  --net=host \
  -p 9200:9200 \
  -p 9300:9300 \
  -v /var/lib/es/node1/plugins:/usr/share/elasticsearch/plugins \
  -v /var/lib/es/node1/data:/usr/share/elasticsearch/data \
  -e node.name=node1 \
  -e node.master=true \
  -e network.host=192.168.0.25 \
  -e discovery.seed_hosts=192.168.0.104,192.168.0.204 \
  -e cluster.initial_master_nodes=192.168.0.25 \
  -e cluster.name=es-cluster \
  -e "ES_JAVA_OPTS=-Xms3072m -Xmx3072m" \
  elasticsearch:7.9.3

2.2 node2

执行以下命令

mkdir /var/lib/es/node2/plugins
mkdir /var/lib/es/node2/plugins
chmod 777 -R /var/lib/es/node2
docker run -d \
  --name=node2 \
  --net=host \
  -p 9200:9200 \
  -p 9300:9300 \
  -v /var/lib/es/node2/plugins:/usr/share/elasticsearch/plugins \
  -v /var/lib/es/node2/data:/usr/share/elasticsearch/data \
  -e node.name=node2 \
  -e node.master=true \
  -e network.host=0.0.0.0 \
  -e network.publish_host=192.168.0.104 \
  -e discovery.seed_hosts=192.168.0.25,192.168.0.204 \
  -e cluster.initial_master_nodes=192.168.0.25 \
  -e cluster.name=es-cluster \
  -e "ES_JAVA_OPTS=-Xms3072m -Xmx3072m" \
  elasticsearch:7.9.3

2.2 node3

执行以下命令

mkdir /var/lib/es/node3/plugins
mkdir /var/lib/es/node3/plugins
chmod 777 -R /var/lib/es/node3
docker run -d \
  --name=node3 \
  --net=host \
  -p 9200:9200 \
  -p 9300:9300 \
  -v /var/lib/es/node3/plugins:/usr/share/elasticsearch/plugins \
  -v /var/lib/es/node3/data:/usr/share/elasticsearch/data \
  -e node.name=node3 \
  -e node.master=true \
  -e network.host=0.0.0.0 \
  -e network.publish_host=192.168.0.204 \
  -e discovery.seed_hosts=192.168.0.25,192.168.0.104 \
  -e cluster.initial_master_nodes=192.168.0.25 \
  -e cluster.name=es-cluster \
  -e "ES_JAVA_OPTS=-Xms3072m -Xmx3072m" \
  elasticsearch:7.9.3

3, 安装 cerebro 监控工具

在主节点上执行

docker run -d --name cerebro -p 9000:9000 lmenezes/cerebro:0.8.3

访问主节点192.168.0.25:9000
在这里插入图片描述
连接地址前面一定要加http://xxxx:9200
在这里插入图片描述
就能看到节点运行情况

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值