ในกรณีเฉพาะของฉันฉันต้องการเริ่มremote-fsหน่วยหลังจากทั้งหมดglusterfsเริ่มต้นอย่างสมบูรณ์
ไฟล์ systemd ของฉัน:
glusterfs กำหนดเป้าหมาย:
node04:/usr/lib/systemd/system # cat glusterfsd.service
[Unit]
Description=GlusterFS brick processes (stopping only)
After=network.target glusterd.service
[Service]
Type=oneshot
ExecStart=/bin/true
RemainAfterExit=yes
ExecStop=/bin/sh -c "/bin/killall --wait glusterfsd || /bin/true"
ExecReload=/bin/sh -c "/bin/killall -HUP glusterfsd || /bin/true"
[Install]
WantedBy=multi-user.target
remote-fs กำหนดเป้าหมาย:
node04:/usr/lib/systemd/system # cat remote-fs.target
[Unit]
Description=Remote File Systems
Documentation=man:systemd.special(7)
Requires=glusterfsd.service
After=glusterfsd.service remote-fs-pre.target
DefaultDependencies=no
Conflicts=shutdown.target
[Install]
WantedBy=multi-user.target
ตกลงทั้งหมดภูต Gluster เริ่มต้นที่ประสบความสำเร็จและฉันต้องการที่จะติดระบบแฟ้ม Gluster ผ่าน NFS แต่ Gluster ส่วนแบ่ง NFS ได้รับพร้อมได้ทันทีหลังจากที่glusterfs.serviceเริ่มต้น แต่ไม่กี่วินาทีต่อมาจึงมักจะremote-fsไม่สามารถที่จะติดมันก็เกี่ยวกับการRequiresและAfterแนวทาง
มาดูบันทึก:
Apr 14 16:16:22 node04 systemd[1]: Started GlusterFS, a clustered file-system server.
Apr 14 16:16:22 node04 systemd[1]: Starting GlusterFS brick processes (stopping only)...
Apr 14 16:16:22 node04 systemd[1]: Starting Network is Online.
Apr 14 16:16:22 node04 systemd[1]: Reached target Network is Online.
Apr 14 16:16:22 node04 systemd[1]: Mounting /stor...
ที่นี่ทุกอย่างก็โอเคดูเหมือนว่าระบบไฟล์ระยะไกล (/ stor) จะถูกเมาท์หลังจาก glusterfs เริ่มทำงานเนื่องจากมันจะเป็นไปตามไฟล์หน่วย ... แต่บรรทัดถัดไปคือ:
//...skipped.....
Apr 14 16:16:22 node04 systemd[1]: Started GlusterFS brick processes (stopping only).
อะไร? GlusterFS เตรียมพร้อมสำหรับช่วงเวลานี้เท่านั้น! แล้วเราจะเห็น:
//...skipped.....
Apr 14 16:16:23 node04 mount[2960]: mount.nfs: mounting node04:/stor failed, reason given by server: No such file or directory
Apr 14 16:16:23 node04 systemd[1]: stor.mount mount process exited, code=exited status=32
Apr 14 16:16:23 node04 systemd[1]: Failed to mount /stor.
Apr 14 16:16:23 node04 systemd[1]: Dependency failed for Remote File Systems.
Apr 14 16:16:23 node04 systemd[1]: Unit stor.mount entered failed state.
การเมาต์ล้มเหลวเนื่องจากเซิร์ฟเวอร์ NFS ไม่พร้อมเมื่อ systemd พยายามเมานต์ที่เก็บข้อมูล
เนื่องจากลักษณะการบูตระบบ systemd ไม่สามารถกำหนดได้บางครั้ง (ประมาณ 1 จาก 10 บูท) การติดตั้งระบบไฟล์นี้เมื่อบู๊ตสำเร็จ
หากการติดตั้ง onboot ไม่สำเร็จฉันสามารถลงชื่อเข้าใช้เซิร์ฟเวอร์และติดตั้งไดเรกทอรี / stor ด้วยตนเองได้ดังนั้นบริการ NFS ของ Gluster จึงดูเหมือนว่าทำงานได้ดี
ดังนั้นวิธีการที่จะเริ่มต้นremote-fsหลังจากที่glusterfsdคือหลังจากที่Started GlusterFS brick processesปรากฏในบันทึกบรรทัดหรือไม่
remote-fsดูเหมือนจะเป็นหนึ่งในเป้าหมายสุดท้ายดังนั้นฉันจึงไม่สามารถเริ่มต้นได้หลังจากเป้าหมาย "การแก้ปัญหา" อื่นซึ่งไม่จำเป็นต้องใช้remote-fsจริง
glusterfsd.serviceไฟล์หน่วยของคุณ ดูเหมือนจะไม่เริ่มบริการใด ๆ จริง ๆ และในความเป็นจริงจะฆ่าglusterfsdกระบวนการใด ๆ คุณมีไฟล์หน่วยอื่นที่เกี่ยวข้องกับ gluster หรือไม่?
stor.mountยูนิตนี้ได้หรือไม่
ExecStartPre=<command>คุณสมบัติให้กับส่วน Unit ของglusterfsd.serviceคำสั่งที่จะบล็อกจนกว่า glusterfs พร้อมหรือไม่ ที่อาจป้องกันได้จากการแสดงให้เห็นความสำเร็จและเปิดใช้งานglusterfsd.serviceremotefs.target