如何在centos中离线安装elasticsearch7.8
官网下载安装包
下载地址:https://www.elastic.co/cn/downloads/past-releases
下载好的文件为:elasticsearch-7.8.0-linux-x86_64.tar.gz
300M官网慢可以从这里下载 http://www.jrnsoft.com/ziyuan.html
上传安装包
上传至linux服务器/usr/local目录下,
执行并解压,解压后会生成一个名为elasticsearch-7.8.0的文件夹
cd /usr/local
tar xzvf elasticsearch-7.8.0-linux-x86_64.tar.gz
修改配置文件
修改配置文件/root/elasticsearch-7.8.0/config/elasticsearch.yml
#设置节点服务器ip(其他服务器可通过IP访问)
network.host: 0.0.0.0
cluster.initial_master_nodes: ["node-1"]
创建启动用户
elasticsearch不支持root用户启动,所以需要新建一个用户,并把解压后的目录权限赋给新建用户。
#新建用户es
useradd es
#给用户设置密码
passwd es
#目录赋权
chown -R es /usr/local/elasticsearch-7.8.0
后台启动elasticsearch
切换到用户es,并进入/usr/local执行bin/elasticsearch -d
su - es
cd /usr/local/elasticsearch-7.8.0
bin/elasticsearch -d
查看启动日志/usr/local/elasticsearch-7.8.0/logs/elasticsearch.log
验证
curl http://localhost:9200
常见启动异常
启动elasticsearch时常见报错有
1,max file descriptors [4096] 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=262144
vi /etc/sysctl.conf
sysctl -p
3,the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured
修改elasticsearch.yml添加
cluster.initial_master_nodes: ["node-1"]