elasticsearch安装部署
一、以6.2.2版本为例(不同版本只需替换url后面的版本号即可)
下载elasticsearch安装包(kinaba/logstash版本应与es版本一致)
https://www.elastic.co/cn/downloads/past-releases/elasticsearch-6-2-2
最新版本:https://www.elastic.co/cn/downloads/elasticsearch
- 解压 tar -xzvf elasticsearch-6.2.2.tar.gz
- 在root下新建用户 es/es (es为了安全不允许root用户启动) ,参考创建用户
- 在es用户下启动 ./bin/elasticsearch -d
- 检查是否启动成功 curl ip:9200 或浏览器访问 http://ip:9200 或 查看启动日志/usr/local/elasticsearch-6.2.2/logs/elasticsearch.log
二、创建用户
1、创建用户:es
adduser es
2、创建用户密码,需要输入两次
passwd es
3、将es文件夹权限赋给该用户
chown -R elasticsearch elasticsearch-6.0.0
4、切换至elasticsearch用户
su elasticsearch
5、启动ES
./elasticsearch -d
三、部署中遇到的问题及解决方案
问题1
elasticsearch process is too low, increase to at least [65536]
解决方案:
1、用root用户修改/etc/security/limits.conf文件
2、在limits.conf加以下参数,注意:es为linux用户名
es hard nofile 65536
es soft nofile 65536
问题2
vm.max_map_count is too low,increase to at least [262144]
解决方案:
方法1:
1、执行命令:
sysctl -w vm.max_map_count=262144
2、查看结果:
sysctl -a|grep vm.max_map_count
方法2:
1、在/etc/sysctl.conf最后添加vm.max_map_count=262144
2、配置生效命令: sysctl -p
问题3
访问拒绝
解决方案:
在/usr/local/elasticsearch-6.2.2/config/elasticsearch.yml加以下参数
#启动拒绝访问,加以下参数
network.host: 0.0.0.0