elasticsearch-5.5.2安裝
最近在自己電腦上折騰elasticsearch,安裝過程中出現許多問題,記錄下來,供以後查閱參考,也希望可以幫到遇到同樣問題的小夥伴
本人安裝的是elasticsearch-5.5.2,軟體安裝目錄
/export/servers
,我采取的是叢集安裝,三台虛拟機,
node01:192.168.25.120,node02:192.168.25.121,node03:192.168.25.122
.elasticsearch不支援root使用者啟動,是以需要先建一個普通賬戶,用普通賬戶去操作elasticsearch,本人建的普通賬戶是hadoop,
elasticsearch安裝比較簡單,下載下傳,解壓,然後修改elasticsearch.yml檔案,再啟動就可以了.安裝elasticsearch需要先安裝好jdk,這裡不再贅述.
#解壓
tar -zxvf elasticsearch-5.5.2 -C /export/servers
修改elasticsearch.yml檔案
cd /export/servers/elasticsearch-5.5.2/config
vim elasticsearch.yml
#添加以下内容
cluster.name : cluster_es #叢集的名稱
node.name : es_1 #目前節點代表的名字
#目前es産生的資料和日志存放的位置
path.data : /export/servers/elasticsearch-5.5.2/es_data/datas
path.logs : /export/servers/elasticsearch-5.5.2/es_data/logs
network.host : 192.168.25.120【注意:目前節點的ip】
#叢集成員
discovery.zen.ping.unicast.hosts : ["192.168.25.120","192.168.25.121","192.168.25.122"]
#鎖記憶體,不開啟
bootstrap.memory_lock : false
bootstrap.system_call_filter : false #安全插件,不安裝
http.cors.enabled: true #可以使用head插件通路es
http.cors.allow-origin: "*"
xpack.security.enabled : false #不開啟認證 false
##xpack.monitoring.enabled : true
編輯完成儲存退出,将es發送到其他兩台機器上
scp -r elasticsearch-5.5.2 node02:$PWD scp -r elasticsearch-5.5.2 node03:$PWD
,到另外兩台機器上修改elasticsearch.yml檔案的network.host 和node.name屬性
#node02
vim elasticsearch.yml
node.name : es_2
network.host : 192.168.25.121
#node03
vim elasticsearch.yml
node.name : es_3
network.host : 192.168.25.122
修改完成後就可以啟動叢集了,在三台機器上都啟動,進入es的安裝目錄,啟動es
bin/elasticsearch
.
elasticsearch啟動遇到的問題
elasticsearch安裝好以後啟動,遇到很多問題,簡單記錄一下.
1.Java HotSpot™ 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error=‘Cannot allocate memory’ (errno=12)
這是由于elasticsearch預設配置設定jvm空間大小2g,這個修改elasticsearch安裝目錄下config/jvm.options檔案就可以了
# vim config/jvm.options
-Xms2g
-Xmx2g
修改為
-Xms1g
-Xmx1g
注意,三台機器都需要修改.
2.ERROR: bootstrap checks failed
2.1 max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536] max number of threads [1024] for user [hadoop] is too low, increase to at least [2048]
![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLiAzNfRHLGZkRGZkRfJ3bs92YsYTMfVmepNHL9cGRNVTUq5keRRUT1UkMMBjVtJWd0ckW65UbM5WOHJWa5kHT20ESjBjUIF2X0hXZ0xCMx81dvRWYoNHLrdEZwZ1Rh5WNXp1bwNjW1ZUba9VZwlHdssmch1mclRXY39CXldWYtlWPzNXZj9mcw1ycz9WL49zZuBnL0UTNzETM0MjM3ATMwkTMwIzLc52YucWbp5GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.png)
這個切換到root使用者,編輯limits.conf 添加如下内容可以解決
vim /etc/security/limits.conf
#添加如下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
2.2 max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
這個問題,切換到root使用者,修改配置sysctl.conf.
vim /etc/sysctl.conf
#添加下面配置:
vm.max_map_count=655360
#儲存退出後,執行指令:
sysctl -p
2.3 max number of threads [1024] for user [hadoop] is too low, increase to at least [2048]
這個問題,切換到root使用者,修改limits.d下90-nproc.conf .
vim /etc/security/limits.d/90-nproc.conf
修改如下内容:
* soft nproc 1024
#修改為
* soft nproc 2048
2.4 max file descriptors [4096] for elasticsearch process likely too low, increase to at least [65536]
這個問題,切換到root使用者,給limits.conf添加兩行配置
vim /etc/security/limits.conf
* hard nofile 65536
* soft nofile 65536
終于,在報了這麼多錯誤之後,切換到hadoop使用者,進入elasticsearch的安裝目錄,啟動es,
bin/elasticsearch
,三台都啟動.終于啟動成功了.
本篇部落客要參考了以下部落格内容:elasticsearch5.0啟動出現的錯誤,
Elasticsearch5.0 安裝問題集錦