Elasticsearch 7.17.10 双节点集群部署(二):安装 elasticsearch-head 插件实现可视化

一、elk典型架构部署-安装elasticsearch-head 安装elasticsearch-head插件

复制代码
curl http://192.168.92.14:9200/_cat/nodes?pretty
curl http://192.168.92.14:9200/_cluster/health?pretty
[root@es01 ~]# curl http://192.168.92.14:9200/_cluster/health?pretty
{
  "cluster_name" : "es-cluster",   #集群名称
  "status" : "green",  #集群健康状态
  "timed_out" : false,   #检测集群是否超时
  "number_of_nodes" : 2,  #集群节点总数
  "number_of_data_nodes" : 2,    #集群中能存放数据的数据节点的数量
  "active_primary_shards" : 3,   #活跃主分片数量
  "active_shards" : 6,    #所有的活跃的分片数量
  "relocating_shards" : 0,   #正在迁移的分片数量
  "initializing_shards" : 0,     #正在初始化的分片数量
  "unassigned_shards" : 0,   #没有被分配的分片数量
  "delayed_unassigned_shards" : 0,     #由于延迟策略而暂未分配的分片
  "number_of_pending_tasks" : 0,
  "number_of_in_flight_fetch" : 0,
  "task_max_waiting_in_queue_millis" : 0,
  "active_shards_percent_as_number" : 100.0
}
[root@es01 ~]#

上述查看集群的方式,及其不方便,我们可以通过安装elasticsearch-head插件后,来查看管理集群。

(1)修改ES配置文件(建议es01,es02都配置)

修改主配置文件(添加elasticsearch-head调试支持)

复制代码
vi /etc/elasticsearch/elasticsearch.yml
#追加到文件末尾
http.cors.enabled: true   #开启跨域访问支持
http.cors.allow-origin: "*"  #跨域访问允许的域名地址

systemctl restart elasticsearch

(2)安装elasticsearch-head插件(这里只需要修改es01主节点)

插件下载地址:https://github.com/mobz/elasticsearch-head

安装epel源

复制代码
yum install epel-release -y

首先安装依赖包

复制代码
yum install git nodejs openssl-devel npm -y

克隆elasticsearch-head项目(有时下载不下来,多试几次)

注意:长时间拉取失败,可检查自身网络、防火墙;都没问题还是拉取失败可以去下载区拉取资料

复制代码
cd /etc/elasticsearch/
git clone https://github.com/mobz/elasticsearch-head.git
cd elasticsearch-head
npm install phantomjs-prebuilt --ignore-scripts
npm install

注意:在执行npm语句时会出现下列警告信息,忽视即可

这里是一个非常缓慢的过程。而且会有一些警告信息,不用管

复制代码
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'http2@3.3.7',
npm WARN EBADENGINE   required: { node: '>=0.12.0 <9.0.0' },
npm WARN EBADENGINE   current: { node: 'v16.20.2', npm: '8.19.4' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'karma@1.3.0',
npm WARN EBADENGINE   required: { node: '0.10 || 0.12 || 4 || 5 || 6' },
npm WARN EBADENGINE   current: { node: 'v16.20.2', npm: '8.19.4' }
npm WARN EBADENGINE }

up to date, audited 537 packages in 3s

28 packages are looking for funding
  run `npm fund` for details

52 vulnerabilities (1 low, 13 moderate, 26 high, 12 critical)

To address issues that do not require attention, run:
  npm audit fix

To address all issues possible (including breaking changes), run:
  npm audit fix --force

Some issues need review, and may require choosing
a different dependency.

Run `npm audit` for details.

启动elasticsearch-head服务

复制代码
cd elasticsearch-head/
npm run start &

说明:Ctrl+a Ctrl+d将进程放置到后台 查看端口只要9100被监听,说明启动成功。

复制代码
[root@es01 elasticsearch-head]# netstat -anpt | grep 9100
tcp        0      0 0.0.0.0:9100            0.0.0.0:*               LISTEN      16946/grunt
相关推荐
滴图服务-七七1 小时前
滴滴地图:精准定位赋能企业数字化转型
大数据·人工智能·地图服务·甲级测绘资质·商业授权
kebidaixu2 小时前
BCU 平台 RS485 驱动适配:从 THVD1406 到 ISO3082
linux
谢平康5 小时前
解决用 rm 报bash: /usr/bin/rm: Argument list too long错
linux·运维·运维开发
科技互联.6 小时前
破解数据治理效率瓶颈:2026年Data Agent驱动的数据中台能力横向测评
大数据
hj2862517 小时前
Linux 网络服务综合笔记(概念 + 命令 + 实操案例)2
linux·运维·网络
what_20187 小时前
Linux 磁盘 (查看、划分、inode)
linux·运维·服务器
DataX_ruby827 小时前
2026年数据中台厂商市场份额分析
大数据·人工智能·数据治理·数据中台
2739920297 小时前
GDB调试(Linux)
linux
汉知宝科技7 小时前
跨境电商品牌合规:出海企业商标管理的特殊挑战与数字化应对
大数据·人工智能
凡人叶枫7 小时前
Effective C++ 条款23:宁以 non-member、non-friend 替换 member 函数
linux·开发语言·c++·嵌入式开发