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

[shareDoc]
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
[global]
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
[global]
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
CTDB_RECOVERY_LOCK="/shareDoc/ctdb/lock"
CTDB_PUBLIC_INTERFACE=eth0
CTDB_PUBLIC_ADDRESSES=/etc/ctdb/public_addresses
CTDB_MANAGES_SAMBA=yes
ulimit -n 10000
CTDB_NODES=/etc/ctdb/nodes
CTDB_LOGFILE=/var/log/ctdb/log.ctdb
CTDB_DEBUGLEVEL=2
CTDB_PUBLIC_NETWORK="172.30.2.10/24"
CTDB_PUBLIC_GATEWAY="172.30.2.1"

sudo vim /etc/ctdb/public_addresses
172.30.2.10/24
172.30.2.11/24

sudo vim /etc/ctdb/nodes
172.30.2.196
172.30.2.162

sudo mkdir /etc/ctdb/events.d
sudo vim /etc/ctdb/events.d/11.route
#!/bin/sh
. /etc/ctdb/functions
loadconfig ctdb
cmd="$1"
shift
case $cmd in
takeip)
# 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
;;
esac
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

2021-09-15