how to make astyanax prefer local DC?

113 views Asked by At

I know that Astyanax has options to make it only use the local DC, but according to this link, the client will then fail if the nodes in the local DC go down. I was wondering if there was something similar to this (a configuration setting), where requests would go to nodes in the local DC if the data exists on one of the nodes, and only access cross data center nodes when absolutely necessary.

1

There are 1 answers

0
skangayam On

Not a configuration setting, but you could achieve it using the following workaround. Have two drivers initialized driver_dc1 and driver_dc2 in your setup where each one connects to the nodes of the pertinent data center.

try{
    // perform operation using driver_dc1
}catch(ConnectionException e){
    // perform operation using driver_dc2
}