Centos7 安裝 elasticsearch-head插件


上車

Head是elasticsearch的集群管理工具,可以用於數據的瀏覽和查詢。
elasticsearch-head是一款開源軟件,被托管在github上面,所以如果我們要使用它,必須先安裝git,通過git獲取elasticsearch-head
運行elasticsearch-head會用到grunt,而grunt需要npm包管理器,所以nodejs是必須要安裝的。

發車

git 拉下來

elasticsearch 5.0 之后,elasticsearch-head不做為插件放在其plugins目錄下。使用git拷貝elasticsearch-head到本地

cd /wwwroot/soft/es-plugins
git clone git://github.com/mobz/elasticsearch-head.git

安裝nodejs

去nodejs 官網下載最新的

解壓:tar xvf node-v12.13.0-linux-x64.tar.xz

做2個軟連接:
ln -s /wwwroot/soft/node-v12.13.0-linux-x64/bin/node /usr/bin/node
ln -s /wwwroot/soft/node-v12.13.0-linux-x64/bin/npm /usr/bin/npm

安裝 grunt

npm install -g grunt-cli

安裝 elasticsearch-head 依賴的包

cd elasticsearch-head
npm install

報錯:Error: Command failed: tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2tar (child): bzip2:無法 exec: 沒有那個文件或目錄

解決: yum -y install bzip2.x86_64

報錯:Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1571667960384/phantomjs-2.1.1-linux-x86_64' -> '/wwwroot/soft/es-plugins/elasticsearch-head/node_modules/phantomjs-prebuilt/lib/phantom'

我大root居然有權限問題! 搜了下 github上說要加--unsafe-perm
rm -rf node_modules/ npm install --unsafe-perm
安裝成功!

head修改配置

修改hostname

修改 Gruntfile.js 在connect-->server-->options下面添加:hostname:' ** ,允許所有IP可以訪問

修改默認連接地址

修改elasticsearch-head默認連接地址,改成你自己的es地址

cd /wwwroot/soft/es-plugins/elasticsearch-head/_site
vim app.js
將4374行 this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://10.180.18.38:9201"; 
修改es

想在界面上看到es集群信息,必須在elasticsearch.yml增加兩項配置,重啟es
打開elasticsearch 的配置文件 elasticsearch.yml 在末尾加上:

http.cors.enabled: true
http.cors.allow-origin: "*"

到站

啟動es

啟動 elasticsearch-head nohup ./node_modules/grunt/bin/grunt server &

然后打開瀏覽器訪問:

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM