上一节我们已经安装好了Elasticsearch,接下来我们来安装head插件,由于elasticsearch-head插件是由nodejs语言编写,所以安装elasticsearch-head前需要先安装nodejs和grunt。
首先,执行以下命令安装nodejs和grunt
[sqczm@sqczm opt]$ tar -xvf node-v10.15.3-linux-x64.tar.xz
[sqczm@sqczm node-v10.15.3-linux-x64]$ vi ~/.bash_profile
NODE_HOME=/opt/node-v10.15.3-linux-x64
PATH=$NODE_HOME/bin:$PATH:
[sqczm@sqczm opt]$ source ~/.bash_profile
[sqczm@sqczm opt]$ node -v
v10.15.3
[sqczm@sqczm opt]$ npm install -g grunt-cli
[sqczm@sqczm opt]$ grunt --version
grunt-cli v1.3.2
接下来,我们来安装elasticsearch-head插件
[sqczm@sqczm opt]$ git clone git://github.com/mobz/elasticsearch-head.git
[sqczm@sqczm opt]$ cd elasticsearch-head/
[sqczm@sqczm elasticsearch-head]$ npm install
[sqczm@sqczm elasticsearch-head]$ npm run start
> elasticsearch-head@0.0.0 start /opt/elasticsearch-head
> grunt server
Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100
一切安装完毕后,我们打开浏览器来看一下运行结果,在浏览器输入以下地址
http://localhost:9100
嗯哼?为什么集群健康值为“未连接”?看到下面这个网址中有问题解决方案
https://blog.csdn.net/fst438060684/article/details/80936201
按照上面博客中的说明,添加文中所说的两个参数,添加后的参数信息如下所示
[sqczm@sqczm elasticsearch-6.7.1]$ grep '^[a-z]' config/elasticsearch.yml
cluster.name: esCluster
path.data: /opt/elasticsearch-6.7.1/datas
path.logs: /opt/elasticsearch-6.7.1/logs
bootstrap.memory_lock: true
http.port: 9200
http.cors.enabled: true
http.cors.allow-origin: "*"
修改完后,我们重启elasticsearch,继续刷新下页面,我们就看到了如下界面
至此,我们的elasticsearch-head插件安装完成。