Repository navigation
|
Hello, I am trying to figure out how can I put code of Network topology / Datacenter awareness. Will you please provide me a code example code of Network topology / Datacenter awareness? |
Replies: 4 comments
|
Hi @xianx . I am not sure what you are asking for here. Can you give me more detail. |
|
In db-config.php there is an example of Network topology / Datacenter awareness see the screenshot http://prntscr.com/hwskkp But no explanation how to use it in code with add_db_server function http://prntscr.com/hwsmnw Please help. |
|
The suggested way to handle this is to use db-config & set the servers like: And the setting the read/write accordingly for each datacenter. Thus you can steer traffic within or among multiple datacenters. datacenters are from hyperdb, but is not (fully) implemented in ludicrousdb since it doesn't really make sense as it just complicates stuff & it can be simply set with the read/write priority |
|
There is no separate datacenter API to enable. Add each server to the same logical dataset and use lower $wpdb->add_database( array(
'host' => 'local-replica.example',
'user' => DB_USER,
'password'=> DB_PASSWORD,
'name' => DB_NAME,
'dataset' => 'global',
'write' => 0,
'read' => 1,
) );
$wpdb->add_database( array(
'host' => 'remote-primary.example',
'user' => DB_USER,
'password'=> DB_PASSWORD,
'name' => DB_NAME,
'dataset' => 'global',
'write' => 1,
'read' => 2,
) );Lower positive numbers are tried first; servers at the same priority are shuffled. Deploy priorities appropriate to each application location, or derive them from trusted deployment configuration. The databases still need to be kept synchronized by MySQL or your database platform—LudicrousDB only chooses among them. The refreshed wiki's Network Topology page now documents this directly. |
There is no separate datacenter API to enable. Add each server to the same logical dataset and use lower
readorwritenumbers for the connections that should be preferred in that location:Lower positive numbers are tried first; servers at the same priority are shuffled. Deploy prioritie…