memcached找不到pid文件?CentOS 7指定memcache pid

CentOS 7 上需要为 memcached 配置 Monit监控程序时,遇到memcached找不到pid文件的问题……

memcached找不到pid文件?CentOS 7指定memcache pid

我们可以在谷歌搜索中,找到的所有配置都包含这一行:

check process memcached with pidfile /var/run/memcached/memcached.pid

但是,/var/run 中没有 memcached.pid 文件,也没有 /var/run/memcached 文件夹。

检查了 /usr/lib/systemd/system/memcached.service

[Service]
Type=simple
EnvironmentFile=-/etc/sysconfig/memcached
ExecStart=/usr/bin/memcached -u $USER -p $PORT -m $CACHESIZE -c $MAXCONN $OPTIONS
  • 因此,没有 .pid 文件的路径。
  • 如果在没有 .pid 文件的情况下检查 memcached 吗?
  • 还有,这个 .pid 文件可以在另一个位置吗?

CentOS 7如何指定memcache pid文件位置地址?

解决方法,将你在Monit监控配置中,指定的memcache pid文件地址 ▼

check process memcached with pidfile /var/run/memcached/memcached.pid

替换为以下memcached pid的文件地址 ▼

check process memcached with match memcached

我们对 memcached 的配置:

check process memcached with match memcached
start program = "/usr/bin/systemctl start memcached"
stop program = "/usr/bin/systemctl stop memcached"
if failed host 127.0.0.1 port 11211 protocol MEMCACHE then restart
if cpu > 70% for 2 cycles then alert
if cpu > 98% for 5 cycles then restart
if 2 restarts within 3 cycles then timeout

Centos 7 Monit监控 5.14的安装方法,请参考以下教程 ▼

希望陈沩亮博客( https://www.chenweiliang.com/ ) 分享的《memcached找不到pid文件?CentOS 7指定memcache pid》,对您有帮助。

欢迎分享本文链接:https://www.chenweiliang.com/cwl-26685.html

欢迎加入陈沩亮博客的 Telegram 频道,获取最新更新!

🔔 率先在频道置顶目录获取宝贵的《ChatGPT 内容营销 AI 工具使用指南》!🌟
📚 这份指南蕴含价值巨大,🌟难逢的机遇,切勿错失良机!⏰⌛💨
喜欢就分享和按赞!
您的分享和按赞,是我们持续的动力!

 

发表评论

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

滚动到顶部