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
相关推荐
小尔¥2 小时前
Linux系统安全
linux·运维·系统安全
奥地利落榜美术生灬2 小时前
红黑树(rbtree) & ksvstore引擎(引擎层应用)
linux
智能工业品检测-奇妙智能2 小时前
linux 安装 FFmpeg 和windows安装 FFmpeg
linux·windows·ffmpeg
那我掉的头发算什么2 小时前
【Linux】Linux基本使用和程序部署
linux·运维·服务器·数据库·spring·mybatis
Elastic 中国社区官方博客3 小时前
SearchClaw:将 Elasticsearch 通过可组合技能引入 OpenClaw
大数据·数据库·人工智能·elasticsearch·搜索引擎·ai·全文检索
weixin_505154464 小时前
博维数孪携手微软,打造智能电网数字化手册新标杆
大数据·人工智能·智慧城市·数字孪生·产品交互展示
咋吃都不胖lyh4 小时前
linux环境在vscode链接到一个git仓库,克隆和拉取详细命令行
linux·git·vscode
小小小米粒6 小时前
NAT 模式, 仅主机模式 Host-Only ,桥接模式 Bridge
linux·服务器·网络
T06205147 小时前
【数据集】“银发经济”百度搜索指数数据(2024.1.8-2026.3.8)
大数据