阿里云ECS
配置:1核1G内存
系统:Centos7
- Elasticsearch默认不推荐使用root用户启动,所以创建用户elastic
useradd elastic
- 设置密码 (回车后输入密码)
passwd elastic
- 切到elastic用户目录下
cd /home/elastic
- 下载Elasticsearch安装包
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.2.tar.gz
- 解压安装包
tar -xzvf elasticsearch-5.5.2.tar.gz
- 给elastic用户设置文件读写权限
chown -R elastic:elastic elasticsearch-5.5.2
- 切换到elastic用户,并启动elasticsearch
su elastic
sh elasticsearch-5.5.2/bin/elasticsearch
启动过程中可能遇到的错误
max number of threads [3895] for user [elk] is too low, increase to at least [4096]
查看服务器当前用户的最大线程数为3895,修改配置文件件/etc/security/limits.d/20-nproc.conf(Centos7):
max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
# 切换到root用户,编辑limits.conf
vi /etc/security/limits.conf
# 添加如下内容
* hard nofile 65536
* soft nofile 65536
max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
# 切换到root用户修改配置sysctl.conf
vi /etc/sysctl.conf
# 添加下面配置:
vm.max_map_count=655360
# 并执行命令:
sysctl -p
# 重启 Elasticsearch