How to create a replication database

How to send specific queries to a different database ?, If the default connection is dropped using the connection of the replica.

(The terms primary/replica are traditionally referred to as master/slave in database server documentation)

edited Sep '16

Use different connection $this->db vs $this->db2 (both defined in IoC container)?

Try/Catch somewhere if the primary DB service / connection is N/A, and try with another.

P.S. Usually replica sets are being defined elsewhere, so your application will target only one main entry point (i.e. load balancer).