下載 & 解壓
# can not run elasticsearch as root
adduer elk
su elk
cd ~
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.13.0-linux-x86_64.tar.gz
wget https://artifacts.elastic.co/downloads/kibana/kibana-7.13.0-linux-x86_64.tar.gz
tar -zxvf elasticsearch-7.13.0-linux-x86_64.tar.gz
tar -zxvf kibana-7.13.0-linux-x86_64.tar.gz
啟動
elasticsearch-7.13.0/bin/elasticsearch -d
nohup kibana-7.13.0-linux-x86_64/bin/kibana &
curl http://localhost:9300/
http://localhost:5601
開啟遠程訪問端口
vi /home/elk/elasticsearch-7.13.0/config/elasticsearch.yml
network.host: 39.96.*.* # 注意阿里云內(nèi)網(wǎng)IP
vi /home/elk/kibana-7.13.0-linux-x86_64/config/kibana.yml
server.host: "0.0.0.0"
# 使用kill 進行重啟
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 9200 -j ACCEPT
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 5601 -j ACCEPT
note: 阿里云記得開放安全端口
啟動失敗,檢查沒有通過,報錯
[2018-05-18T17:44:59,658][INFO ][o.e.b.BootstrapChecks ] [gFOuNlS] bound or publishing to a non-loopback address, enforcing bootstrap checks
ERROR: [2] bootstrap checks failed
[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,追加以下內(nèi)容;
* 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,追加以下內(nèi)容:
vm.max_map_count=655360
保存后,執(zhí)行:
sysctl -p
重新啟動,成功。
bin/elasticsearch -d
總結(jié)
問題一大堆,如果是測試環(huán)境還是用docker 吧。