在centos7 安装Elasticsearch 步骤:

在centos7 安装Elasticsearch 步骤:

1. 下载安装包
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.14.1-linux-x86_64.tar.gz

2. 解压
tar -zxvf xxx

3. 创建非root 用户
useradd qizhi
passwd xxx

4. 赋予权限
chown -R qizhi:qizhi xxx

5. 切换用户启动
su qizhi

./bin/elasticsearch -d

6. 测试
curl http://localhost:9200

7. 修改配置文件

#节点名称
node.name: localhost.localdomain
##监听IP
network.host: 192.168.157.132
##初始化设置
cluster.initial_master_nodes: ['localhost.localdomain']

8.  启动时遇到的问题
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[1]: max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]

解决方案:

切换到root用户
编辑 /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
重启

9. 关闭防火墙,外部访问

posted @ 2021-09-14 11:33  魏三斗  阅读(572)  评论(0编辑  收藏  举报