elasticsearch-head插件安裝

安裝nodejs

cd /usr/local/src
wget https://nodejs.org/dist/v6.11.3/node-v6.11.3-linux-x64.tar.xz
yum -y install xz
xz -d node-v6.11.3-linux-x64.tar.xz
tar xf node-v6.11.3-linux-x64.tar -C /usr/local/
ln -s /usr/local/node-v6.11.3-linux-x64 /usr/local/node

vim /etc/profile

###NODE###
export NODE_HOME=/usr/local/node
###所有PATH###
export PATH=$NODE_HOME/bin:$JAVA_HOME/bin:$JRE_HOME/bin:$PATH

一條命令搞定:

echo -e '###NODE###\nexport NODE_HOME=/usr/local/node\n###所有PATH###\nexport PATH=$NODE_HOME/bin:$JAVA_HOME/bin:$JRE_HOME/bin:$PATH'>>/etc/profile&&source /etc/profile&&tail -4 /etc/profile

檢查

[root@elk-node1 src]# node -v
v6.11.3
[root@elk-node1 src]# npm -v
3.10.10

安裝grunt

npm install -g grunt-cli --registry=https://registry.npm.taobao.org
grunt -version

安裝git

yum -y install git

安裝head插件

克隆代碼

mkdir -p /usr/local/elasticsearch-plugin/head/
cd /usr/local/elasticsearch-plugin/head/
git clone git://github.com/mobz/elasticsearch-head.git

修改head插件配置

修改服務(wù)器監(jiān)聽地址 目錄:head/Gruntfile.js 92行后,增加hostname屬性,設(shè)置為*

vim /usr/local/elasticsearch-plugin/head/elasticsearch-head/Gruntfile.js

connect: {
    server: {
        options: {
            port: 9100,
            hostname: '*',
            base: '.',
            keepalive: true
        }
    }
}

修改連接地址:目錄:/usr/local/elasticsearch-plugin/head/elasticsearch-head/_site/app.js
把localhost修改成你es的服務(wù)器地址

sed -i 's#localhost:9200#elk-node1:9200#g' /usr/local/elasticsearch-plugin/head/elasticsearch-head/_site/app.js

查看:

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://elk-node1:9200";

配置elastic插件支持

增加新的參數(shù),這樣head插件可以訪問es,然后重啟 elasticsearch

vim /usr/local/elasticsearch/config/elasticsearch.yml

# head plugins
http.cors.enabled: true
http.cors.allow-origin: "*"

下載依賴包

cd /usr/local/elasticsearch-plugin/head/elasticsearch-head/
npm install --registry=https://registry.npm.taobao.org

有一個(gè)phantomjs-2.1.1-linux-x86_64.tar.bz2 無(wú)法下載,手工翻墻后,下載后放入到/tmp/phantomjs/下;并操作下面命令

rm -rf /usr/local/elasticsearch-plugin/head/elasticsearch-head/node_modules/

后再次執(zhí)行 npm install --registry=https://registry.npm.taobao.org 成功后執(zhí)行

cd /usr/local/elasticsearch-plugin/head/elasticsearch-head
grunt server

查看

將相關(guān)主機(jī)名添加到window的hosts中:
C:\Windows\System32\drivers\etc

192.168.200.21 elk-node1

瀏覽器訪問:http://192.168.200.21:9100/

相關(guān)參考

http://blog.csdn.net/mergerly/article/details/53412417

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容