I am trying to load balance ftp between 2 servers. currently 2 servers are pointed to ftp.domain.com, the second server is technically used for fault tolerance but I want to balance traffic between the 2 servers. How can I achieve this? I thought of making a simple script that would redirect users from ftp.domain to 01.ftp.domain and 02.ftp.domain etc but the problem is that FTP apps dont read pages so if a user attempts to login to ftp.domain it wont redirect them anywhere.
Linux – load balancing between 2 FTP servers
ftplinuxload balancingupload
Best Answer
To load balance your servers you should consider both command and data channels. To load balance command channel I suggest you to use HAProxy. If you use it, you should specify in your
/etc/haproxy/haproxy.cfg
the following:IP here is a public ip whereas the connection is then redirected to 192.168.1.0/24 network. You should also define NAT forwarding in your
iptables
. For instructions to do this you can look the accepted answer here (How can I port forward with iptables?).To perform load balance of data channel you should run as root in terminal these commands
These settings are valid for so-called active data channel. For setup in passive data channel case and more detailed instructions, please, consult this article (https://gist.github.com/erkie/922996a2ec4125d79c7f8772cda328ce).