QQ交流羣:64655993 希望能對您有所幫助!!!
一、基礎環境說明
1、系統說明
系統:CentOS-7-x86_64-Minimal-1708
下載地址:
http://archive.kernel.org/centos-vault/7.4.1708/isos/x86_64/
2、使用工具
工具:xshell5
VMware 版本:VMware Workstation Pro15
3、安裝虛擬機(也可基於已安裝好的ES集羣中的某一個節點,下文選擇了集羣的一個節點)
安裝1個虛擬機
虛擬機配置: 1G內存 1核CPU
安裝過程可參考:
https://blog.csdn.net/llwy1428/article/details/89328381
4、虛擬機接入互聯網
網卡配置可參考:
https://blog.csdn.net/llwy1428/article/details/85058028
二、安裝部署
1、安裝部署 Elasticsearch 環境:
參考:
https://hunter.blog.csdn.net/article/details/89714709
2、修改配置文件
[root@node3 ~]# su es
[es@node3 ~]$ vim /opt/elasticsearch/elasticsearch-7.4.0/config/elasticsearch.yml
寫入以下內容
http.cors.enabled: true
http.cors.allow-origin: "*"
3、安裝 nodejs 環境
[root@node3 ~]# yum install epel-release git vim net-tool -y
[root@node3 ~]# yum install nodejs npm -y
4、下載 elasticsearch-head 源碼
創建目錄
[root@node3 ~]# mkdir /opt/eshead
進入目錄
[root@node3 ~]# cd /opt/eshead/
下載源碼
[root@node3 eshead]# git clone https://github.com/mobz/elasticsearch-head.git
5、查看源碼目錄
6、使用 npm 安裝
[root@node3 ~]# cd /opt/eshead/elasticsearch-head
[root@node3 elasticsearch-head]# npm install
注意:如果 npm 安裝速度太慢,可採用國內鏡像
安裝淘寶 npm 鏡像請參考:
https://blog.csdn.net/llwy1428/article/details/90139929
7、控制檯啓動項目
[root@node3 elasticsearch-head]# npm run start
可看到如下效果,說明安裝成功,但此時還不能與已安裝好的 elasticsearch 集羣相連接,需要進一步配置
8、修改 elasticsearch-head 中的配置文件
[root@node3 elasticsearch-head]# vim Gruntfile.js
增加如下內容(如下圖)
hostname: '0.0.0.0',
[root@node3 elasticsearch-head]# vim _site/app.js
修改如下內容(如下圖)
this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.11.133:9200";
9、重新啓動項目(控制檯啓動)
[root@node3 elasticsearch-head]# ./node_modules/grunt/bin/grunt server
啓動效果如下圖(連接成功,集羣健康值:green):
10、後臺守護啓動
[root@node3 elasticsearch-head]# ./node_modules/grunt/bin/grunt server &
11、查看啓動狀態
[root@node3 ~]# netstat -lntp
12、關閉服務
[root@node3 ~]# kill -9 8443(PID)
至此 Centos7 安裝 Elasticsearch-head 操作完畢!