Thank you Dmitriy for your response.
The HaProxy config is something like this:
```
listen db_master
bind 0.0.0.0:3306
balance first
option mysql-check
server server-1 server-1.with.the.fqdn check inter 5s downinter 15s fastinter 2s resolvers cluster id 1
server server-2 server-2.with.the.fqdn check inter 5s downinter 15s fastinter 2s resolvers cluster backup id 2
server server-3 server-3.with.the.fqdn check inter 5s downinter 15s fastinter 2s resolvers cluster backup id 3
listen db_slave
bind 0.0.0.0:3308
balance roundrobin
option mysql-check
server server-1 server-1.with.the.fqdn check inter 5s downinter 15s fastinter 2s resolvers cluster id 3 backup
server server-2 server-2.with.the.fqdn check inter 5s downinter 15s fastinter 2s resolvers cluster id 1 weight 10
server server-3 server-3.with.the.fqdn check inter 5s downinter 15s fastinter 2s resolvers cluster id 2 weight 10
```
In my service's configuration file, I set slave_connection to use port 3308. As I checked, when we define slave_connection, the oslo_db handles the read request but in my test environment, it seems does not work.
Hey,
You pretty much can not do this kind of setup with HAProxy, as HAProxy
can balance MySQL only on L4, while for spreading reads/writes you
need more of L7 balancer.
With MariaDB specifically, I'd suggest checking on MaxScale - but keep
in mind, that it has a BSL license right now. So it's not _really_
opensource project.
Also, you can check on ProxySQL, which does understand Galera
clustering as well, and can balance requests accordingly as well.
вт, 18 февр. 2025 г. в 15:23, Mia <mikasa.ack1618@gmail.com>:
>
> Hi OpenStack community,
>
>
> I'm currently working on read/write database splitting in my OpenStack environment using this document: https://docs.openstack.org/large-scale/journey/configure/database.html#reverse-proxy-configuration
>
>
> Here is what I've done up to this point:
>
> - Configured HAProxy as recommended
>
> - Added the slave_connection parameter to all service configurations(nova.conf, cinder.conf, etc.)
>
>
> To test this, I enabled MariaDB's general_log on all nodes. However, upon checking the logs, most SELECT queries still reach the first database node instead of the other replicas.
>
>
> Did I miss a configuration step somewhere?
>
>
> Any guidance would be super helpful.
>
>