轉自大資料學習平台:大講台: http://www.dajiangtai.com/course/search.do?search=elastic
另一詳細安裝教程:https://blog.csdn.net/gaoying_blogs/article/category/6303056
首先需要說明的是,在es 5.0之前,es與kibana的不同版本号的版本之間會有相容性問題,但是es 5.0開始,統一了版本号,相同版本号的版本是相容的。
一、節點規劃
host | elasticsearch | kibana |
hadoop01(192.168.174.20) | 安裝 | 安裝 |
hadoop01(192.168.174.21) | 安裝 | 不安裝 |
hadoop01(192.168.174.22) | 安裝 | 不安裝 |
二、安裝es
首先在節點hadoop01上安裝配置,完成後再複制到另外兩台機器上
1、下載下傳es的曆史版本之一:elasticsearch 2.4.6:
下載下傳曆史版本的入口:https://www.elastic.co/downloads/past-releases
2、解壓縮後,修改conf/elasticsearch.yml檔案
注意.ynl檔案的格式要求非常嚴格,每行必須頂格(行開頭不能有空格),配置項的值前面必須有個空格,例如:name: value(:與value之前必須有空格)
主要修改以下配置:
#叢集名稱
cluster.name: escluster
#目前節點名稱(每個節點各不相同)
node.name: node-2
#資料及日志目錄
path.data: /home/hadoop/data/elasticsearch/data
path.logs: /home/hadoop/data/elasticsearch/logs
#目前節點ip或者hostname(每個節點各不相同)
network.host: 192.168.174.22
#http互動端口
http.port: 9200
# --------------------------------- Discovery ----------------------------------
#叢集節點發現機制配置
#不使用預設的多點傳播方式,改用單點傳播方式(Point to Point)
discovery.zen.ping.multicast.enables: false
discovery.zen.ping_timeout: 120s
client.transport.ping_timeout: 60s
#單點傳播的目标節點的ip或者hostname
discovery.zen.ping.unicast.hosts: ["192.168.174.20", "192.168.174.21", "192.168.174.22"]
3、複制到另外兩台機器
将配置好的elasticsearch整個檔案夾通過scp指令,複制到叢集的另外兩台機器上去,然後分别修改配置檔案
4、安裝插件:
沒個節點上都執行以下指令:
執行 bin/plugin install license --verbose,安裝license(注意是license不是licence)
執行 bin/plugin install marvel-agent --verbose (Marvel能夠讓你通過Kibana非常容易的監視ES。你能實時的觀察叢集(your cluster)的健康和表現也能分析過去的叢集、索引和節點名額。
Marvel由兩部分組成:Marvel代理:在你的叢集中安裝在每一個節點上;Marvel應用:安裝在Kibana。
Marvel代理從ES收集和為數值編寫索引,然後通過Kibana中的Marvel儀表闆展示資料。
)
執行bin/plugin install mobz/elasticsearch-head (叢集管理工具、資料可視化、增删改查工具)
5、通過bin/elasticsearch指令啟動三個節點(每個節點都執行)
背景啟動方法:加參數-d
```
[[email protected] bin]$ ./elasticsearch -d
```
[2017-09-28 17:01:49,887][INFO ][marvel.agent.exporter ] [node-0] skipping exporter [default_local] as it isn't ready yet [2017-09-28 17:01:59,888][INFO ][marvel.agent.exporter ] [node-0] skipping exporter [default_local] as it isn't ready yet [2017-09-28 17:02:09,889][INFO ][marvel.agent.exporter ] [node-0] skipping exporter [default_local] as it isn't ready yet [2017-09-28 17:02:10,146][WARN ][discovery ] [node-0] waited for 30s and no initial state was set by the discovery [2017-09-28 17:02:10,163][INFO ][http ] [node-0] publish_address {192.168.174.20:9200}, bound_addresses {192.168.174.20:9200} [2017-09-28 17:02:10,163][INFO ][node ] [node-0] started |
版本5.x以上有可能報錯:
```
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [1024] for user [hadoop] is too low, increase to at least [2048]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
```
解決辦法:
1、max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
每個程序最大同時打開檔案數太小,可通過下面2個指令檢視目前數量
ulimit -Hn
ulimit -Sn
修改/etc/security/limits.conf檔案,增加配置,使用者退出後重新登入生效
* soft nofile 65536
* hard nofile 65536
2、max number of threads [3818] for user [es] is too low, increase to at least [4096]
問題同上,最大線程個數太低。修改配置檔案/etc/security/limits.conf,增加配置
1 2 | |
可通過指令檢視
ulimit -Hu
ulimit -Su
3、max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
修改/etc/sysctl.conf檔案,增加配置vm.max_map_count=262144
vi /etc/sysctl.conf
sysctl -p
執行指令sysctl -p生效
4、Exception in thread "main" java.nio.file.AccessDeniedException: /usr/local/elasticsearch/elasticsearch-6.2.2-1/config/jvm.options
elasticsearch使用者沒有該檔案夾的權限,執行指令
chown -R es:es /usr/local/elasticsearch/
6、web檢視節點及叢集狀态:
#檢視hadoop01上的節點狀态;
http://192.168.174.20:9200
|
#檢視叢集狀态,注意叢集狀态是green時,才是正常,如果red或yellow則需要排查下哪裡有問題
es的叢集所有節點地位平等,是以以下指令在哪台機器上都可以執行(隻要安裝了插件)
http://192.168.174.20:9200/_cluster/health?pretty
|
通過head插件提供的可視化web管理界面檢視:
http://hadoop01:9200/_plugin/head/
7、啟動指令的參數:
bin/elasticsearch -d (背景啟動)
bin/elasticsearch -d -p ../pid (儲存程序号到pid檔案)
三、安裝kibana
1、 下載下傳kibana的4.6.0版本
2、解壓縮後,修改conf/kibana.yml的配置項elasticsearch.url
elasticsearch.url: http://hadoop01:9200
3、安裝插件
執行 bin/kibana plugin --install elasticsearch/marvel/latest
插件安裝成功後可以在installedPlugins目錄下看到
4、啟動kibana:
執行kibana下bin/kibana 即可
5、通過kibana檢視es叢集的各個節點的詳細狀态,及索引資料資訊:http://192.168.174.20:5601
如果檢視marvel時,提示no data 。。,有可能節點時間沒同步,可以通過ntpdate 同步下節點時間,再檢視
發現了一個更詳細的教程,傳送門:
http://www.sojson.com/blog/85.html