1. 程式人生 > >Linux下Elasticsearch5.0 head插件安裝

Linux下Elasticsearch5.0 head插件安裝

我們 kill 進程 gruntfile etc lin elastic 配置環境變量 -h

下載安裝包

  下載elasticsearch-head

  下載地址:https://github.com/mobz/elasticsearch-head (或者百度搜索elasticsearch head github)

選擇master,然後Download ZIP,下載後獲得 elasticsearch-head-master.zip

技術分享

解壓安裝

  將下載到的elasticsearch-head-master.zip放到/opt目錄下,用root帳號登錄,在/opt目錄下解壓使用命令 upzip elasticsearch-head-master.zip

  移除壓縮包,使用命令

rm -f elasticsearch-head-master.zip

安裝nodejs

  下載地址:https://nodejs.org/en/

  這裏我們下載得到 node-v4.8.3-linux-x64.tar.gz,將它放到/opt目錄下,解壓安裝,使用命令 tar -zxvf node-v4.8.3-linux-x64.tar.gz

  安裝完成後在當前目錄下得到node-v4.8.3-linux-x64這一目錄,進入該目錄,使用命令 cd node-v4.8.3-linux-x64,然後打印獲取當前目錄的地址,使用命令 pwd,然後配置環境變量,使用命令 vim /etc/profile

,追加環境變量配置如下:

技術分享

  運行 source /etc/profile,使/etc/profile文件生效

  輸入 node -v 檢查安裝是否成功,安裝成功會顯示node版本

安裝npm

  進入到elasticsearch-head-master目錄下,使用命令 cd /opt/elasticsearch-head-master

  然後運行命令 npm install;如果速度較慢或者安裝失敗,可以使用國內鏡像:npm install -g cnpm --registry=https://registry.npm.taobao.org

  接著運行命令 npm install -g grunt-cli

修改Elasticsearch配置文件

  使用命令 vim config/elasticsearch.yml,在末尾追加如下三行信息(如果是localhost本地訪問,第一行IP地址可不加):

技術分享

修改Gruntfile.js

  依舊在elasticsearch-head-master目錄下,使用命令 vim Gruntfile.js 修改其中參數如下(寫當前IP):

技術分享

啟動elasticsearch-head

  在elasticsearch-head-master/目錄下,運行啟動命令 grunt server

  接著即可通過IP:9100端口訪問頁面

後臺啟動elasticsearch-head

  後臺啟動grunt server命令 nohup grunt server &exit

  如果想關閉head插件,使用linux查找進程命令 ps aux|grep head

  結束進程 kill 進程號

    

Linux下Elasticsearch5.0 head插件安裝