systemctl 및 Type=notify를 사용하면 Redis 서비스가 중단됩니다.

systemctl 및 Type=notify를 사용하면 Redis 서비스가 중단됩니다.

나는 다음 답변을 따랐습니다.https://serverfault.com/a/893075/210494. CentOS 7.8이 있습니다.

redis.service

[Service]
Type=notify
ExecStart=/opt/redis/bin/redis-server /opt/redis/conf/redis-master.conf
TimeoutStartSec=60
TimeoutStopSec=60
TimeOutSec=90
RestartSec=5s
Restart=on-success

redis-master.conf

daemonize no
supervised systemd

이 서비스를 실행하면 Redis 프로세스가 시작되지만 중단 systemctl되므로 쉘로 돌아가려면 Ctrl-C를 눌러야 합니다.

이는 로그에 있습니다.

69486:C 28 Aug 2020 17:31:14.545 # Redis version=6.0.6, bits=64, commit=00000000, modified=0, pid=69486, just started
69486:C 28 Aug 2020 17:31:14.545 # Configuration loaded
69486:C 28 Aug 2020 17:31:14.545 # WARNING supervised by systemd - you MUST set appropriate values for TimeoutStartSec and TimeoutStopSec in your service unit.
69486:M 28 Aug 2020 17:31:14.546 * Increased maximum number of open files to 4096 (it was originally set to 1024).
69486:M 28 Aug 2020 17:31:14.547 * Running mode=standalone, port=6380.
69486:M 28 Aug 2020 17:31:14.547 # Server initialized

주석 처리하면 Type=notifysystemctl이 즉시 완료되지만 이는 로그에 있습니다.

68629:C 28 Aug 2020 17:29:58.933 # Redis version=6.0.6, bits=64, commit=00000000, modified=0, pid=68629, just started
68629:C 28 Aug 2020 17:29:58.933 # Configuration loaded
68629:C 28 Aug 2020 17:29:58.933 # WARNING supervised by systemd - you MUST set appropriate values for TimeoutStartSec and TimeoutStopSec in your service unit.
68629:C 28 Aug 2020 17:29:58.933 # systemd supervision requested, but NOTIFY_SOCKET not found
68629:M 28 Aug 2020 17:29:58.933 * Increased maximum number of open files to 4096 (it was originally set to 1024).
68629:M 28 Aug 2020 17:29:58.934 * Running mode=standalone, port=6380.
68629:M 28 Aug 2020 17:29:58.934 # Server initialized

문제는 어디에 있습니까? 나는 그들이 가지고 있지 않은 DigitalOcean 튜토리얼을 찾았고 Type=notify그들이 성공적으로 추천했을 때 Redis 문제를 발견했습니다 Type=notify.

업데이트

Job for redis.service failed because a timeout was exceeded. See "systemctl status redis.service" and "journalctl -xe" for details.
[root@DB dev]# systemctl status redis
● redis.service - Redis
   Loaded: loaded (/etc/systemd/system/redis.service; enabled; vendor preset: disabled)
   Active: failed (Result: timeout) since Sun 2020-08-30 12:06:58 CEST; 46min ago
  Process: 11134 ExecStart=/opt/app/redis/default/bin/redis-server /opt/app/redis/default/conf/redis-master.conf (code=exited, status=0/SUCCESS)
 Main PID: 11134 (code=exited, status=0/SUCCESS)
Aug 30 12:05:57 DB systemd[1]: Starting Redis...
Aug 30 12:06:58 DB systemd[1]: redis.service start operation timed out. Terminating.
Aug 30 12:06:58 DB systemd[1]: Failed to start Redis.
Aug 30 12:06:58 DB systemd[1]: Unit redis.service entered failed state.
Aug 30 12:06:58 DB systemd[1]: redis.service failed.

답변1

문제는 systemd지원이 기본적으로 컴파일되지 않는다는 것입니다. 명시적으로 컴파일해야 합니다. 이에 대해서는 설명이 없기 때문에 소스에서 README.md를 업데이트하기 위해 PR을 작성하겠습니다.

이것저지르다이 행동에 대한 책임이 있습니다. 이번 호에서 찾았습니다.https://github.com/redis/redis/issues/7217

yum install systemd-devel
make BUILD_WITH_SYSTEMD=yes USE_SYSTEMD=yes

관련 정보