Setting up clustered FTP
PrereqsConfigure CTDB as above and set it up to use public ipaddresses.
Verify that the CTDB cluster works.
ConfigurationSetting up a vsftpd cluster is really easy.
Configure vsftpd on each node on the cluster.
Set up vsftpd to export directories from the shared cluster filesystem.
/etc/sysconfig/ctdbAdd the following line to the /etc/sysconfig/ctdb configuration file.
CTDB_MANAGES_VSFTPD=yesDisable vsftpd in chkconfig so that it does not start by default. Instead CTDB will start/stop vsftdp as required.
chkconfig vsftpd off
PAM configurationPAM must be configured to allow authentication of CIFS users so that the ftp daemon can authenticate the users logging in. Make sure the following line is present in /etc/pam.d/system-auth
auth sufficient pam_winbind.so use_first_passIf this line is missing you must enable winbind authentication by running
authconfig --enablewinbindauth --update authconfig --enablewinbind --update
Default shellTo log in to the ftp server, the user must have a shell configured in smb.conf. Add the following line to the globals section of /etc/samba/smb.conf
template shell = /bin/bash
Home directoryFTP users must have a home directory configured so they can log in. Configure samba to provide home directories for domain users. These home directories should be stored on shared storage so they are available from all nodes in the cluster.
A simple way to create homedirectories are to add
template homedir = /<shared storage>/homedir/%D/%Uto /etc/samba/smb.conf .
The homedirectory must exist or the user will not be able to log in with FTP.
Events scriptThe CTDB distribution already comes with an events script for vsftp in the file /etc/ctdb/events.d/40.vsftpd
There should not be any need to edit this file.
Restart your clusterNext time your cluster restarts, CTDB will start managing the vsftp service.
If the cluster is already in production you may not want to restart the entire cluster since this would disrupt services.
Insted you can just disable/enable the nodes one by one. Once a node becomes enabled again it will start the vsftp service.
Follow the procedure below for each node, one node at a time :
1 Disable the nodeUse the ctdb command to disable the node :
ctdb -n NODE disable
2 Wait until the cluster has recoveredUse the ctdb tool to monitor until the cluster has recovered, i.e. Recovery mode is NORMAL. This should happen within seconds of when you disabled the node.
3 Enable the node againRe-enable the node again which will start the newly configured vsftp service.
ctdb -n NODE enable