1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Connecting client application to MariaDB Galera cluster

Discussion in 'Programming/Internet' started by user3607758, Oct 8, 2018.

  1. user3607758

    user3607758 Guest

    I currently have a REST API written in Flask that connects to a MariaDB server. I'm thinking about replacing the server with a Galera cluster to improve availability and ensure continuity in case one of the nodes goes down. What I'm having trouble understanding is how client applications connect to the cluster itself. As I'm currently only using a single database server, I can connect using the following code:

    engine = create_engine('mysql://username:password@hostaddress/database_name)


    If I were to have three nodes in the cluster with the addresses 192.168.1.1, 192.168.1.2 and 192.168.1.3 how would I connect the application to the cluster? I assume that it would be possible to replace the current hostname value with one of the node IPs e.g. 192.168.1.1 but I'd imagine that if I did that and that node went down, the application would no longer be able to connect to the cluster because it's specifically trying to connect to that one node. How can I ensure that the application continues to function if a node fails?

    I'm still new to the idea of Galera cluster so apologies if I've misunderstood something about how it works. Any advice would be much appreciated.

    Login To add answer/comment
     

Share This Page