[Samba] CTDB: Failed to connect client socket to daemon.

Achim Gottinger achim at ag-web.biz
Sun Aug 17 07:21:19 MDT 2014


Am 17.08.2014 14:22, schrieb Achim Gottinger:
> Am 17.08.2014 11:25, schrieb steve:
>> On Sat, 2014-08-16 at 19:57 +0200, Achim Gottinger wrote:
>>> Am 16.08.2014 19:39, schrieb steve:
>>>> On Sat, 2014-08-16 at 18:09 +0200, Achim Gottinger wrote:
>>>>> Am 16.08.2014 15:52, schrieb steve:
>>>>>> Ubuntu 14.04, ctdb 2.5.3, samba 4.1.11. CTDB is working with IP 
>>>>>> takeover
>>>>>> between the 2 nodes. The machine is joined to the domain.
>>>>>>
>>>>>> Any help with the following errors would be most gratefully 
>>>>>> received.
>>>>>>
>>>>>> 1. connect to socket error:
>>>>>> ctdb status
>>>>>> 2014/08/16 15:32:03.248034 [23255]: client/ctdb_client.c:267 
>>>>>> Failed to
>>>>>> connect client socket to daemon. Errno:Connection refused(111)
>>>>>> common/cmdline.c:156 Failed to connect to daemon
>>>>> What's the output of ls -l /usr/local/var/run/ctdb/ ?
>>>>    ls -l /usr/local/var/run/ctdb
>>>> total 0
>>>> srwx------ 1 root root 0 ago 16 19:32 ctdbd.socket
>>>>
>>>> The socket is there and is renewed upon each ctdb (re) start. smb.conf
>>>> refers to the same socket.
>>> Guess that's ok. Maybe the log is more helpfull with CTDB_DEBUGLEVEL=4
>>> (an recommendation i found on an other therad about ctdb issues).
>> Hi
>> This solves the socket problem:
>> /etc/default/ctdb
>>
>> #CTDB_SOCKET=/usr/local/var/run/ctdb/ctdbd.socket
>> export CTDB_SOCKET
> Seen this mentined here. 
> http://lists.opensuse.org/opensuse-bugs/2013-07/msg03469.html. Assumed 
> the thread was to old to be relevant here. :-\
>>
>> and indeed:
>>   sudo ctdb status
>> Number of nodes:2
>> pnn:0 192.168.0.10     OK (THIS NODE)
>> pnn:1 192.168.0.11     DISCONNECTED|UNHEALTHY|INACTIVE
>> Generation:635915504
>> Size:1
>> hash:0 lmaster:0
>> Recovery mode:NORMAL (0)
>> Recovery master:0
>>
>> ...................
>>
>> What are the valid arguments to 50.samba?
>>
>> *************
>> As you suggested we restored the original 50.samba script and added:
>> CTDB_SERVICE_SMB=smbd
>> to /etc/defaults/ctdb
>>
>> Here is /etc/ctdb/events.d/50.samba:
>> #!/bin/sh
>> # ctdb event script for Samba
>>
>> [ -n "$CTDB_BASE" ] || \
>>      export CTDB_BASE=$(cd -P $(dirname "$0") ; dirname "$PWD")
>>
>> . $CTDB_BASE/functions
>> .........
>> service_start ()
>> {
>>      # make sure samba is not already started
>> echo $CTDB_SERVICE_SMB
>> exit 1
> The above two lines do not appear on debians version of the 
> startscript. Guess they endedup unintentional.
>>      service "$CTDB_SERVICE_SMB" stop > /dev/null 2>&1
>>      if [ -n "$CTDB_SERVICE_NMB" ] ; then
>>          service "$CTDB_SERVICE_NMB" stop > /dev/null 2>&1
>>      fi
>>      killall -0 -q smbd && {
>>          sleep 1
>>          # make absolutely sure samba is dead
>>          killall -q -9 smbd
>>      }
>>      killall -0 -q nmbd && {
>>          sleep 1
>>          # make absolutely sure samba is dead
>>          killall -q -9 nmbd
>>      }
>>
>>      # start Samba service. Start it reniced, as under very heavy load
>>      # the number of smbd processes will mean that it leaves few cycles
>>      # for anything else
>>      net serverid wipe
>>
>>      if [ -n "$CTDB_SERVICE_NMB" ] ; then
>>          nice_service "$CTDB_SERVICE_NMB" start || die "Failed to start
>> nmbd"
>>      fi
>>
>>      nice_service "$CTDB_SERVICE_SMB" start || die "Failed to start
>> samba"
>> }
>>
>> .....
>> is_ctdb_managed_service || exit 0
> Below you can see startup/shutdown/monitor are valid options for the 
> script. Take an look at /etc/ctdb/functions if you want to inspect the 
> functions like is_ctdb_managed_service above.
>> ###########################
>>
>> case "$1" in
>>       startup)
>>          ctdb_service_start
>>          ;;
>>
>>       shutdown)
>>          ctdb_service_stop
>>          ;;
>>
>>       monitor)
>>          testparm_foreground_update 10
>>          ret=$?
>>
>>          smb_ports="$CTDB_SAMBA_CHECK_PORTS"
>>          if [ -z "$smb_ports" ] ; then
>>              smb_ports=$(list_samba_ports)
>>              [ -n "$smb_ports" ] || die "Failed to set smb ports"
>>          fi
>>          ctdb_check_tcp_ports $smb_ports || exit $?
>>
>>          if [ "$CTDB_SAMBA_SKIP_SHARE_CHECK" != "yes" ] ; then
>>              list_samba_shares | ctdb_check_directories || exit $?
>>          fi
>>
>>          if [ $ret -ne 0 ] ; then
>>              testparm_background_update 10
>>          fi
>>          ;;
>>
>>      *)
>>          ctdb_standard_event_handler "$@"
>>          ;;
>> esac
>> exit 0
>>
> Hope that helps.
After skimming thru https://ctdb.samba.org/testing.html and "man ctdb" i 
guess "ctdb enablescript samba" is what you need to start it and this in 
/etc/default/ctdb CTDB_MANAGES_SAMBA="yes"



More information about the samba mailing list