创建es账户
# 创建用户 es
useradd es
# 设置es用户密码
userpd es
如果是在本机连接,直接切换到es用户,启动
bin/elasticsearch
文件启动es即可
如果是远程连接,继续进行下面操作
修改es配置文件
vim elasticsearch.yml
允许远程访问
network.host: 0.0.0.0
如果此时启动es会报错启动失败
继续添加以下配置
http.cors.allow-origin: "*"
http.cors.enabled: true
cluster.name: es-plume
discovery.seed_hosts: ["127.0.0.1"]
cluster.initial_master_nodes: ["es-plume"]
修改系统配置文件
该步骤需要在
root
账号下进行
- 修改
limits.conf
vim /etc/security/limits.conf
末尾添加下面内容
es soft nofile 65536
es hard nofile 65536
es soft nproc 4096
es hard nproc 4096
注意es为刚刚创建的用户名
- 修改
sysctl.conf
vi /etc/sysctl.conf
末尾添加下面内容
vm.max_map_count = 655360
启动es
切换到es用户
su es
启动es
es-7.6.2/bin/elasticsearch