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

    • Task
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • None
    • 2.0.1-beta
    • API, other
    • 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

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

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.