centos7安裝elasticsearch-head


elasticsearch-head安裝前准備

1.操作系統
64位CentOS Linux release 7.2.1511 (Core)
2.git是必需的
elasticsearch-head是一款開源軟件,被托管在github上面,所以如果我們要使用它,必須先安裝git,通過git獲取elasticsearch-head。我一開始在centos上裝了git,但是后來仔細一想,我windows上已經裝過了,沒必要為了獲取elasticsearch-head再在centos上裝git。不過既然已經裝了,那我們就在centos上獲取吧。
可參考我的另一片文章安裝git:centos7安裝git
3.nodejs也是必需的
運行elasticsearch-head會用到grunt,而grunt需要npm包管理器,所以nodejs是必須要安裝的。
可參考我的另一片文章安裝nodejs:centos7安裝nodejs
4.單獨部署elasticsearch-head
elasticsearch5.0之后,elasticsearch-head不做為插件放在其plugins目錄下了,所以可以單獨部署一台服務器,沒必要和elasticsearch部署在同一台機器

下載elasticsearch-head

使用git拷貝elasticsearch-head到本地

[root@localhost local]# cd /usr/local/

[root@localhost local]# git clone git://github.com/mobz/elasticsearch-head.git

安裝elasticsearch-head依賴包

[root@localhost _site]# cd /usr/local/elasticsearch-head/

[root@localhost local]# cnpm install

如果出現下面的黃色警告,不用管,不影響使用。

npminstall WARN package.json not exists: /usr/local/package.json

修改Gruntfile.js

[root@localhost _site]# cd /usr/local/elasticsearch-head/

[root@localhost elasticsearch-head]# vi Gruntfile.js

在connect-->server-->options下面添加:hostname:’*’,允許所有IP可以訪問

修改elasticsearch-head默認連接地址:

[root@localhost elasticsearch-head]# cd /usr/local/elasticsearch-head/_site/

[root@localhost _site]# vi app.js

將this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";中的localhost修改成你es的服務器地址,我的是:192.168.1.60:9200

配置elasticsearch允許跨域訪問

進入elasticsearch服務器,打開elasticsearch的配置文件elasticsearch.yml,在文件末尾追加下面兩行代碼即可:

http.cors.enabled: true

http.cors.allow-origin: "*"

打開9100端口

如果想在別的機器上訪問,防火牆必須開啟9100端口

永久打開9100端口

[root@localhost elasticsearch-head]# firewall-cmd --zone=public --add-port=9100/tcp --permanent

重啟防火牆

[root@localhost elasticsearch-head]# firewall-cmd --reload

啟動elasticsearch

這里就不介紹了。

只有啟動了elasticsearch,連接的時候才能連接上。

下面是我個人整理的一些筆記,有興趣可以看下

centos7安裝elasticsearch5.2.2

centos7 elasticsearch集群部署

centos7 elasticsearch之kibana安裝

啟動elasticsearch-head

[root@localhost _site]# cd /usr/local/elasticsearch-head/

[root@localhost elasticsearch-head]# node_modules/grunt/bin/grunt server

[root@localhost elasticsearch-head]# cd /usr/local/elasticsearch-head/
[root@localhost elasticsearch-head]#  node_modules/grunt/bin/grunt server
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100

如上,表示elasticsearch-head啟動成功

訪問elasticsearch-head

瀏覽器輸入網址:http://192.168.1.20:9100/

參考網址

http://www.cnblogs.com/valor-xh/p/6293689.html

http://www.cnblogs.com/xing901022/p/6030296.html

 

如有錯誤,歡迎指正,共同學習。

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM