记录ES安装流程
准备:安装包、java环境
1、上传elasticsearch-7.3.0-linux-x86_64.tar.gz到服务器目录下/opt/es/
//解压缩
tar -xzvf elasticsearch-7.3.0-linux-x86_64.tar.gz -C /opt/es/;
2、添加用户es
adduser es
3、添加java运行权限&es目录权限
chown -R es /opt/es/
chown -R es {java目录}
4、修改配置文件
cd /opt/es/elasticsearch-7.3.0/config
vim elasticsearch.yml
#内容如下
# ======================== Elasticsearch Configuration =========================
# ---------------------------------- Cluster -----------------------------------
cluster.name: es-cluster
# ------------------------------------ Node ------------------------------------
node.name: node-1
node.master: true
node.data: true
# ----------------------------------- Memory -----------------------------------
bootstrap.memory_lock: false
# ---------------------------------- Network -----------------------------------
network.host: 0.0.0.0
http.port: 9200
transport.tcp.port: 9300
http.cors.enabled: true
http.cors.allow-origin: "*"
# --------------------------------- Discovery ----------------------------------
discovery.seed_hosts: ["ip1"]
# ---------------------------------- Gateway -----------------------------------
gateway.recover_after_nodes: 1
5、启动
#切换用户
su es
#启动服务
./bin/elasticsearch
6、启动报错解决
[1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]
编辑 /etc/security/limits.conf,追加以下内容;
* soft nofile 65536
* hard nofile 65536
此文件修改后需要重新登录用户,才会生效
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
编辑 /etc/sysctl.conf,追加以下内容:
vm.max_map_count=655360
保存后,执行:
sysctl -p
重新启动