当前位置: 首页 > 未分类>阅读正文

es监控与自动重启

2022.8.11 朱丰华 134 次 留下评论 921字

1.安装supervisor进程管理器:

yum install epel-release
yum install -y supervisor

2.修改 supervisor配置

vim /etc/supervisord.conf

设置项目:

minfds=65536
minprocs=4096

3.添加守护进程(共添加3个文件、文件内容按实际适当修改)

添加文件1:/etc/supervisord.d/elasticsearch.ini ,内容:

[program:elasticsearch]

command=/etc/supervisord.d/elasticsearch.sh run

user=es

password=12345678

umask=002

autostart=true

autorestart=true

startsecs=8

startretries=3

redirect_stderr=true

stdout_logfile=/var/log/supervisor/elasticsearch.log

priority=100

添加文件2:/etc/supervisord.d/elasticsearch.sh ,内容:

#!/bin/sh

curl  -H “Content-Type: application/json” -X POST -d @/etc/supervisord.d/elasticMessage.json “https://oapi.dingtalk.com/robot/send?access_token=fewfefewgwefjdnbfhewifhefewfb”;/home/es/elasticsearch-8.2.0/bin/elasticsearch

添加文件3:/etc/supervisord.d/elasticMessage.json ,内容:

{“msgtype”:”text”,”text”:{“content”:”es服务崩溃啦,ElaSticSearch正在自动重新启动!”}}

4.启动supervisor

systemctl start supervisord # 启动supervisord服务

systemctl enable supervisord # 开机自启动

本篇完,还有疑问?留下评论吧

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注