操作系统:centos7
三台虚拟机
192.168.2.251
192.168.2.252
192.168.2.253
配置文件
elasticsearch.yml
公共配置:
cluster.routing.allocation.disk.threshold_enabled: false
cluster.name: immoc-es-cluster
node.name: es-node1
path.data: /usr/local/elasticsearch-7.4.2/data
path.logs: /usr/local/elasticsearch-7.4.2/logs
network.host: 0.0.0.0
node.master: true
node.data: true
discovery.seed_hosts: ["192.168.2.251", "192.168.2.252", "192.168.2.253"]
192.168.2.251
cluster.initial_master_nodes: ["es-node1"]
192.168.2.252
cluster.initial_master_nodes: ["es-node2"]
192.168.2.253
cluster.initial_master_nodes: ["es-node3"]
/etc/sysctl.conf配置文件
192.168.2.251-253
vm.max_map_count=262145
/etc/security/limits.conf
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
创建一个用户
useradd esuser
给新建用户授权
chown -R esuser /usr/local/elasticsearch-7.4.2/
切换用户
su esuser
/usr/local/elasticsearch-7.4.2/bin
执行./elasticsearch启动应用
创建索引
3分片,每个分片,有两个副本
此时es-node1为主节点
es-node1宕机之后
es-node1恢复之后