经过网络搜索、整理、实践笔记
1. elastic官网下载es安装文件
https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.3.tar.gz
2. 解压文件
将文件上传至服务器存放的目录,执行解压:
tar -zxvf elasticsearch-5.5.3.tar.gz
3. 启动
elasticsearch2.3以后不允许root 用户启动es服务,创建一个新用户来启动服务
root下创建用户:useradd elastic
对文件夹授权:chown -R elastic elasticsearch-5.5.3
权限:chmod 755 elasticsearch-5.5.3
4. elasticsearch.yml配置修改
打开文件:vim config/elasticsearch.yml
修改访问IP的名称:network.host: 59.110.104.99
打开访问的端口:http.port: 9200
参考配置:bootstrap.memory_lock: true
(待确认)之前配置:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
跨域支持:
http.cors.enabled: true
http.cors.allow-origin: "*"
5. max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
vim /etc/sysctl.conf
add:
#for elasticsearch
vm.max_map_count = 262144
执行命令:sysctl -p
sysctl vm.max_map_count 检查是否生效,临时方法:sysctl -w vm.max_map_count=262144
6. 调整虚拟机参数
vi jvm.options
-Xms32766m
-Xmx32766m
7. max number of threads [1024] for user [es] likely too low, increase to at least [2048]
vim /etc/security/limits.d/90-nproc.conf
* soft nproc 1024 修改为:
* soft nproc 2048
8. max file descriptors [65535] for elasticsearch process likely too low, increase to at least [65536]
执行:vim /etc/security/limits.conf
修改:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
9. 启动停止es服务
启动:
su elastic
./elasticsearch --前台
./elasticsearch -d --后台
停止:
kill -9 进程号