linux搭建elasticsearch集群

我这里使用了两台服务器,其中一台服务器部署了一个es,另一台部署了两个。(如果有3台更好了)
比如:准备在39.100.113.100上安装一个,在39.100.113.101上安装两个。

elasticsearch的安装,安装参见Linux安装elasticsearch6.2.4

  1. 安装好之后,修改配置文件elasticsearch.yml

39.100.113.100的配置:

#集群名称相同
cluster.name: es-cluster
#节点名不同
node.name: ali
discovery.zen.ping.unicast.hosts: ["39.100.113.101:9512", "39.100.113.101:9513", "39.100.113.100:9512"]
#参与主节点选举
node.master: true
#作为数据节点
node.data: true
network.host: 0.0.0.0
network.publish_host: 39.100.113.100
http.port: 9511
http.cors.enabled: true
http.cors.allow-origin: "*"
transport.tcp.port: 9512
cluster.routing.allocation.disk.threshold_enabled: false

39.100.113.101的配置:

#集群名称相同
cluster.name: es-cluster
#节点名不同
node.name: ali2
discovery.zen.ping.unicast.hosts: ["39.100.113.101:9512", "39.100.113.101:9513", "39.100.113.100:9512"]
#参与主节点选举
node.master: true
#作为数据节点
node.data: true
network.host: 0.0.0.0
network.publish_host: 39.100.113.101
http.port: 9511
http.cors.enabled: true
http.cors.allow-origin: "*"
transport.tcp.port: 9512
cluster.routing.allocation.disk.threshold_enabled: false
#集群名称相同
cluster.name: es-cluster
#节点名不同
node.name: ali3
discovery.zen.ping.unicast.hosts: ["39.100.113.101:9512", "39.100.113.101:9513", "39.100.113.100:9512"]
#不参与主节点选举
node.master: false
#不作为数据节点
node.data: false
network.host: 0.0.0.0
network.publish_host: 39.100.113.101
http.port: 9510
http.cors.enabled: true
http.cors.allow-origin: "*"
transport.tcp.port: 9513
cluster.routing.allocation.disk.threshold_enabled: false
  1. 重新启动3个es
  2. 输入命令 curl http://39.100.113.101:9511/_cat/nodes?v查看列表是否显示三台服务
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值