1、环境配置
vi /etc/security/limits.conf
新增内容如下:
* hard nofile 65536
* soft nproc 65536
* hard nproc 65536
* soft memlock unlimited
* hard memlock unlimited
vi /etc/sysctl.conf
新增内容如下:
vm.max_map_count=655360
fs.file-max=655360
执行 sysctl -p 让其生效
2、部署地址:
node1:192.168.1.151
node2:192.168.1.152
node3:192.168.1.153
3、配置修改
vi config/elasticsearch.yml
#192.168.1.151配置:
cluster.name: canna-es-cluster
node.name: node-1
path.data: /data/elasticsearch-7.5.1/data
path.logs: /data/elasticsearch-7.5.1/logs
network.host: 192.168.1.151
http.port: 9200
discovery.seed_hosts: ["192.168.1.151", "192.168.1.152", "192.168.1.153"]
cluster.initial_master_nodes: ["192.168.1.151", "192.168.1.152", "192.168.1.153"]
#192.168.1.152配置:
cluster.name: canna-es-cluster
node.name: node-2
path.data: /data/elasticsearch-7.5.1/data
path.logs: /data/elasticsearch-7.5.1/logs
network.host: 192.168.1.152
http.port: 9200
discovery.seed_hosts: ["192.168.1.151", "192.168.1.152", "192.168.1.153"]
cluster.initial_master_nodes: ["192.168.1.151", "192.168.1.152", "192.168.1.153"]
#192.168.1.151配置:
cluster.name: canna-es-cluster
node.name: node-3
path.data: /data/elasticsearch-7.5.1/data
path.logs: /data/elasticsearch-7.5.1/logs
network.host: 192.168.1.153
http.port: 9200
discovery.seed_hosts: ["192.168.1.151", "192.168.1.152", "192.168.1.153"]
cluster.initial_master_nodes: ["192.168.1.151", "192.168.1.152", "192.168.1.153"]
4、启动修改
vi bin/elasticsearch
#文件顶部添加如下内容
JAVA="/app/elasticsearch-7.5.1/jdk/bin/java"
export JAVA_HOME=/app/elasticsearch-7.5.1/jdk
export PATH=$JAVA_HOME/bin:$PATH
5、创建目录并配置用户
mkdir -p /data/elasticsearch-7.5.1/data
mkdir -p /data/elasticsearch-7.5.1/logs
groupadd elasticsearch
useradd -g elasticsearch elasticsearch
chmod +w /app/elasticsearch-7.5.1
chown -R elasticsearch:elasticsearch /app/elasticsearch-7.5.1
chown -R elasticsearch:elasticsearch /data/elasticsearch-7.5.1
chmod -R 777 /data/elasticsearch-7.5.1
6、启动
需要切换到elasticsearch用户,不能用root用户启动
su elasticsearch
bin/elasticsearch -d
#说明: -d为后台启动