Elasticsearch 5.6.5 安装教程 的续篇

 head安装包,下载地址:https://github.com/mobz/elasticsearch-head/archive/master.zip

 head 插件不能放在elasticsearch-5.6.5文件夹里,head 插件需要单独放,单独去执行;所以在elasticsearch-5.6.5同级目录下解压了 head 插件。

1.如果没有zip/unzip命令,先安装。

yum install -y unzip zip

Elasticsearch 5.6.5 安装head插件

 

2.解压

[[email protected] programs]# unzip elasticsearch-head-master.zip

 Elasticsearch 5.6.5 安装head插件

 解压后

Elasticsearch 5.6.5 安装head插件

 

3.安装 node.js

执行head插件,需要node.js 的支持。

[[email protected] programs]# curl --silent --location https://rpm.nodesource.com/setup | bash -

  [[email protected] programs]# yum install -y nodejs

 OK,执行完成后,可以使用命令 node -v 验证是否安装成功,同时npm 也安装成功了;执行命令 npm -v 也是可以验证的。

[[email protected] programs]# node -v
v0.10.46
[root@localhost programs]# npm -v
2.15.1

 

4.安装grunt

由于head 插件的执行文件是有grunt 命令来执行的,所以这个命令必须安装。 

[[email protected] programs]# npm install grunt --save-dev
[[email protected] programs]# cd elasticsearch-head-master
[[email protected] elasticsearch-head-master]# npm install

 
 5.修改配置文件
 进入elasticsearch-head-master 文件夹下,执行命令vi Gruntfile.js文件:增加hostname属性,设置为*。
Elasticsearch 5.6.5 安装head插件
 
 
 6.修改启动端口,默认是9100,修改防火墙打开端口。
 
 7.此时启动elasticsearch
[[email protected] bin]# cd /usr/local/programs/elasticsearch-head-master/node_modules/grunt/bin

[root@localhost bin]# ./grunt server &

Elasticsearch 5.6.5 安装head插件

 
8. 浏览器访问 http://ip地址:9100/访问 UI能展示,但是不正常。
Elasticsearch 5.6.5 安装head插件
 
 如果出现上图中现实的  集群健康值: 未连接的状态,是因为没有配置ElasticSearch的跨域访问,默认是禁止的,所以链接失败。
 
解决方案:需要修改elasticsearch配置文件;命令进入到elasticsearch-5.6.5 /config 文件中 vi elasticsearch.yml,添加
       http.cors.enabled: true
       http.cors.allow-origin: "*"

如图:

Elasticsearch 5.6.5 安装head插件

保存成功后重启elasticsearch和head插件,然后重新访问可视化界面。
 
 Elasticsearch 5.6.5 安装head插件

相关文章:

  • 2021-12-12
  • 2021-12-16
  • 2021-06-22
  • 2021-06-23
  • 2021-08-12
  • 2021-06-06
猜你喜欢
  • 2021-12-07
  • 2021-11-22
  • 2021-11-22
  • 2021-11-22
  • 2021-06-17
相关资源
相似解决方案