Multi-DB config for replication (master/slave)

I have one web server which will be connecting to two database servers set up with 256 databases in a master/slave configuration. I have installed wordpress, set up my network, placed the multi-db files in their proper location and the configuration seems to be lost on me, which is embarrassing due to the fact that I am a web developer and intermediate server admin.

Both servers are on the same network (same data center). Here are my questions:

1. Do I simply duplicate the add_db_server calls for the slave server with different host information and the write flag set to 0?

2. Can I get a clear definition of the HOST and LAN_HOST arguments in the add_db_server function? The values in the sample config seem reversed to my understanding (host being external IP and lan_host being internal IP).

Any help or examples you can shoot my way would be very helpful :slight_smile:

  • Barry
    • DEV MAN’s Mascot

    Answering the two questions separately:

    Do I simply duplicate the add_db_server calls for the slave server with different host information and the write flag set to 0?

    Yes - if you want to prioritise reads from the slave then set the read value for those to 1, and those for the dbs on the master to a higher number e.g. 2 or 5 - doesn't matter with a single master / slave, but that number will be more important when you add more slaves.

  • Barry
    • DEV MAN’s Mascot

    Can I get a clear definition of the HOST and LAN_HOST arguments in the add_db_server function? The values in the sample config seem reversed to my understanding (host being external IP and lan_host being internal IP).

    If both server are in the same datacentre then you can ignore them and put the same IP / address in both.

    If the server is in the same datacentre the plugin will use LAN_HOST, if it isn't it will use HOST

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.