一定要安装bzip2包、一定要安装bzip2包、一定要安装bzip2包
1、下载head插件源码
cd /usr/local/src git clone https://github.com/mobz/elasticsearch-head.git cd elasticsearch-head
|-------|--------------------------------------------------------------------------------------------------| | 1 2 3 | cd /usr/local/src git clone https://github.com/mobz/elasticsearch-head.git cd elasticsearch-head |
2、安装npm(确保你配置了epel源)
yum install -y npm bzip2
|---|--------------------------| | 1 | yum install -y npm bzip2 |
3、使用npm安装grunt和grunt-cli
npm install -g grunt npm install -g grunt-cli #如果报错,可尝试npm i grunt-cli@1.3.0
|-----|------------------------------------------------------------------------------| | 1 2 | npm install -g grunt npm install -g grunt-cli #如果报错,可尝试npm i grunt-cli@1.3.0 |
4、在head插件目录执行install
cd /usr/local/src/elasticsearch-head npm install
|-----|--------------------------------------------------| | 1 2 | cd /usr/local/src/elasticsearch-head npm install |
5、启动
npm run start或grunt server
|---|----------------------------| | 1 | npm run start或grunt server |
如果前面安装没错,那么此时可以打开页面http://IP:9100
6、配置elasticsearch
vi /etc/elasticsearch/elasticsearch.yml
|---|-----------------------------------------| | 1 | vi /etc/elasticsearch/elasticsearch.yml |
设置
network.host: 0.0.0.0
|---|-----------------------| | 1 | network.host: 0.0.0.0 |
并添加以下参数,使elasticsearch-head可以连接elasticsearch
http.cors.enabled: true http.cors.allow-origin: "*"
|-----|------------------------------------------------------| | 1 2 | http.cors.enabled: true http.cors.allow-origin: "*" |
7、重启elasticsearch
/etc/init.d/elasticsearch restart
|---|-----------------------------------| | 1 | /etc/init.d/elasticsearch restart |
最后在http://IP:9100页面中输入http://IP:9200/连接,连接成功即表示配置成功