24 Comments

  1. Thank you so much, it works perfectly
    I had already a 3 nodes Galera cluster installed but I did not have a load balance. HAProxy solved the problem!

    1. Author

      Everton,

      I have deleted your previous comment. BTW, I have made some correction to the post to disable SELINUX.

  2. What hapen if galera1 down..??

    Can I have another arbitrator on different data center?? and how to do that..

    thx…

    1. Author

      Please refer my reply to you on other comment.

      You can have arbitrator in different data center but it is not recommended due to connectivity issue. Group of servers in a cluster should be working together under one internal network to get best performance and availability.

  3. Hi SecaGuy.

    What will hapen if galera1 Down??

    1. Author

      if galera1 down, mysql still accessible on galera2. if galera1 then up, then it will sync to the cluster team and data from galera2 will be sync to galera1. But make sure, galera must be run on at least 3 nodes and more which is in this case we have 4 galera nodes, 2 garbd and 2 real galera cluster to avoid split brain.

      1. i have try your tutor step by step.. as you said in this tutotial.

        you’re corect if galera2 goes down.. and then up again it will sync to galera1..

        i try shutdown galera1 and then start it again. but when it come up, galera1 not syncing with other.. maybe because this setting on galera1 ??

        wsrep_cluster_address=”gcomm://”

        right??

        1. Author

          Since you know that galera2 has the latest data which can be refer to, you can use galera2 as reference node. So, login to galera2 and change the gcomm URL to gcomm:// and in galera1, change the URL to gcomm://192.168.0.172:4567. Now onwards, galera2 will be the reference point. Dont forget to change garbd gcomm address as well to the new reference node.

          1. Hi SecaGuy!

            Here is a quote from the codership wiki:
            “Only use empty gcomm:// address when you want create a NEW cluster. Never use it when you want to reconnect to the existing one.”

            I finally tried the galera but only the galera replication I didn’t setup the HAproxy. I just want to play a little with galera and after that I will install HAproxy.

            This is what I tried:
            -I shutted down the node 1, the one with the gcomm:// address.
            -I wrote some change in the database with my node 2.
            -I started the node 1, it didn’t replicate with the other nodes but that’s normal
            -I configured the node 1 as a joiner, so I changed the gcomm url with gcomm://ip_node2
            -restart mysql for the change and node 1 up -> replication works!

            At the end, I didn’t change the gcomm address in the node 2, still gcomm://ip_node1. And that works. We only have to use this “gcomm://” during the first setup. After that Galera doesn’t care about which node is the referent. The only thing we have to do is to select a node with the latest data, no matter which one.

            Are you agree with those statements?

            Cheers!

          2. Sorry for the flood.

            I did a mistake with my previous comment. I just forgot that my topology has 3 nodes, this is why I don’t need to switch with this gcomm:// address. Actually the third node tells to the cluster that there is something wrong with the cluster and avoid the split-brain.

            My mistake :(

        2. Author

          One more thing, if galera1 network is down but the mysql is still up, you do not need to change the reference point. Whenever the network available, it will sync to the cluster. That is what I meant on previous comment. So in case of some network congestion happened between cluster team, you got nothing to do.

          If in galera1 mysql is down, once it up, you cant use that as reference point anymore. Thats why you need to change the refernce node.

  4. Thank you for this useful post.

    Why don’t you use tungsten for the replication?
    Any opinion on tungsten vs galera?

    Cheers!

    1. Author

      For me, the main reason I am using galera is because easy to expand. You just need to install a new server and point the gcomm URL to the reference node and the new node will know the role automatically. For Tungsten, you need to specify what role it will be on the new node, then it will work accordingly.

      1. Thank you for your quick answer :)
        You’r right KISS and easy to scale.

        I’ll try that!

        Cheers ;)

  5. Some contribution:
    I finished my cluster project as shown on this diagram: http://i.imgur.com/m0BQb.png

    This cluster avoids split-brain too and uses only 3 machines.
    I don’t know if the performance is better or worse than post’s approach.

  6. Congratulations documentation!

    Also is needed install rsync e open default port 444 in firewall for replication to new nodes.

    Marcelo Dieder

  7. bro, i tried to simulate a HA test with this galera mysql cluster, what i do is when i stop the mysql services on galera1 node it’s still be able to connect to the db but when i started back the services in galera1 it doesn’t sync with the galera2. when i tried to do this simulation on galera2 it works and sync with galera1 when i started the services on galera2. is there any part that i have done wrong on the configuration on the test simulation? thanks bro

    1. Author

      This is because galera1 is the reference node. The reference node data cannot be outdated from the cluster group communication.

      Galera2 down, no problem because reference node is galera1 so once up, galera2 will get the latest schema update from galera1. If galera1 down, you need to change the galera1 gcomm URL to galera2. Now, galera2 is the reference point so galera1 can get the latest update from galera2.

  8. Is it possible to load keepalived and HAproxy all on each of the 3 galera nodes instead of having two separate servers?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>