Ubuntu

CTDB Samba 腳本無法啟動

  • January 28, 2020

這是 tail -f /var/log/ctdb/log.ctdb 的輸出

2020/01/27 18:52:52.317670 ctdbd[3330]: Running the "startup" event.
2020/01/27 18:53:22.323208 ctdbd[3330]: startup event failed
2020/01/27 18:53:22.439563 ctdb-eventd[3332]: event_debug: ===== Start of hung script debug for PID="3678", event="startup" =====
2020/01/27 18:53:22.439703 ctdb-eventd[3332]: event_debug: pstree -p -a 3678:
2020/01/27 18:53:22.439764 ctdb-eventd[3332]: event_debug: 50.samba.script,3678 /etc/ctdb/events/legacy/50.samba.script startup
2020/01/27 18:53:22.439822 ctdb-eventd[3332]: event_debug:   `-service,3758 /sbin/service nmbd start
2020/01/27 18:53:22.439877 ctdb-eventd[3332]: event_debug:       `-service,3762 /sbin/service nmbd start
2020/01/27 18:53:22.439953 ctdb-eventd[3332]: event_debug:           |-sed,3764 -ne s/\.socket\s*[a-z]*\s*$/.socket/p
2020/01/27 18:53:22.440012 ctdb-eventd[3332]: event_debug:           `-systemctl,3763 list-unit-files --full --type=socket
2020/01/27 18:53:22.440068 ctdb-eventd[3332]: event_debug: ---- ctdb scriptstatus startup: ----
2020/01/27 18:53:22.440133 ctdb-eventd[3332]: event_debug: 00.ctdb              OK         0.017 Mon Jan 27 18:52:52 2020
2020/01/27 18:53:22.440203 ctdb-eventd[3332]: event_debug: 01.reclock           OK         0.010 Mon Jan 27 18:52:52 2020
2020/01/27 18:53:22.440259 ctdb-eventd[3332]: event_debug: 05.system            OK         0.010 Mon Jan 27 18:52:52 2020
2020/01/27 18:53:22.440314 ctdb-eventd[3332]: event_debug: 10.interface         OK         0.064 Mon Jan 27 18:52:52 2020
2020/01/27 18:53:22.440382 ctdb-eventd[3332]: event_debug: 50.samba             TIMEDOUT   Mon Jan 27 18:52:52 2020
2020/01/27 18:53:22.440438 ctdb-eventd[3332]: event_debug:   OUTPUT:
2020/01/27 18:53:22.440492 ctdb-eventd[3332]: event_debug: event daemon helper failed with error 46
2020/01/27 18:53:22.440558 ctdb-eventd[3332]: event_debug: ===== End of hung script debug for PID="3678", event="startup" =====

奇怪的是上週在我的兩個節點上發生了這種情況,但是當我再次啟動它們時,第一個節點工作,第二個節點給了我這個錯誤。

我正在啟用腳本

ctdb event script enable legacy 50.samba

這是我的 smb.conf

[global]
       workgroup = WORKGROUP2
       clustering = yes
       netbios name = gluster
       idmap backend = tdb2

[share]
       path = /mnt/gfs/share
       valid users = fsuser
       readonly = no
       browsable = yes

我正在使用最新的 ctdb 和 samba 執行 ubuntu 伺服器 19.10。共享文件系統是 glusterfs,該部分正常工作並通過了 ping_pong 測試。

我也使用 journalctl -b 看到這條消息

Dec 03 16:28:18 gfs1 systemd[1]: /lib/systemd/system/dbus.socket:4: ListenStream= references a path below legacy directory /var/run/, updating /var/run/dbus/system_bus_socket → /run/dbus/system_bus_socket; please update the unit file acc
Dec 03 16:28:18 gfs1 systemd[1]: /lib/systemd/system/smbd.service:9: PIDFile= references a path below legacy directory /var/run/, updating /var/run/samba/smbd.pid → /run/samba/smbd.pid; please update the unit file accordingly.
Dec 03 16:28:18 gfs1 systemd[1]: /lib/systemd/system/nmbd.service:9: PIDFile= references a path below legacy directory /var/run/, updating /var/run/samba/nmbd.pid → /run/samba/nmbd.pid; please update the unit file accordingly.
Dec 03 16:28:18 gfs1 systemd[1]: Set up automount Arbitrary Executable File Formats File System Automount Point.

我找到了解決這個問題的方法。我禁用了 ctdb samba 舊腳本並使用正常的 systemctl 啟動腳本。

sudo systemctl edit ctdb

添加以下內容並保存退出

[Unit]
Require=mnt-gfs.mount
After=mnt-gfs.mount

要找出您的 .mount,您可以執行此命令並使用您的 glusterfs 或其他分佈式文件系統安裝點切換安裝更新檔。

sudo systemctl list-units | grep '/mnt/gfs' | awk '{ print $1 }'

然後它只是編輯 smbd 和 nmbd 服務文件的母題。

sudo systemctl edit smbd.service
sudo systemctl edit nmbd.service

然後將其添加到上述兩個文件中,保存並退出每個文件

[Unit]
After=ctdb.service

確保 ctdb 已啟動並執行並執行此命令(如果未執行,則使用 systemctl start ctdb 啟動它)

sudo ctdb event script enable legacy 50.samba

重新啟動您的節點,它應該掛載您的分佈式文件系統共享,啟動 ctdb,然後啟動 smbd 和 nmbd。

pstree 輸出表明“service nmbd start”在嘗試執行 systemd 操作時掛起。

如果您在終端中嘗試“service nmbd start”會發生什麼?“systemctl start nmbd”怎麼樣?

引用自:https://serverfault.com/questions/1000614