提前关闭防火墙
Head是elasticsearch的集群管理工具,可以用于数据的浏览查询
1、ElasticSearch-head是一款开源软件,被托管在github上面,所以如果我们要使用它,必须先安装git,通过git获取ElasticSearch-head
安装git:
2、运行ElasticSearch-head会用到grunt,而grunt需要npm包管理器,所以nodejs是必须要安装的
3、elasticsearch5.0之后,elasticsearch-head不作为插件放在其plugins目录下,使用git拷贝elasticsearch-head到本地
[root@hadoop01 ~]# cd /usr/local
[root@hadoop01 local]# git clone git://github.com/mobz/elasticsearch-head.git
4、安装elasticsearch-head依赖包
[root@hadoop01 local]# npm install -g grunt-cli
[root@hadoop01 ~]#cd /usr/local/elasticsearch-head
[root@hadoop01 elasticsearch-head]# cnpm install
5、修改Gruntfile.js
[root@hadoop01 ~]# cd /usr/local/elasticsearch-head
[root@hadoop01 elasticsearch-head]# vi Gruntfile.js
在connect server options下面添加:hostname : * ,允许所有Ip访问
6、修改elasticsearch-head默认链接地址
cd /usr/local/elasticsearch-head/_site/
vi app.js
将this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";中localhost的修改为本服务器的Ip地址
7、配置elasticsearch允许跨域访问
打开elasticsearch的配置文件elasticsearch.yml,在文件末尾追加下面两行代码即可:
http.cors.enables: true
http.cors.allow-origin: "*"
8、先启动elasticsearch,再启动elasticsearch-head
/usr/local/elasticsearch-head/node_modules/grunt/bin
[root@hadoop01 bin]# ./grunt server
9、浏览器输入网址访问
http://192.168.123.101:9100/