With this configuration, HAProxy will balance the load between two nodes. In this case, it only checks if mysqld listens on port 3306, but it doesn’t take into an account the state of the node. So it could be sending queries to the node that has mysqld running even if it’s in JOINING or DISCONNECTED state.
@johndzilvelis2949
6 жыл бұрын
Outstanding!
@imransaid1026
4 жыл бұрын
Hi, really nice tutorial. While applying HAproxy to my laravel project I keep getting 'MYSQL server has gone away' error and the stats dashboard shows both servers turning on for a few seconds before going down instantly. Any idea what might cause this?
@psvisualdesign
5 жыл бұрын
Very usefull Thank you very much
@ctvoon4321
5 жыл бұрын
Can you provide MeriaDB configuration and haproxy configuration transcript? I'm working on in house database load balancing project. greatly appreciated.
@AlexWoolford
5 жыл бұрын
Here's my haproxy.cfg: gist.github.com/alexwoolford/c39143803f87c5681538579a1e5d74ff I don't have Galera running right now so can't share those properties.
@default_youtube_profile
3 жыл бұрын
Sorry mate all i can say is lol
@AlexWoolford
3 жыл бұрын
Can you elaborate, Sanjay? Is there something wrong with this approach?
@default_youtube_profile
3 жыл бұрын
@@AlexWoolford the disconnection while one of the server goes down , how is that acceptable?
@HichamCHARRAT
3 жыл бұрын
@@default_youtube_profile @Alex Woolford when connecting to a mariadb node1 throught haproxy, your client opened a session to node one, while this connection is still active (didn't close connection after sql query) as the node1 went down, your client didn't try to reconnect to a node (it supposed that your session is still active) and tried the same connection, when it failed it disconnected, and the second attempt was succesful as haproxy directed it to the other node. morality, close mysql connection after each request
@vladimir6993
3 жыл бұрын
Sam my mate, what is wrong with this setup? As Hicham already mentioned, your applications should be aware of transactions and rollbacks. Yes, it is possible to lose a transaction when one node goes down, but it is not a big deal for majority of web apps, just rollback show some errors and try/force again. If you really need a durable ha and cannot deal with rollbacks, stick to Red Hat, Ibm or Amazon. But be prepared to pay much much more a month, than a galera cluster will cost you a year.
@pierrec.dussault2138
2 жыл бұрын
You can keep the transactions in a queue and make sure they are complete and valid before they are popped from the queue. If the type of transaction is very critical, you can make sure to establish a new connection each time and then destroy the connection when the operation is complete. That way each critical transaction is assured to use a connection that hasn't died (or almost assured). In any case I would use a queue system with validation.
Пікірлер: 13