By Ankit Sahu
I’ve two load balancer each containing EC2 instances from different regions. Primary region has Read-write DB & secondary has read-only replica of primary DB.
There are also 2 record sets in Route 53 which are configured with load balancer such that whenever a user hits my website, the traffic is distributed among these two load balancer in 70:30
Why I’m opting for read-only? so that i just have to update one DB and the changes are synced across the slaves.
When I update my website with admin url, there is a 30% chance that I am connected to the read-only DB, hence I’ll get server error as the DB gets locked.
What I’m looking for:
Is it possible to route my traffic to the read-write DB whenever someone accesses admin url, eg:www.example.com/admin should always hit my primary server, so that the any write operation is done in my read-write DB only.
I’m using Apache server with mysql DB.
Source: Stack Overflow