|
This will depend on if you want the database to be updated from both servers. Choose your scenario first and then it will be easier to work out a solution.
Scenario 1 - Database updatable on both. This is where either server will be able to insert, update or delete records
Scenario 2 - Database updatable on only one master server. One server will be able to perform update functions whilst the other server is just in 'browsable' mode - i.e. can only read records.
Scenario 3 - Database updated manually and both servers to be browsable only. In otherwords, your database may be updated remotely by FTP or some other offline database connection, and the users of the database can only browse the data with no facility to insert, update, delete etc.
For S1 you are better off putting the database on the most reliable of the two servers. Continue to access the database from server A, and as the previous poster says, just change the localhost to the IP of the database server and access the data remotely. Note that some mysql installs have a security feature where the database can only be acccessed from the localhost machine. This is to stop cross site attacks on the server - all non remote users should turn this feature on, you will need to turn it off.
S2 is a better option for speed and gives you a bit of database redundancy. Server 1 will be able to update the server, Server 2 will be able to browse only. In this case it's best to synchronise the database so that any changes on server 1 are passed (delayed in time) to server 2. All browsers on server 2 will use the local database faster and if anything goes wrong with server 1 database you have a live backup (although some transactions will be missed depending on the time delay in updating).
S3 is similar to 2 where you just have a replicated database on the second server. Again, speed and redundancy are the benefits here but you will need to sync both databases.
|