linux安裝es-head插件

1.首先需要node.js環境,去http://nodejs.cn/download/下載

下載下來是.xz後綴的文件node-v12.13.0-linux-x64.tar.xz,

先使用xz -d node-v12.13.0-linux-x64.tar.xz將文件轉換成node-v12.13.0-linux-x64.tar文件,在用tar xvf node-v12.13.0-linux-x64.tar解壓

2.將nodejs加入環境變量,進入到nodejs的bin目錄,pwd複製路徑

修改配置文件vim /etc/profile

生效修改後的配置文件source /etc/profile

輸入npm -version安裝成功

3.安裝cnpm

npm install -g cnpm --registry=https://registry.npm.taobao.org

cnpm install [email protected] --ignore-scripts

grunt是一個很方便的構建工具,可以進行打包壓縮、測試、執行等等的工作,5.0裏的head插件就是通過grunt啓動的。因此需要安裝一下grunt:

cnpm install -g grunt-cli

cnpm install grunt --save-dev
grunt -version

grunt安裝成功

4.下載elastichsearch-head插件
地址:https://github.com/mobz/elasticsearch-head 
安裝git :yum install git 
git clone https://github.com/mobz/elasticsearch-head.git

安裝elastichsearch-head插件
到elasticsearch-head目錄下, 執行cnpm install 命令

5.修改配置

修改es目錄下conf中的elasticsearch.yml,增加以下兩行(跨越的配置)

http.cors.enabled: true
http.cors.allow-origin: "*"
修改完成後重啓ES生效

修改es-head目錄下的/Gruntfile.js,增加hostname屬性,也可以自行更改監聽地址

修改head的連接地址

在es-head的安裝目錄下_site/app.js,將這一行的localhost改成你的主機名或公網IP

this.base_uri = this.config.base_uri || this.prefs.get(“app-base_uri”) || “http://localhost:9200“;

把localhost修改成你es的服務器地址,如:

this.base_uri = this.config.base_uri || this.prefs.get(“app-base_uri”) || “http://192.168.19.105:9200“;

6.運行

前臺運行./node_modules/grunt/bin/grunt server (直接運行)
後臺運行nohup ./node_modules/grunt/bin/grunt server > es-head-start.log 2>&1 & (後臺運行)
 
打開9100端口即可訪問

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