ElasticSearch插件es-head安裝及使用
es-head需要nodejs環(huán)境編譯,先看看機器中是否已經有nodejs環(huán)境,如果沒有的話我們先要安裝nodejs環(huán)境:
一、先下載安裝nodejs
nodjs官網:https://nodejs.org/en/download/
這里下載的新版本 v12.18.1
wget https://nodejs.org/dist/v12.18.1/node-v12.18.1-linux-x64.tar.xz
tar xf node-v12.18.1-linux-x64.tar.xz
mv node-v12.18.1-linux-x64 /usr/local/node
# 設置環(huán)境變量
echo "export PATH=$PATH:/usr/local/node/bin" >> ~/.bashrc
# 刷新
source ~/.bashrc
1.1 測試安裝是否成功
node -v
自此,需要的環(huán)境已準備完畢,下面開始安裝es-head插件。
二、下載elasticsearch head
可使用git命令在線下載,或者下載zip包之后,離線安裝都可以
git下載
下載zip包
2.1 編譯安裝
進入head目錄執(zhí)行npm
命令或cnpm
命令安裝:
cd elasticsearch-head
npm install
安裝cnpm
npm install -g cnpm --registry=https://registry.npm.taobao.org
2.2 修改鏡像源
如果npm install一直卡在Receiving...
不動的話,是因為訪問的npm registry網絡不行,我們可以修改為淘寶的倉庫:
#查看npm倉庫
npm config get registry
#或
npm info express
#修改為淘寶的源
npm config set registry http://registry.npm.taobao.org
這時候再執(zhí)行npm install
速度就快許多!
2.3啟動驗證
配置es:
# vim $ES_HOME/config/elasticsearch.yml
http.cors.enabled: true
http.cors.allow-origin: "*"
修改完ES配置重啟ES后,在es-head安裝目錄下使用下面的命令啟動es-head插件:
npm run start & # 后臺運行
如下圖:啟動成功
根據提示,我們訪問http://xxx:9100 看看效果,已成功啟動并訪問我們的ES集群:
2.4 es-head使用密碼訪問ES
ES開啟安全認證,把集群修改其中一項配置然后重啟ES集群
http.cors.enabled: true
http.cors.allow-origin: "*"
#http.cors.allow-headers: Authorization #這個配置改為下面的
http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
使用xpack安全認證的ES集群,密碼改為自己的即可
Linux使用命令檢測集群是否健康
curl -XGET -u elastic:JCK3BPr2g25G http://xxx:9200/_cluster/health?pretty
web頁面登錄
http://xxx:9100/?auth_user=elastic&auth_password=JCK3BPr2g25G
文章來源:http://www.zghlxwxcb.cn/news/detail-404031.html
參考:文章文章來源地址http://www.zghlxwxcb.cn/news/detail-404031.html
到了這里,關于ElasticSearch插件es-head安裝及使用的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!