In his talk at Symfony Live in Berlin, Benjamin Eberlei mentioned that Doctrine now supports connecting to a Master DB + multiple Slaves.
How do I configure this behaviour in Symfony2?
I searched the web, found some related info but no solution 😐
Via the Symfony Users Mailinglist symfony2 @ googlegroups.com (see thread Re: Doctrine Master Slave Connection in Symfony 2?) I quickly received an answer from Benjamin himself that seemed obvious afterwards 😎
If you use „app/console config:dump-reference DoctrineBundle“ you can see how to configure this.
If you read this where you do not have Symfony 2 and Doctrine at hand, you cann also find it here:
Here’s an extract of just the relevant part:
doctrine: dbal: default_connection: default connections: default: dbname: ~ host: 192.168.23.42 port: ~ user: icanwrite password: ~ slaves: slave1: dbname: ~ host: 192.168.23.43 port: ~ user: icanread password: ~ slave2: dbname: ~ host: 192.168.23.44 port: ~ user: icanread password: ~ staging: dbname: ~ host: localhost port: ~ user: root password: ~
Life can be so easy!
Enjoy full performance!