本文接上一篇《centos7.4使用zip包安装Elasticsearch6.5.0》继续向下记录安装elasticsearch-head的过程。
1、下载elasticsearch-head包
>>>git下载:
1 |
[es@imzcy ~]$ git clone https://github.com/mobz/elasticsearch-head.git |
>>>zip包下载:
1 |
[es@imzcy ~]$ wget https://codeload.github.com/mobz/elasticsearch-head/zip/master |
2、安装依赖包
1 2 |
[root@imzcy ~]# yum -y install epel-release bzip2 [root@imzcy ~]# yum -y install npm |
3、解压并安装elasticsearch-head
1 2 3 4 5 6 7 |
[es@imzcy ~]$ unzip master [es@imzcy ~]$ mv elasticsearch-head-master/ es-head [es@imzcy ~]$ cd es-head/ [es@imzcy es-head]$ npm install [es@imzcy es-head]$ echo $? 0 [es@imzcy es-head]$ |
4、配置文件修改
4.1 修改es-head中app.js配置文件定义的默认连接es地址
1 2 3 4 5 6 7 |
[es@imzcy es-head]$ vi _site/app.js 4354 this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://localhost:9200"; 修改为: 4354 this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.8.14:9200"; [es@imzcy es-head]$ |
4.2、编辑es配置文件elasticsearch.yml,在末尾新增如下两行配置
>>>如果不作为elasticsearch的插件运行(甚至不能从版本5运行),则必须在elasticsearch中启用CORS,否则您的浏览器将拒绝看似不安全的请求。
>>>您还必须设置 http.cors.allow-origin因为默认情况下不允许原点。http.cors.allow-origin: "*"是有效值,但它被视为安全风险,因为您的群集可以从任何地方开放交叉。
1 2 3 4 5 |
[es@imzcy ~]$ cd elasticsearch/config/ [es@imzcy config]$ vi elasticsearch.yml http.cors.enabled: true http.cors.allow-origin: "*" [es@imzcy config]$ |
5、重新启动elasticsearch及启动elasticsearch-head
5.1 启动elasticsearch
1 2 |
[es@imzcy ~]$ cd elasticsearch/ [es@imzcy elasticsearch]$ ./bin/elasticsearch |
5.2 启动elasticsearch-head
1 2 |
[es@imzcy ~]$ cd es-head/ [es@imzcy es-head]$ npm run start |
6、使用浏览器访问elasticsearch-head
1 |
http://192.168.8.14:9100/ |
安装方法参考github项目地址说明文档:
1 |
https://github.com/mobz/elasticsearch-head/ |