[CONJS-41] Handle multiple server pools with failover capabilities Created: 2018-07-25  Updated: 2018-10-02  Resolved: 2018-10-02

Status: Closed
Project: MariaDB Connector/node.js
Component/s: API, other
Affects Version/s: None
Fix Version/s: 2.0.1-beta

Type: Task Priority: Major
Reporter: Diego Dupin Assignee: Diego Dupin
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to CONJS-22 multiple host Closed

 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();
           });
      });


Generated at Thu Feb 08 03:22:19 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.