阿里云ECS
配置:1核1G內(nèi)存
系統(tǒng):Centos7
- Elasticsearch默認(rèn)不推薦使用root用戶啟動(dòng),所以創(chuàng)建用戶elastic
useradd elastic
- 設(shè)置密碼 (回車后輸入密碼)
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用戶設(shè)置文件讀寫權(quán)限
chown -R elastic:elastic elasticsearch-5.5.2
- 切換到elastic用戶,并啟動(dòng)elasticsearch
su elastic
sh elasticsearch-5.5.2/bin/elasticsearch
啟動(dòng)過程中可能遇到的錯(cuò)誤
max number of threads [3895] for user [elk] is too low, increase to at least [4096]
查看服務(wù)器當(dāng)前用戶的最大線程數(shù)為3895,修改配置文件件/etc/security/limits.d/20-nproc.conf(Centos7):

image.png
max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
# 切換到root用戶,編輯limits.conf
vi /etc/security/limits.conf
# 添加如下內(nèi)容
* 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
# 并執(zhí)行命令:
sysctl -p
# 重啟 Elasticsearch