1. 程式人生 > >Elasticsearch6.0及其head插件安裝

Elasticsearch6.0及其head插件安裝

nic 下載 yml body cluster mod ring cnblogs bsp

Elasticsearch6.0及其head插件安裝

  • 1.下載並解壓elasticsearch

  • 2.修改elasticsearch.yml文件

    # 集群的名字  
    cluster.name: my-application
    # 節點名字  
    node.name: node-1   
    # 數據存儲目錄(多個路徑用逗號分隔)  
    path.data: /home/wjy/es/data  
    # 日誌目錄  
    path.logs: /home/wjy/es/logs  
    #本機的ip地址
    network.host: 192.168.161.128  
    #設置集群中master節點的初始列表,可以通過這些節點來自動發現新加入集群的節點
    discovery.zen.ping.unicast.hosts: ["192.168.161.128"]
    # 設置節點間交互的tcp端口(集群),(默認9300)  
    transport.tcp.port: 9300  
    # 監聽端口(默認)  
    http.port: 9200  
    # 增加參數,使head插件可以訪問es  
    http.cors.enabled: true  
    http.cors.allow-origin: "*"
  • 3.啟動es ./elasticsearch

  • 4.下載head插件

    wget  https://github.com/mobz/elasticsearch-head/archive/master.zip
  • 5.安裝node

    wget https://npm.taobao.org/mirrors/node/latest-v4.x/node-v4.4.7-linux-x64.tar.gz
    tar -zxvf node-v4.4.7-linux-x64.tar.gz

    配置下環境變量,編輯/etc/profile添加

    技術分享圖片


    執行 source /etc/profile

  • 6.安裝grunt

    grunt是基於Node.js的項目構建工具,可以進行打包壓縮、測試、執行等等的工作,head插件就是通過grunt啟動

    cd /opt/elasticsearch-head-master
    npm install -g grunt-cli  //執行後會生成node_modules文件夾

    檢查是否安裝成功

    技術分享圖片

  • 7.修改head插件源碼

    修改服務器監聽地址:Gruntfile.js

    技術分享圖片
    修改連接地址:_site/app.js

    技術分享圖片

  • 7.運行head

    在elasticsearch-head-master目錄下

    npm install(安裝下載下來的包)
    grunt server
  • 8.訪問http://xxx:9100
    技術分享圖片

Elasticsearch6.0及其head插件安裝