First, I think you’re going to run into errors with a Master-Slave setup. If the primary goes down, the PI instance on the slave server won’t be able to write to the DB. At least, that’s my understanding of it, but I’m by no means a DBA. That’s why I went with the Galera setup, because it’s a full Multi-Sync, Master-Master setup. Any PI server can write to their local DB, and it gets replicated around the cluster.
Second, to answer your question, you could set up an Apache cluster, with one Virtual IP pointing to the two static IPs of the two servers.
In my case, we have a small number of users (~40), so I wasn’t concerned about load balancing, I wanted redundancy in case a server went down. If you are more concerned about redundancy than load balancing, then it depends on your authentication method.
In our case, we are using PAM on our servers to authenticate. So, I customized PAM so that it does the following:
PAM first passes credentials to Server 1
If it fails, a script is run to check to see if Server 1 is up. If yes, user is denied access. If no, it continues
PAM passes credentials to Server 2
If it fails, a script is run to check to see if either Server 1 or Server 2 is up. If either is, user is denied access. If not, it continues
PAM passes credentials to an LDAP server with no Two Factor.
At that point, credentials will fail because their LDAP password does not include the token they entered. However, PAM runs one final script to email the user and our SysAdmins to let them know the PI servers are down and LDAP only login has been enabled. The assumption is they will try again, but this time only enter their LDAP credentials. The PAM process will start over again, but the final PAM LDAP module will allow them in.