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的安裝方法,請參考以下教程▼

發表評論

您的郵箱地址不會被公開。 必填項已用 * 標註

回到頁首