-
Notifications
You must be signed in to change notification settings - Fork 0
ElasticSearch第三篇 head插件
yangyp8110 edited this page Jan 17, 2018
·
2 revisions
github地址:https://github.com/mobz/elasticsearch-head
在使用Elasticsearch的过程中,前面都是通过rest请求来操作,太过麻烦,而且也不便于管理, head可以完美的帮助你快速使用es。
elasticsearch-head:是集群管理工具、数据可视化、增删改查工具, 可以让Elasticsearch语句可视化。
github官方解释:A web front end for an Elasticsearch cluster
安装方式有两种,一种是使用命令安装(推荐),一种是下载包安装。
- 使用npm命令前,先安装nodejs : Nodejs安装
[esuser@yyp ~]$ mv elasticsearch-head-master install/
[esuser@yyp ~]$ cd install/
[esuser@yyp install]$ ll
total 8
drwxr-xr-x. 9 esuser esuser 4096 Feb 18 10:20 elasticsearch
drwxrwxr-x. 5 esuser esuser 4096 Feb 5 22:02 elasticsearch-head-master
[esuser@yyp install]$
[esuser@yyp install]$ npm install
npm install 执行速度太慢,使用国内镜像:
[esuser@yyp elasticsearch-head-master]$ npm install -g cnpm --registry=https://registry.npm.taobao.org
……
npm ERR! Error: EACCES: permission denied, access '/usr/local/usr/local/install/nodejs/lib/node_modules'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, access '/usr/local/usr/local/install/nodejs/lib/node_modules'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/usr/local/install/nodejs/lib/node_modules' }
……
切换到root用户:
[root@yyp ~]# cd /home/esuser/install/elasticsearch-head-master
[root@yyp elasticsearch-head-master]# npm install -g cnpm --registry=https://registry.npm.taobao.org
编辑elasticsearch/config/elasticsearch.yml
[root@yyp config]# cd /home/esuser/install/elasticsearch/config
[root@yyp config]# vi elasticsearch.yml
末尾加入以下内容:
http.cors.enabled: true
http.cors.allow-origin: "*"
打开elasticsearch-head-master/Gruntfile.js
,找到下面connect属性,新增hostname: '0.0.0.0':
[root@yyp elasticsearch-head-master]# vi Gruntfile.js
新增的hostname:
……
connect: {
server: {
options: {
hostname: '0.0.0.0',
port: 9100,
base: '.',
keepalive: true
}
}
}
……
在elasticsearch-head-master/
目录下,运行启动命令grunt server
:
[root@yyp elasticsearch-head-master]# grunt server
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100
出现上面结果,说明安装Elasticsearch-head成功,浏览器访问:http://192.168.74.129:9100 ,并在Elasticsearch-head地址栏输入Elasticsearch地址:http://192.168.74.129:9200
(前面安装的地址)
后台启动grunt server命令;
[root@yyp elasticsearch-head-master]# nohup grunt server &exit
[2] 93677
logout
There are stopped jobs.
[root@yyp elasticsearch-head-master]# nohup: ignoring input and appending output to ‘nohup.out’
如果想关闭head插件,使用linux查找进程命令:
[root@yyp elasticsearch-head-master]# ps aux|grep head
``
结束进程:
kill 进程号
[esuser@yyp elasticsearch-head-master]# cd /home/esuser/install/elasticsearch/config/
[esuser@yyp config]# vi elasticsearch.yml
更改如下参数:
cluster.name: yyp-cluster
node.name: node-1
重新启动Elasticsearch: