![CTDB Samba 脚本无法启动](https://linux22.com/image/747850/CTDB%20Samba%20%E8%84%9A%E6%9C%AC%E6%97%A0%E6%B3%95%E5%90%AF%E5%8A%A8.png)
以下是 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 server 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.
答案1
pstree 输出表明“service nmbd start”在尝试执行 systemd 操作时挂起。
如果您在终端中尝试“service nmbd start”,会发生什么情况?“systemctl start nmbd”怎么样?
答案2
我找到了一个解决方法。我禁用 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。