Setting up clustered FTP
Prereqs
Configure CTDB as above and set it up to use public ipaddresses.
Verify that the CTDB cluster works.
Configuration
Setting 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/ctdb
Add the following line to the /etc/sysconfig/ctdb configuration file.
CTDB_MANAGES_VSFTPD=yes
Disable vsftpd in chkconfig so that it does not start by default. Instead CTDB will start/stop vsftdp as required.
chkconfig vsftpd off
PAM configuration
PAM 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_pass
If this line is missing you must enable winbind authentication by running
authconfig --enablewinbindauth --update
authconfig --enablewinbind --update
Default shell
To 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 directory
FTP 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/%U
to /etc/samba/smb.conf .
The homedirectory must exist or the user will not be able to log in with FTP.
Events script
The 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 cluster
Next 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 node
Use the ctdb command to disable the node :
ctdb -n NODE disable
2 Wait until the cluster has recovered
Use 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.
ctdb status
3 Enable the node again
Re-enable the node again which will start the newly configured vsftp service.
ctdb -n NODE enable