ElasticSearch-head安装配置教程

安装ElasticSearch图形管理界面ElasticSearch-head

《elasticsearch-head》Github地址

安装之前做一些准备工作,将itcats用户切换到root用户

su
echo "itcats ALL = (root) NOPASSWD:ALL" | tee /etc/sudoers.d/itcats

返回:  itcats ALL = (root) NOPASSWD:ALL

chmod 0440 /etc/sudoers.d/itcats

解决sudo: sorry, you must have a tty to run sudo问题,在/etc/sudoer注释掉 Default requiretty 一行

sudo sed -i 's/Defaults requiretty/Defaults:itcats !requiretty/' /etc/sudoers

更新依赖

sudo yum update -y

更新epel扩展源 

sudo rpm -ivh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo rpm -ivh https://kojipkgs.fedoraproject.org//packages/http-parser/2.7.1/3.el7/x86_64/http-parser-2.7.1-3.el7.x86_64.rpm

安装npm

sudo yum install npm

安装git 

sudo yum install -y git

安装bzip2

sudo yum install -y bzip2

下载es-head

git clone git://github.com/mobz/elasticsearch-head.git

将源码包下载后剪切到/usr/local/目录下,并改所属用户和组

sudo chown -R itcats:itcats /usr/local/elasticsearch-head

#进入到elasticsearch-head中

cd elasticsearch-head

编译安装

npm install

打开elasticsearch-head-master/Gruntfile.js,找到下面connect属性,新增hostname: '0.0.0.0',也可以改为本机ip

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

编辑elasticsearch-5.4.3/config/elasticsearch.yml,加入以下内容:【告知插件可以连接到ES】

http.cors.enabled: true
http.cors.allow-origin: "*"

运行服务【先执行ES,后执行ES-head】  plus ES 执行命令: /usr/local/elasticsearch-5.4.3/bin/elasticsearch -d

npm run start

如果显示如下则成功:

> [email protected] start /usr/local/elasticsearch-head
> grunt server

Running "connect:server" (connect) task
Waiting forever...
Started connect web server on http://localhost:9100

访问http://hdp-01:9100

发现健康值未连接,只需要修改localhost为hdp-01即可,读者修改为对应ip即可,点击连接

查看到只有node-1为星形,说明node-1为master。

发布了162 篇原创文章 · 获赞 237 · 访问量 26万+

猜你喜欢

转载自blog.csdn.net/itcats_cn/article/details/89606146