Ctdb + Samba to achieve high availability -- a failed attempt

simmy 2021-09-15 09:39:48

The experiment failed , Two Nodes, There is only one display ok, Add as configured global Environment to smb.conf file , Has led to smbd Service failed to start , The specific reason is not clear .

CTDB+Samba High availability ---- A failed attempt _ctdb


The specific commands are recorded as follows :

install samba

sudo apt-get update
sudo apt-get install samba
sudo service smbd status
cd /
sudo mkdir shareDoc
cd shareDoc/
sudo mkdir TestLog
sudo mkdir abc
sudo useradd log
sudo passwd log
sudo passwd ubuntu
sudo vim /etc/ssh/sshd_config
AllowUsers ubuntu aaa
ClientAliveInterval 60
ClientAliveCountMax 86400

Subsystem sftp internal-sftp
Match group sftp
ForceCommand internal-sftp
ChrootDirectory /shareDoc/TestLog

sudo groupadd sftp
sudo gpasswd -a aaa sftp

sudo chown aaa.aaa abc/
sudo chmod 700 abc/
sudo vim /etc/samba/smb.conf

comment = Folder for File Sharing
path = /shareDoc
public = no
writable = yes
valid users = ubuntu,aaa

sudo smbpasswd -a aaa
sudo service smbd restart
sudo service sshd restart
sudo service ssh restart


install ctdb

sudo apt-get install ctdb
sudo vim /etc/services
add below to end:
ctdb  9999/tcp

sudo vim /etc/samba/smb.conf
clustering = yes
idmap backend = tdb2
private dir=/shareDoc/ctdb
fileid:mapping = fsname
#use mmap = no (smbd This makes it impossible to start )
nt acl support = yes
ea support = yes


ctdb The information on the official website , The test does not work
clustering = yes
ctdb:registry.tdb = yes
include = registry


sudo vim /shareDoc/ctdb/lock ( You may need to create this yourself lock file )

sudo vim /etc/default/ctdb
ulimit -n 10000

sudo vim /etc/ctdb/public_addresses

sudo vim /etc/ctdb/nodes

sudo mkdir /etc/ctdb/events.d
sudo vim /etc/ctdb/events.d/11.route
. /etc/ctdb/functions
loadconfig ctdb
case $cmd in
# we ignore errors from this, as the route might be up already when we're grabbing
# a 2nd IP on this interface
/sbin/ip route add $CTDB_PUBLIC_NETWORK via $CTDB_PUBLIC_GATEWAY dev $1 2> /dev/null
exit 0

sudo chmod +x /etc/ctdb/events.d/11.route
sudo service ctdb restart
sudo service smbd restart
sudo ctdb status
sudo ctdb ip
sudo ctdb lvs status

AWS EC2 test , Open the firewall between machines , Otherwise 2 individual nodes No communication , The specific ports are as follows , During the test, I will release all intranet segments .

by ctdb Let go of the firewall
# firewall-cmd --add-port=4379/tcp

debug smb.conf File can use this command :testparm

CTDB+Samba High availability ---- A failed attempt _ High availability _02


ctdb log

CTDB+Samba High availability ---- A failed attempt _ctdb_03

Please bring the original link to reprint ,thank
Similar articles