'Laravel DB configuration multiple hosts

In Laravel, the database configuration enables to separate DB connection for read and write. And also it supports using multiple hosts for each action(read&write).

'mysql' => [
    'read' => [
        'host' => [
            '192.168.1.1',
            '196.168.1.2',
        ],
    ],
    'write' => [
        'host' => [
            '196.168.1.3',
        ],
    ],
    'sticky' => true,
    'driver' => 'mysql',
    'database' => 'database',
    'username' => 'root',
    'password' => '',
    'charset' => 'utf8mb4',
    'collation' => 'utf8mb4_unicode_ci',
    'prefix' => '',
],

My question here is that when I set up the multiple hosts like above, does the framework equally distribute DB connection to each host or does it use one main host (e.g. the first host (192.168.1.1) of the array) and others as sub host?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source