1:下载ES
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.9.2-linux-x86_64.tar.gz
2:解压
tar -zxvf elasticsearch-7.9.2-linux-x86_64.tar.gz
3:修改配置文件
取消掉注释node.name
cluster.name: "docker-cluster"
network.host: 0.0.0.0
http.cors.enabled: true
http.cors.allow-origin: "*"
discovery.seed_hosts: ["127.0.0.1"]
cluster.initial_master_nodes: ["node-1"]
4:添加子用户并设置密码
useradd es7.9
passwd es7.9
输入密码
5:目录授权子用户
chown -R es7.9:es7.9 elasticsearch-7.9.2
6:切换子用户
su es7.9
7:启动
nohup ./elasticsearch &
8:如果报错
用root用户执行
/etc/sysctl.conf 该配置文件增加vm.max_map_count=262144
/sbin/sysctl -p
或
vim /etc/security/limits.conf
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535
或
vim /etc/security/limits.d/20-nproc.conf
* soft nproc 65535
* hard nproc 65535
* soft nofile 65535
* hard nofile 65535