Centos7 安装 elasticsearch-head插件

上车

Head是elasticsearch的集群管理工具,可以用于数据的浏览和查询。
elasticsearch-head是一款开源软件,被托管在github上面,所以如果我们要使用它,必须先安装git,通过git获取elasticsearch-head
运行elasticsearch-head会用到grunt,而grunt需要npm包管理器,所以nodejs是必须要安装的。

发车

git 拉下来

elasticsearch 5.0 之后,elasticsearch-head不做为插件放在其plugins目录下。使用git拷贝elasticsearch-head到本地

cd /wwwroot/soft/es-plugins
git clone git://github.com/mobz/elasticsearch-head.git

安装nodejs

去nodejs 官网下载最新的

解压:tar xvf node-v12.13.0-linux-x64.tar.xz

做2个软连接:
ln -s /wwwroot/soft/node-v12.13.0-linux-x64/bin/node /usr/bin/node
ln -s /wwwroot/soft/node-v12.13.0-linux-x64/bin/npm /usr/bin/npm

安装 grunt

npm install -g grunt-cli

安装 elasticsearch-head 依赖的包

cd elasticsearch-head
npm install

报错:Error: Command failed: tar jxf /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2tar (child): bzip2:无法 exec: 没有那个文件或目录

解决: yum -y install bzip2.x86_64

报错:Error: EACCES: permission denied, link '/tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1571667960384/phantomjs-2.1.1-linux-x86_64' -> '/wwwroot/soft/es-plugins/elasticsearch-head/node_modules/phantomjs-prebuilt/lib/phantom'

我大root居然有权限问题! 搜了下 github上说要加--unsafe-perm
rm -rf node_modules/ npm install --unsafe-perm
安装成功!

head修改配置

修改hostname

修改 Gruntfile.js 在connect-->server-->options下面添加:hostname:' ** ,允许所有IP可以访问

修改默认连接地址

修改elasticsearch-head默认连接地址,改成你自己的es地址

cd /wwwroot/soft/es-plugins/elasticsearch-head/_site
vim app.js
将4374行 this.base_uri = this.config.base_uri || this.prefs.get("app-base_uri") || "http://10.180.18.38:9201"; 
修改es

想在界面上看到es集群信息,必须在elasticsearch.yml增加两项配置,重启es
打开elasticsearch 的配置文件 elasticsearch.yml 在末尾加上:

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

到站

启动es

启动 elasticsearch-head nohup ./node_modules/grunt/bin/grunt server &

然后打开浏览器访问:

 

猜你喜欢

转载自www.cnblogs.com/gwyy/p/12205253.html
今日推荐