connect mysql db with master-slave #5544

Closed
opened 2026-01-22 15:10:56 +01:00 by admin · 3 comments
Owner

Originally created by @legend-goat on GitHub (May 21, 2017).

Originally assigned to: @Ocramius on GitHub.

The flowing is my config, i want to use master-slave in doctrine2, but it don't work!

Notice: Undefined index: driver in /mnt/shared/zf3.local/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php on line 119

'orm_passport' => [
                'wrapperClass' => 'Doctrine\DBAL\Connections\MasterSlaveConnection',
                'driverClass' => PDOMySqlDriver::class,
                'params' => [
                    'master'=>[
                        'host'     => '127.0.0.1',
                        'user'     => 'root',
                        'password' => '123456',
                        'dbname'   => 'zf3.com.passport',
                        'charset' => 'utf8',
                    ],
                    'slaves'=>[
                        [
                            'host'     => '127.0.0.1',
                            'user'     => 'root',
                            'password' => '123456',
                            'dbname'   => 'zf3.com.passport',
                            'charset' => 'utf8',
                        ]
                    ],

                ]
            ]

what should i do?

Originally created by @legend-goat on GitHub (May 21, 2017). Originally assigned to: @Ocramius on GitHub. The flowing is my config, i want to use master-slave in doctrine2, but it don't work! > Notice: Undefined index: driver in /mnt/shared/zf3.local/vendor/doctrine/dbal/lib/Doctrine/DBAL/Connections/MasterSlaveConnection.php on line 119 ``` 'orm_passport' => [ 'wrapperClass' => 'Doctrine\DBAL\Connections\MasterSlaveConnection', 'driverClass' => PDOMySqlDriver::class, 'params' => [ 'master'=>[ 'host' => '127.0.0.1', 'user' => 'root', 'password' => '123456', 'dbname' => 'zf3.com.passport', 'charset' => 'utf8', ], 'slaves'=>[ [ 'host' => '127.0.0.1', 'user' => 'root', 'password' => '123456', 'dbname' => 'zf3.com.passport', 'charset' => 'utf8', ] ], ] ] ``` what should i do?
admin added the Invalid label 2026-01-22 15:10:56 +01:00
admin closed this issue 2026-01-22 15:10:57 +01:00
Author
Owner

@AlessandroMinoccheri commented on GitHub (May 21, 2017):

Can you please try to add parameter driver to your master and slave params?

@AlessandroMinoccheri commented on GitHub (May 21, 2017): Can you please try to add parameter driver to your master and slave params?
Author
Owner

@legend-goat commented on GitHub (May 21, 2017):

@AlessandroMinoccheri OK, it works.

@legend-goat commented on GitHub (May 21, 2017): @AlessandroMinoccheri OK, it works.
Author
Owner

@AlessandroMinoccheri commented on GitHub (May 21, 2017):

Perfect! This issue can be closed

@AlessandroMinoccheri commented on GitHub (May 21, 2017): Perfect! This issue can be closed
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5544