2.1 Head插件简介
ElasticSearch-head是一个H5编写的ElasticSearch集群操作和管理工具,可以对集群进行傻瓜式操作。
- 显示集群的拓扑,并且能够执行索引和节点级别操作
- 搜索接口能够查询集群中原始json或表格格式的检索数据
- 能够快速访问并显示集群的状态
- 有一个输入窗口,允许任意调用RESTful API。这个接口包含几个选项,可以组合在一起以产生有趣的结果;
- 5.0版本之前可以通过plugin名安装,5.0之后可以独立运行。
2.2 Head插件安装
(1)安装NodeJS
代码语言:javascript复制[root@node1 ~]# yum install -y nodejs
(2)按钮npm
代码语言:javascript复制[root@node1 ~]# npm install -g cnpm --registry=https://registry.npm.taobao.org
(3)使用npm安装grunt
代码语言:javascript复制[root@node1 ~]# npm install -g grunt-cli --registry=https://registry.npm.taobao.org --no-proxy
/usr/bin/grunt -> /usr/lib/node_modules/grunt-cli/bin/grunt
/usr/lib
└─┬ grunt-cli@1.2.0
├─┬ findup-sync@0.3.0
│ └─┬ glob@5.0.15
│ ├─┬ inflight@1.0.6
│ │ └── wrappy@1.0.2
│ ├── inherits@2.0.3
│ ├─┬ minimatch@3.0.4
│ │ └─┬ brace-expansion@1.1.8
│ │ ├── balanced-match@1.0.0
│ │ └── concat-map@0.0.1
│ ├── once@1.4.0
│ └── path-is-absolute@1.0.1
├── grunt-known-options@1.1.0
├─┬ nopt@3.0.6
│ └── abbrev@1.1.1
└── resolve@1.1.7
[root@node1 ~]#
(4)下载head插件源码
代码语言:javascript复制[es@node1 ~]$ wget https://github.com/mobz/elasticsearch-head/archive/master.zip
--2017-12-18 09:58:08-- https://github.com/mobz/elasticsearch-head/archive/master.zip
Resolving github.com (github.com)... 192.30.255.113, 192.30.255.112
Connecting to github.com (github.com)|192.30.255.113|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: https://codeload.github.com/mobz/elasticsearch-head/zip/master [following]
--2017-12-18 09:58:09-- https://codeload.github.com/mobz/elasticsearch-head/zip/master
Resolving codeload.github.com (codeload.github.com)... 192.30.255.120, 192.30.255.121
Connecting to codeload.github.com (codeload.github.com)|192.30.255.120|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 921421 (900K) [application/zip]
Saving to: ‘master.zip’
100%[===============================================================>] 921,421 9.64KB/s in 67s
2017-12-18 09:59:18 (13.4 KB/s) - ‘master.zip’ saved [921421/921421]
[es@node1 ~]$ ls
master.zip
[es@node1 ~]$ unzip master.zip
(5)下载依赖
代码语言:javascript复制[es@node1 elasticsearch-head-master]$ su root
Password:
[root@node1 elasticsearch-head-master]# npm install -g cnpm --registry=https://registry.npm.taobao.org
/usr/bin/cnpm -> /usr/lib/node_modules/cnpm/bin/cnpm
/usr/lib
└── cnpm@5.1.1
[root@node1 elasticsearch-head-master]#
(6)配置 ElasticSearch,使得HTTP对外提供服务
代码语言:javascript复制[es@node1 elasticsearch-6.1.0]$ vi config/elasticsearch.yml
添加如下内容
代码语言:javascript复制# 增加新的参数,这样head插件可以访问es。设置参数的时候:后面要有空格
http.cors.enabled: true
http.cors.allow-origin: "*"
(7)运行 grunt server
(8)访问9100端口