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
相关推荐
大大大大晴天6 小时前
每天认识一个组件:数据治理Apache Atlas
大数据
数字新视界7 小时前
2026模块化机房选型指南:行业市场发展趋势、占有率与竞争梯队分析报告解析
大数据·人工智能·物联网·数据中心·微模块机房·模块化机房·冷通道
Johny_Zhao8 小时前
网络安全等级保护测评实施方案
linux·网络·人工智能·网络安全·信息安全·云计算·等保测评·系统运维·itsm
落羽的落羽9 小时前
【AI】快速理解AI应用的相关名词概念
linux·c++·人工智能·python·计算机网络·算法
刚入门的大一新生9 小时前
Linux-进程控制
linux·运维·服务器·c++
姜穆澜9 小时前
OneID 从 0 到 1 完整生产案例(四)
大数据
上火的金鱼妹9 小时前
K8S基础组件作用和关系整理
linux·运维·服务器·kubernetes
Vcaker9 小时前
Linux学习25-harbor私有仓库部署
linux·运维·学习
OsDepK9 小时前
项目快速Git至仓库(完整版)
大数据·git·elasticsearch·搜索引擎
刃神太酷啦9 小时前
Redis 进阶核心:持久化 (RDB/AOF)、事务与主从复制全解析----《Hello Redis!》(5)
linux·c语言·数据库·c++·redis·缓存·bootstrap