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

関連情報