概述
elasticsearch-head是一个界面化的集群操作和管理工具,使用JavaScript开发,依赖Node.js库,使用Grunt工具构建,所以需要先安装Node.js
服务器信息:
- OS: CentOS 7
- IP: 192.168.91.128
安装nodejs
官网: https://nodejs.org/en/download/
这里我们选择使用二进制安装包
[root@localhost ~]# wget https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x64.tar.xz --2019-04-18 07:42:13-- https://nodejs.org/dist/v10.15.3/node-v10.15.3-linux-x64.tar.xz Resolving nodejs.org (nodejs.org)... 104.20.22.46, 104.20.23.46, 2606:4700:10::6814:172e, ... Connecting to nodejs.org (nodejs.org)|104.20.22.46|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 12309200 (12M) [application/x-xz] Saving to: ‘node-v10.15.3-linux-x64.tar.xz’ 100%[========================================================================================================================================>] 12,309,200 110KB/s in 3m 0s 2019-04-18 07:45:18 (66.9 KB/s) - ‘node-v10.15.3-linux-x64.tar.xz’ saved [12309200/12309200] # 解压 [root@localhost ~]# tar xf node-v10.15.3-linux-x64.tar.xz # 为了方便,重命名 [root@localhost ~]# mv node-v10.15.3-linux-x64 nodejs # 软连接 [root@localhost bin]# ln -s /root/nodejs/bin/npm /usr/local/bin/ [root@localhost bin]# ln -s /root/nodejs/bin/node /usr/local/bin/ # 查看 node 和 npm的版本 [root@localhost ~]# node -v v10.15.3 [root@localhost ~]# npm -v 6.4.1 [root@localhost ~]#
下载elasticsearch-head
Github地址: https://github.com/mobz/elasticsearch-head
# 下载 [root@localhost ~]# wget https://github.com/mobz/elasticsearch-head/archive/master.zip # 解压 [root@localhost ~]# unzip master.zip
es跨域配置
es 和 head 属于两个进程,前后端访问存在跨域问题,修改下es的配置文件
elasticsearch.yml中追加
http.cors.enabled: true http.cors.allow-origin: "*"
重启es 生效
启动 elasticsearch-head
# 进入目录 [root@localhost ~]# cd elasticsearch-head-master/ # install [root@localhost elasticsearch-head-master]# npm install npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN elasticsearch-head@0.0.0 license should be a valid SPDX license expression audited 1751 packages in 17.269s found 34 vulnerabilities (19 low, 8 moderate, 7 high) run `npm audit fix` to fix them, or `npm audit` for details # 启动 [root@localhost elasticsearch-head-master]# npm run start > elasticsearch-head@0.0.0 start /root/elasticsearch-head-master > grunt server Running "connect:server" (connect) task Waiting forever... Started connect web server on http://localhost:910
访问 head
访问 http://192.168.91.128:9100/
修改下Es的地址