Systemd를 통한 Gluster 마운트

Systemd를 통한 Gluster 마운트

부팅 시 마운트할 Gluster 볼륨을 가져와야 합니다. /etc/fstab에 배치하면 신뢰할 수 있는 결과가 생성되지 않습니다.

다음 systemd 서비스를 설정했습니다.

[Unit]
Description=Gluster Mount

[Service]
Type=oneshot
ExecStart=/bin/mount /data
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target

이 서비스가 부팅 시 실행되면 다음을 반환합니다.

root@web1:~# systemctl status gluster-mount.service
â gluster-mount.service - Gluster Mount
   Loaded: loaded (/etc/systemd/system/gluster-mount.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Tue 2018-03-13 04:05:43 UTC; 3min 20s ago
  Process: 627 ExecStart=/bin/mount /data (code=exited, status=1/FAILURE)
 Main PID: 627 (code=exited, status=1/FAILURE)

Mar 13 04:05:39 web1 systemd[1]: Starting Gluster     Mount...
Mar 13 04:05:43 web1 systemd[1]: gluster-mount.service: Main process exited, code=exited, status=1/FAILURE
Mar 13 04:05:43 web1 systemd[1]: Failed to start Gluster Mount.
Mar 13 04:05:43 web1 systemd[1]: gluster-mount.service: Unit entered failed state.
Mar 13 04:05:43 web1 systemd[1]: gluster-mount.service: Failed with result 'exit-code'.

로그인 후 이 서비스를 "다시 시작"하면 정상적으로 작동합니다. 내가 무엇을 놓치고 있나요?

답변1

따라서 idle문제를 해결하려면 유형을 변경하십시오. 정의에 따르면 해당 idle유형은 해당 서비스 요청을 처리하기 전에 다른 모든 것이 전달될 때까지 기다립니다. 나는 그것이 타이밍과 관련이 있다고 직감했고 이것이 실제로 문제를 해결한 유일한 방법이었습니다.

[Unit]
Description=Gluster Mount

[Service]
Type=idle
ExecStart=/bin/mount /data
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target

관련 정보