Uploaded image for project: 'MariaDB Connector/node.js'
  1. MariaDB Connector/node.js
  2. CONJS-41

Handle multiple server pools with failover capabilities

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0.1-beta
    • Component/s: API, other
    • Labels:
      None

      Description

      Permit using Master/slave implementation, with failover capability
      see the mysql reference documentation https://www.npmjs.com/package/mysql#poolcluster.

      Cluster handle pools with according to patterns and handle failover / distributed load (round robin / random / ordered ).

      Example :

          const cluster = mariadb.createPoolCluster();
          cluster.add("master1", {...connection options...});
          cluster.add("slave1", {...connection options...});
          cluster.add("slave2", {...connection options...});
       
          cluster.getConnection(/^slave*$, "RR")
            .then(conn => {
              return conn.query("SELECT 1")
                 .then(row => {
                     conn.end();
                     return row[0]["@node"];
                 })
                 .finally(() => {
                     conn.end();
                 });
            });
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              diego dupin Diego Dupin
              Reporter:
              diego dupin Diego Dupin
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: