how to use redis master-slave config in zf3? #5560

Closed
opened 2026-01-22 15:11:16 +01:00 by admin · 1 comment
Owner

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

Originally assigned to: @Ocramius on GitHub.

i used master-slave mysql in zf3 as following:

'connection' => [
    'orm_passport' => [
                'wrapperClass' => 'Doctrine\DBAL\Connections\MasterSlaveConnection',
                'params' => [
                    'driver' => 'pdo_mysql',
                    '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',
                        ]
                    ],

                ],
]
 'entitymanager' => [
            'orm_passport' => [
                'connection' => 'orm_passport',
                'configuration' => 'orm_passport',
            ],
            'orm_board' => [
                'connection' => 'orm_board',
                'configuration' => 'orm_board',
            ]
        ],

'driver' => [
            __NAMESPACE__ . '_driver' => [
                'class' => AnnotationDriver::class,
                'cache' => 'array',
                'paths' => [__DIR__ . '/../src/Entity']
            ],
            'orm_default' => [
                'drivers' => [
                    __NAMESPACE__ . '\Entity' => __NAMESPACE__ . '_driver'
                ]
            ]
        ]

i don't know how to used in redis connection. i viewed the document , but also have no idea.

Originally created by @legend-goat on GitHub (May 28, 2017). Originally assigned to: @Ocramius on GitHub. i used master-slave mysql in zf3 as following: ``` 'connection' => [ 'orm_passport' => [ 'wrapperClass' => 'Doctrine\DBAL\Connections\MasterSlaveConnection', 'params' => [ 'driver' => 'pdo_mysql', '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', ] ], ], ] 'entitymanager' => [ 'orm_passport' => [ 'connection' => 'orm_passport', 'configuration' => 'orm_passport', ], 'orm_board' => [ 'connection' => 'orm_board', 'configuration' => 'orm_board', ] ], 'driver' => [ __NAMESPACE__ . '_driver' => [ 'class' => AnnotationDriver::class, 'cache' => 'array', 'paths' => [__DIR__ . '/../src/Entity'] ], 'orm_default' => [ 'drivers' => [ __NAMESPACE__ . '\Entity' => __NAMESPACE__ . '_driver' ] ] ] ``` i don't know how to used in redis connection. i viewed the document , but also have no idea.
admin added the InvalidQuestion labels 2026-01-22 15:11:16 +01:00
admin closed this issue 2026-01-22 15:11:17 +01:00
Author
Owner

@Ocramius commented on GitHub (May 28, 2017):

Closing: this is not an issue related to the ORM.

Also, you don't really use a master/slave redis setup unless you are doing a ridiculous amount of cache operations, for which redis already had appropriate load distribution tools.

@Ocramius commented on GitHub (May 28, 2017): Closing: this is not an issue related to the ORM. Also, you don't really use a master/slave redis setup unless you are doing a ridiculous amount of cache operations, for which redis already had appropriate load distribution tools.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#5560