Elasticsearch-安裝可視化管理插件head

1).下載head插件

elasticsearch-head-master.zip:https://github.com/mobz/elasticsearch-head

2).下載nodejs

node-v6.9.2-linux-x64.tar.gz: https://nodejs.org/dist/

3).上傳至 master節點 /opt/software目錄。

4).安裝nodejs

[dendan@master software]$ tar -zxvf node-v6.9.2-linux-x64.tar.gz -C /opt/module/

5).配置nodejs環境變量

[root@master software]# vi /etc/profile

追加內容:

export NODE_HOME=/opt/module/node-v6.9.2-linux-x64
export PATH=$PATH:$NODE_HOME/bin

重新加載profile

[root@master software]# source /etc/profile 

6)查看node和npm版本

[root@master software]# node -v
v6.9.2 
[root@master software]# npm -v
3.10.9 

7)解壓head插件到/opt/module目錄下

[dendan@master software]$ unzip elasticsearch-head-master.zip -d /opt/module/

8)查看當前head插件目錄下有無node_modules/grunt目錄:

沒有:執行命令創建:

[dendan@master elasticsearch-head-master]$ npm install grunt --save

9)安裝head插件:

[dendan@master elasticsearch-head-master]$ npm install -g cnpm --registry=https://registry.npm.taobao.org

10)安裝grunt:

[dendan@master elasticsearch-head-master]$ npm install -g grunt-cli

11)編輯Gruntfile.js

[dendan@master elasticsearch-head-master]$ vim Gruntfile.js

文件93行添加hostname:'0.0.0.0’
修改後:

options: {
        hostname:'0.0.0.0',
        port: 9100,
        base: '.',
        keepalive: true
      }

12)檢查head根目錄下是否存在base文件夾

沒有:將 _site下的base文件夾及其內容複製到head根目錄下

[dendan@master elasticsearch-head-master]$ mkdir base
[dendan@master _site]$ cp base/* ../base/

13)啓動grunt server:

[dendan@master elasticsearch-head-master]$ grunt server -d
Running "connect:server" (connect) task
[D] Task source: /opt/module/elasticsearch-head-master/node_modules/grunt-contrib-connect/tasks/connect.js
Waiting forever...
Started connect web server on http://localhost:9100

如果提示grunt的模塊沒有安裝:
Local Npm module “grunt-contrib-clean” not found. Is it installed?
Local Npm module “grunt-contrib-concat” not found. Is it installed?
Local Npm module “grunt-contrib-watch” not found. Is it installed?
Local Npm module “grunt-contrib-connect” not found. Is it installed?
Local Npm module “grunt-contrib-copy” not found. Is it installed?
Local Npm module “grunt-contrib-jasmine” not found. Is it installed?
Warning: Task “connect:server” not found. Use –force to continue.
逐個執行以下命令:

npm install grunt-contrib-clean -registry=https://registry.npm.taobao.org
npm install grunt-contrib-concat -registry=https://registry.npm.taobao.org
npm install grunt-contrib-watch -registry=https://registry.npm.taobao.org 
npm install grunt-contrib-connect -registry=https://registry.npm.taobao.org
npm install grunt-contrib-copy -registry=https://registry.npm.taobao.org 
npm install grunt-contrib-jasmine -registry=https://registry.npm.taobao.org

最後一個模塊可能安裝不成功,但是不影響使用。

14)瀏覽器訪問head插件:

http://master:9100
在這裏插入圖片描述

15)啓動集羣插件後發現集羣未連接

在/opt/module/elasticsearch-5.2.2/config路徑下修改配置文件elasticsearch.yml,在文件末尾增加

[dendan@master config]$ pwd
/opt/module/elasticsearch-5.2.2/config
[dendan@master config]$ vi elasticsearch.yml

追加的內容:

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

再重新啓動elasticsearch。

16)關閉插件服務

ctrl+c
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章