所以我不得不在 /var/run/memcached 中使用 SOCKET 部署 Rocky Linux 8 memcached
为了避免服务失败,我运行了以下命令:
- systemctl 编辑 memcached.service
粘贴在:
[Unit]
Description=Memcached
Before=httpd.service
After=network.target
[Service]
Type=simple
User=memcached
Group=memcached
# Run ExecStartPre with root-permissions
ExecStartPre=-/usr/bin/mkdir /var/run/memcached
ExecStartPre=-/usr/bin/chown -R memcached:memcached /var/run/memcached/
[Install]
WantedBy=multi-user.target
[root@cp monit.d]# service memcached status
Redirecting to /bin/systemctl status memcached.service
● memcached.service - Memcached
Loaded: loaded (/usr/lib/systemd/system/memcached.service; enabled; vendor preset: disabled)
Drop-In: /etc/systemd/system/memcached.service.d
└─override.conf
Active: active (running) since Thu 2022-10-13 15:23:50 CEST; 3s ago
Process: 1336192 ExecStartPre=/usr/bin/chown -R memcached:memcached /var/run/memcached/ (code=exited, status=0/SUCCESS)
Process: 1336188 ExecStartPre=/usr/bin/mkdir /var/run/memcached (code=exited, status=1/FAILURE)
Main PID: 1336194 (memcached)
Tasks: 10 (limit: 101049)
Memory: 3.6M
CGroup: /system.slice/memcached.service
└─1336194 /usr/bin/memcached -p 11211 -u memcached -m 256 -c 1024 -s /var/run/memcached/memcached.sock -a 0770
Oct 13 15:23:50 cp.uhlhosting.ch systemd[1]: Starting Memcached...
Oct 13 15:23:50 cp.uhlhosting.ch systemd[1]: Started Memcached.
有什么方法可以避免这种失败?
ExecStartPre=/usr/bin/mkdir /var/run/memcached (code=exited, status=1/FAILURE)
谢谢!