elasticsearch-head安装及启动

作者: siediyer 分类: linux 发布时间: 2021-10-19 15:56

head是用于监控Elasticsearch状态的客户端插件,包括数据可视化,增删改查工具,es语句的可视化等等。

5.0之后的安装方式如下:

git clone git://github.com/mobz/elasticsearch-head.git
 
cd elasticsearch-head 
npm install
npm install -g grunt-cli
yum install nodejs
grunt server &
Open http://localhost:9100

注:1.head插件监听的是9100端口 2.安装前要完成nodejs, grunt的安装

启动方式:

使用npm方式启动,在head插件目录中执行

grunt server  &

ps aux|grep head
结束进程:
kill 进程号

# 启动
$ cd elasticsearch-head
$ nohup npm run start & # 后端运行

# 停止
$ netstat -anp |grep 9100 # 通过端口查找pid
$ ps -ef | head -1;ps -ef | grep grunt #通过名称查找pid,(elasticsearch-head启动的是grunt server)
$ kill 87523 # 杀死查找到的pid(进程id)

如果前面安装没错,那么此时可以打开页面http://IP:9100

配置elasticsearch

vi /etc/elasticsearch/elasticsearch.yml

并添加以下参数,使elasticsearch-head可以连接elasticsearch

network.host: 0.0.0.0
http.cors.enabled: true
http.cors.allow-origin: "*"

systemctl restart elasticsearch
netstat -plntu

npm install 报错 code ELIFECYCLE 解决方法

进入项目工作目录,删除 node_modules
命令:rm -rf node_modules
删除 package - lock.json
命令:rm -rf package-lock.json
清除 npm 缓存
命令:npm cache clear --force
重新下载依赖
命令:npm install

这里我们再介绍一个插件kopf

[root@promote elasticsearch]# /usr/share/elasticsearch/bin/plugin install lmenezes/elasticsearch-kopf
-> Installing lmenezes/elasticsearch-kopf...
Trying https://github.com/lmenezes/elasticsearch-kopf/archive/master.zip ...
....省略
Verifying https://github.com/lmenezes/elasticsearch-kopf/archive/master.zip checksums if available ...
NOTE: Unable to verify checksum for downloaded plugin (unable to find .sha1 or .md5 file to verify)
Installed kopf into /usr/share/elasticsearch/plugins/kopf

安装完后我们访问http://192.168.58.147:9200/_plugin/kopf

 

如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!

Title - Artist
0:00