1. 简介
elasticsearch-head是一个界面化的集群操作和管理工具,可以对集群进行傻瓜式操作。你可以通过插件把它集成到es(首选方式),也可以安装成一个独立webapp。
对于初学者这个工具非常友好,提供了界面管理索引。
官方网站:https://github.com/mobz/elasticsearch-head
2.安装前准备
2.1 安装npm工具
下载地址:https://nodejs.org/en/download/ 下载是xz格式的包,系统没有这个工具自己用yum下载。根据自己系统安装:
[root@master ~]# wget https://nodejs.org/dist/v8.9.0/node-v8.9.0-linux-x64.tar.xz --这里是xz [root@master opt]# mv node-v8.9.0-linux-x64.tar /opt [root@master opt]# tar -xvf node-v8.9.0-linux-x64.tar
创建软连接:
[root@master opt]# ln -s /opt/node-v8.9.0-linux-x64/bin/node /usr/local/bin/node --绝对路径 [root@master opt]# ln -s /opt/node-v8.9.0-linux-x64/bin/npm /usr/local/bin/npm
验证:
[root@master bin]# node -v v8.9.0 [root@master bin]# npm config set registry https://registry.npm.taobao.org 修改镜像 [root@master ~]# npm config get registry https://registry.npm.taobao.org/
[root@master bin]# su - elk [elk@master ~]$ cd elasticsearch-head/ [elk@master elasticsearch-head]$ npm install 这个步骤执行非常慢,可能是上面镜像没有换成功,这里需要phantomjs-2.1.1-linux-x86_64.tar.bz2,可以直接下载,存放到/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2 ,再执行npm notice created a lockfile as package-lock.json. You should commit this file. npm WARN [email protected] license should be a valid SPDX license expression npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
[elk@master elasticsearch-head]$ npm run start > [email protected] start /home/elk/elasticsearch-head > grunt server (node:3758) ExperimentalWarning: The http2 module is an experimental API. Running "connect:server" (connect) task Waiting forever... Started connect web server on http://localhost:9100
5.访问head
http://192.168.1.132:9100(elastict 需要设置跨域才能用另外机器访问):
跨域设置:添加最后两个参数
[elk@master config]$ pwd /home/elk/elasticsearch-5.4.0/config [elk@master config]$ vi elasticsearch.yml ...... http.cors.enabled: true http.cors.allow-origin: /.*/