Elasticsearch -----集群操作

------------恢复内容开始------------

  1. 准备工作

创建三台虚拟机(静态上网方式内网互通) 如图下
192.168.1.200
192.168.1.201
192.168.1.202

200节点 做了ping 其他只是展示代表内网互通

201节点

202节点

下载解压 elasticsearch-7.6.2 到 /usr/local/elastcsearch 3台机器相同操作

设置cluster-name

设置 node-name

设置path.data= 索引目录
path.log=增删改查操作日志 目录

设置网路设置
network.host: 0.0.0.0 #允许外网访问
network.publish_host: 192.168.1.200 #绑定内部通信端口
http.port: 9200 #端口
http.cors.enabled: true #开启跨域
http.cors.allow-origin: "*" #允许所有
node.master: true #是否是主节点
node.data: true #是否存储数据

设置 集群节点 和主节点
discovery.seed_hosts: ["192.168.1.200", "192.168.1.201","192.168.1.202"]
cluster.initial_master_nodes: ["e1"]

三台配置整体节点如下

useradd esuser
chown -R esuser:esuser /usr/local/elasticsearch-7.4.2
su esuser
whoami
切换回
cd /usr/local/elasticsearch-7.6.2/bin
然后启动

如出现一下错误

三台都需要操作
那么需要切换到root用户下去修改配置如下:

vim /etc/security/limits.conf

  • soft nofile 65536
  • hard nofile 131072
  • soft nproc 2048
  • hard nproc 4096

然后修改 vim /etc/sysctl.conf

命令刷新
sysctl -p

切换回 su esuser 用户进行重启

重启成功后 我直接用es-head 工具查看了

posted @ 2020-04-16 22:05  fly_jiang  阅读(252)  评论(0编辑  收藏  举报