日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Elasticsearch 5.0 —— Head插件部署指南

發布時間:2025/3/21 编程问答 35 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Elasticsearch 5.0 —— Head插件部署指南 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

使用ES的基本都會使用過head,但是版本升級到5.0后,head插件就不好使了。下面就看看如何在5.0中啟動Head插件吧!

官方粗略教程

Running with built in server

enable cors by adding http.cors.enabled: true in elasticsearch configuration. Don’t forget to also set http.cors.allow-origin because no origin allowed by default. http.cors.allow-origin: "*" is valid value, however it’s considered as a security risk as your cluster is open to cross origin from anywhere.

Check Elasticsearch documentation on this parameter:

git clone git://github.com/mobz/elasticsearch-head.git cd elasticsearch-head npm install grunt server

open?http://localhost:9100/
This will start a local webserver running on port 9100 serving elasticsearch-head

Best option if you are likely to connect to several different clusters

部署5.0版本的ES

5.0版本的ES跟之前的版本最大的不同之處就是多了很多環境的校驗,比如jdk,max-files等等。

設置內核參數

vi /etc/sysctl.conf # 增加下面的內容 fs.file-max=65536 vm.max_map_count=262144

設置資源參數

vi /etc/security/limits.conf # 修改 * soft nofile 32768 * hard nofile 65536

修改elasticsearch的參數

修改一下es使用的參數:

# 換個集群的名字,免得跟別人的集群混在一起 cluster.name: es-5.0-test# 換個節點名字 node.name: node-101# 修改一下ES的監聽地址,這樣別的機器也可以訪問 network.host: 0.0.0.0# 默認的就好 http.port: 9200# 增加新的參數,這樣head插件可以訪問es http.cors.enabled: true http.cors.allow-origin: "*"

注意,設置參數的時候:后面要有空格!

安裝部署head

第一步,安裝git

需要從github上面下載代碼,因此先要安裝git

yum -y install git

安裝完成后,就可以直接下載代碼了:

git clone git://github.com/mobz/elasticsearch-head.git

下載后,修改下777權限(簡單粗暴),然后拷貝到es的plugins下面,參考:

/ES_HOME/plugins/head/*

第二步,安裝node

由于head插件本質上還是一個nodejs的工程,因此需要安裝node,使用npm來安裝依賴的包。(npm可以理解為maven)

去官網下載nodejs,https://nodejs.org/en/download/

下載下來的jar包是xz格式的,一般的linux可能不識別,還需要安裝xz.

yum -y install xz

然后解壓nodejs的安裝包:

xz -d node*.tar.xz tar -xvf node*.tar

解壓完node的安裝文件后,需要配置下環境變量,編輯/etc/profile,添加

# set node environment export NODE_HOME=/usr/elk/node-v6.9.1-linux-x64 export PATH=$PATH:$NODE_HOME/bin

別忘記立即執行以下

source /etc/profile

這個時候可以測試一下node是否生效:

[root@localnode1 node-v6.9.1-linux-x64]# echo $NODE_HOME /usr/elk/node-v6.9.1-linux-x64 [root@localnode1 node-v6.9.1-linux-x64]# node -v v6.9.1 [root@localnode1 node-v6.9.1-linux-x64]# npm -v 3.10.8

第三步,安裝grunt

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

npm install grunt-cli

安裝完成后檢查一下:

[root@localnode1 elasticsearch-head]# grunt -version grunt-cli v1.2.0 grunt v0.4.5

第四步,修改head源碼

由于head的代碼還是2.6版本的,直接執行有很多限制,比如無法跨機器訪問。因此需要用戶修改兩個地方:

修改服務器監聽地址

目錄:elasticsearch-5.0.0/plugins/head/Gruntfile.js

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

增加hostname屬性,設置為*

修改連接地址:

目錄:elasticsearch-5.0.0/plugins/head/_site/app.js

修改head的連接地址:

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://10.10.10.10:9200";

第五步,運行head

首先開啟5.0 ES。

然后在head目錄中,執行npm install 下載以來的包:

npm install

最后,啟動nodejs

grunt server

訪問:target:9100

這個時候,訪問http://xxx:9100就可以訪問head插件了.

參考

head官方文檔


from:?http://www.itdadao.com/articles/c15a700524p0.html

總結

以上是生活随笔為你收集整理的Elasticsearch 5.0 —— Head插件部署指南的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。