在Linux上安装Elasticsearch Head工具.md

2022-11-06,,,,

Linux安装Elasticsearch Head工具

1、修改elasticsearch的参数

编辑elasticsearch的配置文件elasticsearch.yml

$ vim /data/elasticsearch/elasticsearch-5.5.3/config/elasticsearch.yml

添加如下配置

# 增加新的参数,这样head插件可以访问es
http.cors.enabled: true
http.cors.allow-origin: "*"

重启elasticsearch服务

2、安装node 和 安装grunt

3、修改head源码

head下载地址https://github.com/mobz/elasticsearch-head

下载下来的安装包elasticsearch-head-master.zip,上传到/data/elasticsearch/目录

由于head的代码还是2.6版本的,直接执行有很多限制,比如无法跨机器访问。因此需要用户修改两个地方:

修改服务器监听地址

目录:head/Gruntfile.js

connect: {
server: {
options: {
port: 9100,
hostname: '*',
base: '.',
keepalive: true
}
}
}

增加hostname属性,设置为*

修改连接地址:

目录:head/_site/app.js

修改head的连接地址:

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200";

把localhost修改成你es的服务器地址,如:

this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://10.10.10.10:9200";

4、运行head

首先开启elasticsearch。

然后在head目录中,执行npm install下载以来的包:

cnpm install

最后,启动nodejs

grunt server

访问:http://192.168.1.124:9100/

这个时候,访问http://xxx:9100就可以访问head插件了. 

5、后台启动elasticsearch-head

后台启动grunt server命令;

nohup grunt server &exit
nohup grunt server &

如果想关闭head插件,使用Linux查找进程命令:

ps aux|grep head

结束进程:

kill进程号

参考

head官方文档 https://github.com/mobz/elasticsearch-head#running-with-built-in-server
http://www.cnblogs.com/xing901022/p/6030296.html
http://blog.csdn.net/hit0803107/article/details/54669909

5、权限

6、设置防火墙

7、开机启动

在Linux上安装Elasticsearch Head工具.md的相关教程结束。

《在Linux上安装Elasticsearch Head工具.md.doc》

下载本文的Word格式文档,以方便收藏与打印。