原文地址:https://www.cnblogs.com/sunny1009/p/7874251.html
Centos下Elasticsearch安裝詳細教程
1、Elasticsearch簡介
2、Elasticsearch安裝
下載官網安裝包:https://www.elastic.co/downloads/elasticsearch
選擇linux下的安裝包下載,6.0.0目前最新版,遇到好多問題目前沒有解決,暫且換為5.5.2版本,下載連接:https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.5.2.tar.gz通過WinScp軟件上傳到 /usr/local 目錄下執行命令如下解壓
tar -zxvf elasticsearch-5.5.2.tar.gz
PS:安裝elasticsearch軟件之前必須安裝jdk
3、啟動Elasticsearch
sh /usr/local/elasticsearch-6.0.0/bin/elasticsearch
啟動失敗報如下錯誤
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:
修改/etc/security/limits.conf配置文件,添加如下兩行代碼
* hard nofile 65536 * soft nofile 65536
問題2:
修改/etc/sysctl.conf配置文件
vm.max_map_count = 2621441
讓配置文件生效
sudo sysctl -p /etc/sysctl.conf
再次啟動如果還報同樣的錯誤,最后重啟系統
修改完以上信息重啟系統發現又報如下錯誤
ERROR: bootstrap checks failed
system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
原因是我在Centos6.5系統下安裝Elasticsearch,而Centos6不支持SecComp,再次檢查
/usr/local/elasticsearch-6.0.0/config/elasticsearch.yml中bootstrap.system_call_filter為true進行檢測,所以導致檢測失敗,失敗后直接導致ES不能啟動。
修改為如下
bootstrap.memory_lock: false bootstrap.system_call_filter: false
4、修改Elasticsearch外網訪問
修改配置文件/usr/local/elasticsearch-6.0.0/config/elasticsearch.yml為本機ip地址
關閉防火牆
systemctl stop firewalld.service
systemctl disable firewalld.service
5、啟動訪問
才有后台方式啟動,如果前台啟動,關閉Security服務就被停止了
sh /usr/local/elasticsearch-6.0.0/bin/elasticsearch -d
6、瀏覽器訪問
看到這個界面說明Elasticsearch搭建成功