Setting Up An Active/Active Samba CTDB Cluster Using GFS & DRBD (CentOS 5.5) - Page 3

Want to support HowtoForge? Become a subscriber!
 
Submitted by rafatmb (Contact Author) (Forums) on Wed, 2010-12-01 17:53. ::

This article explains how to set up an Active/Active Samba CTDB Cluster, using GFS and DRBD. Prepared by Rafael Marangoni, from BRLink Servidor Linux Team.

6. Configuring Samba

The samba configuration is very common. In this article, we don't cover how to configure samba. We only explain a very simple configuration.
Do it on both nodes:

First, we need to configure /etc/samba/smb.conf on both nodes:

vi /etc/samba/smb.conf

[global]

clustering = yes
idmap backend = tdb2
private dir=/clusterdata/ctdb
fileid:mapping = fsname
use mmap = no
nt acl support = yes
ea support = yes

[public]
comment = public share
path = /clusterdata/public
public = yes
writeable = yes
only guest = yes 

We must to create the directories used by samba (only on one node):

mkdir /clusterdata/ctdb
mkdir /clusterdata/public
chmod 777 /clusterdata/public

Adding root on samba, only on one node:

smbpasswd -a root

 

7. Configuring CTDB

The process to install ctdb it's very simple. Do it on both nodes:

First, we need to download it:

cd /usr/src
rsync -avz samba.org::ftp/unpacked/ctdb .
cd ctdb/

Then we can compile it:

cd /usr/src/ctdb/
./autogen.sh
./configure
make
make install

Creating the init scripts and config links to /etc:

cp config/ctdb.sysconfig /etc/sysconfig/ctdb
cp config/ctdb.init /etc/rc.d/init.d/ctdb
chmod +x /etc/init.d/ctdb

ln -s /usr/local/etc/ctdb/ /etc/ctdb
ln -s /usr/local/bin/ctdb /usr/bin/ctdb
ln -s /usr/local/sbin/ctdbd /usr/sbin/ctdbd

Next, we need to config /etc/sysconfig/ctdb on both nodes:

vi /etc/sysconfig/ctdb

CTDB_RECOVERY_LOCK="/dadoscluster/ctdb/storage"
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/log.ctdb
CTDB_DEBUGLEVEL=2
CTDB_PUBLIC_NETWORK="10.0.0.0/24"
CTDB_PUBLIC_GATEWAY="10.0.0.9" 

Now, config /etc/ctdb/public_addresses on both nodes:

vi /etc/ctdb/public_addresses

10.0.0.183/24
10.0.0.184/24

Then, config /etc/ctdb/nodes on both nodes:

vi /etc/ctdb/nodes

10.0.0.181
10.0.0.182

Then, config /etc/ctdb/events.d/11.route on both nodes:

vi /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

Set +x permission on script:

chmod +x /etc/ctdb/events.d/11.route

Finally, we need to bring services on:

/etc/init.d/ctdb start
/etc/init.d/smb start
chkconfig --level 35 ctdb on
chkconfig --level 35 smb on

 

References

CTDB: http://ctdb.samba.org/
CTDB: http://wiki.samba.org/index.php/CTDB_Setup#RedHat_GFS_filesystem
Howto: http://jun.homeunix.com/skills/server/GFS.DRBD8.CTDB.SAMBA.CentOS.txt


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.