主权项 |
1. A method, comprising:
receiving, at a network device, a session request from an application; determining a session globally unique identifier (GUID) for a session and returning the session GUID to the requesting application; receiving, at the network device, a connection request from the application for performing at least one data read or data write operation, wherein the connection request includes the session GUID and an application identifier (ID) associated with the application; determining a session key (X) by performing one or more operations upon one or more digits of the session GUID; determining a total number (Y) of database (DB) nodes, of a plurality of database nodes, available for handling connections from the application; determining a DB ID by applying a modulo operation to the determined session key (X) and the determined total number (Y) of available DB nodes; indexing a routing table, with the DB ID and the application ID, to retrieve contents of a status field that indicates whether a first database node, of the plurality of database nodes, is accepting connections for read/write sessions; selectively retrieving, when indexing the routing table with the DB ID and the application ID, a database connection string from a primary connection string field or from a secondary connection string field in the routing table, based on whether the retrieved contents of the status field indicates that the first database node is accepting connections for read/write sessions,
wherein if the database connection string is retrieved from the primary connection string field in the routing table then the first database node comprises a primary database node for handling read/write sessions with the application, andwherein if the database connection string is retrieved from the secondary connection string field in the routing table then a second database node, that is different than the first database node, comprises a backup, secondary database node for handling read/write sessions with the application, and transmitting, to the application, a network address, of the first database node from the primary connection string field or the second database node from the secondary connection string field, for the application to perform the at least one data read or data write operation with the first database node or the second database node. |