准备工作
- 安装Node.js,查看博客:CentOS7 在线安装 Node.js | LeDao 的博客 (zoutl.cn)
- 安装Git,查看博客:CentOS7 安装 Git 的最新版本 | LeDao 的博客 (zoutl.cn)
安装
输入以下命令即可完成克隆、安装、启动(安装使用cnpm命令而不是使用npm命令,不然可能会报错)
#克隆
git clone git://github.com/mobz/elasticsearch-head.git
#进入插件目录
cd elasticsearch-head
#安装
cnpm install
#启动,用cnpm命令也可以
npm run start
配置Elasticsearch
需要配置一下,才允许head插件访问Elasticsearch,打开Elasticsearch的conf目录的elasticsearch.yml,然后在最下面加上以下代码:
http.cors.enabled: true
http.cors.allow-origin: "*"
使用
重启Elasticsearch,再启动head插件,在浏览器地址栏输入:http://虚拟机IP:9100
,而插件连接的地址为:http://虚拟机IP:9200