head 插件安装

head 插件是一个 elasticsearch 集群管理工具

1.yum源配置

[root@localhost ~]# cat /etc/yum.repos.d/khara-nodejs.repo 
[khara-nodejs]
name=Copr repo for nodejs owned by khara
baseurl=https://copr-be.cloud.fedoraproject.org/results/khara/nodejs/epel-7-$basearch/
type=rpm-md
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://copr-be.cloud.fedoraproject.org/results/khara/nodejs/pubkey.gpg
repo_gpgcheck=0
enabled=1
enabled_metadata=1

2.插件安装

[root@localhost ~]# yum -y install nodejs npm
[root@localhost opt]# wget https://codeload.github.com/mobz/elasticsearch-head/zip/master
[root@localhost ~]# cd /opt/elasticsearch-head-master/
[root@localhost elasticsearch-head-master]# npm install

3.elasticsearch 配置文件修改

[root@localhost ~]# vi /etc/elasticsearch/elasticsearch.yml
## 添加如下配置
http.cors.enabled: true
http.cors.allow-origin: "*"

4.插件配置文件修改

[root@localhost ~]# vi /opt/elasticsearch-head-master/Gruntfile.js 
## 添加 hostname: '*', 配置
   connect: {
                        server: {
                                options: {
                                        hostname: '*',
                                        port: 9100,
                                        base: '.',
                                        keepalive: true
                                }

[root@localhost ~]# vi /opt/elasticsearch-head-master/_site/app.js 
## 将下面配置中的:"http://192.168.1.22:9200",修改为本机ip
init: function(parent) {
                        this._super();
                        this.prefs = services.Preferences.instance();
                        this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://192.168.1.22:9200";

5. head服务启动

[root@localhost ~]# cd /opt/elasticsearch-head-master/node_modules/grunt/bin/
[root@localhost bin]# nohup ./grunt 2>&1 &

6.测试

浏览器访问:http://192.168.1.22:9100 测试

results matching ""

    No results matching ""