A method and system for supporting multiple DB applications in a distributed memory database cluster mode

By enhancing the DB configuration items and permission management of access control lists in the distributed in-memory database, the support problem of multi-DB applications in the cluster mode is solved, and efficient and secure data storage and migration are achieved. It is suitable for multi-DB applications in the distributed in-memory database cluster mode.

CN120910030BActive Publication Date: 2025-12-26BEIJING YOUHE RONGYI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511453135.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-13
Publication Date
2025-12-26
Estimated Expiration
2045-10-13

AI Technical Summary

Technical Problem

Existing distributed in-memory databases do not support multi-DB applications in cluster mode, forcing large core systems to adopt sentinel deployment mode, which cannot achieve efficient distributed storage and processing of data.

Method used

Add DB configuration items to the access control list of the distributed in-memory database to enhance the permission control on both the server and client sides. Manage the permissions of multiple DBs through the access control list and perform the migration sequentially according to the DB order configured on the client during data migration.

Benefits of technology

It enables support for multiple database applications in cluster mode, improving the efficiency and reliability of data storage, ensuring the accuracy and security of data migration, and maintaining compatibility with existing client applications without requiring code adjustments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120910030B_ABST
    Figure CN120910030B_ABST
Patent Text Reader

Abstract

The application discloses a method and system for supporting multi-DB application in a distributed memory database cluster mode, comprising: adding a DB configuration item in an access control list of the distributed memory database, the DB configuration item being used for configuring a number of DBs accessible by a role in the access control list; adding a function of reading the DB configuration item on a server side of the distributed memory database, reading the DB configuration item as a list of the number of DBs accessible by the role in the access control list; when a client login application verification is passed, checking the DB configuration item corresponding to the role in the access control list corresponding to the client, and when the client accesses the server side, the client is subjected to permission control of the DB configuration item in the access control list; and in the cluster mode, when the server side of the distributed memory database performs data migration, the migration is sequentially performed according to a DB sequence of the DB configuration item in the access control list corresponding to the client until the data list ends.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] Embodiments of the present disclosure generally relate to the field of distributed memory data management, and more particularly, to a method and system for supporting multi-DB (Database) application in distributed memory database cluster mode. BACKGROUND

[0002] Memory database saves main data in memory to achieve the purpose of high-performance access, but the memory data will be lost with the process instance. In order to solve the risk of losing all data caused by the death of a single instance (single point failure), a distributed memory database is needed to store data in multiple instances.

[0003] The existing distributed memory database products (for example: Redis) have two distributed deployment modes: sentinel mode and cluster mode. The sentinel mode supports multi-DB when deployed, but the traditional distributed memory database products do not support multi-DB when deployed in cluster mode.

[0004] Here, the multi-DB mode refers to that the distributed memory database instance can contain multiple independent databases, each database has an independent key space, and they do not interfere with each other. This mode is similar to the "namespace" in the traditional database, which can be used to simply and efficiently isolate different types of data.

[0005] The existing distributed memory database can create multiple DBs according to the configuration when it is started in the appropriate mode (for example: Redis creates 16 DBs by default, each DB has a unique number, the number is a continuous integer starting from 0, for example, 16 DBs are created, the number is 0 to 15, and different DBs are selected by the number in subsequent use).

[0006] Taking the mainstream product Redis as an example, due to the limitation of the data migration algorithm in cluster mode, it is not possible to accurately control data migration. The data in cluster mode is stored in different nodes in a fragmented manner, and each node only stores part of the data. Therefore, the data is migrated between different nodes according to the configuration adjustment. The data distribution of each node on the cluster is divided into 16384 parts according to the characteristics of the key, called slots, and the slot number is represented by a continuous integer from 0 to 16383. Each instance saves the data of a certain slot number.

[0007] For example, in a cluster of 3 shards, shard 1 instance stores data with slot numbers 0-5461, shard 2 instance stores data with slot numbers 5462-10922, and shard 3 instance stores data with slot numbers 10923-16383. When the slot number range of a certain shard is reduced, the data of the excess slots needs to be migrated to other nodes. The traditional product migrates data according to the slot numbers in the DB. When migration fails, the slot numbers of the data that failed to migrate are recorded. However, if there are multiple DBs, it is difficult to ensure that the data with the same slot numbers in different DBs are migrated at the same time, and the recorded slot numbers are not accurate enough. Therefore, in order to simplify the process, multiple DBs are not supported in the cluster mode. Because the server-side cluster mode does not support multiple DBs, the traditional client program also does not support multiple DBs (DB switching is not provided in the cluster mode).

[0008] The sentinel mode refers to multiple instances distributedly storing all data, each instance only serving as a master or backup to solve the single node deployment single point failure, and a instance called "sentinel" monitoring the operation of each node. The sentinel mode supports multiple DBs when deployed, because each instance in the sentinel mode stores full data, there is no slot number and shard problem, and there is no data migration between different instances according to the slot number. Therefore, there is no complex data migration process in the cluster mode, so multiple DBs can be supported.

[0009] The cluster mode divides all data into multiple parts (i.e. the shards of the cluster, the most common is divided into 3 parts, each part of data is carried by 1 master node and a slave node, i.e. the so-called 3 master 3 slave cluster), each instance only stores the data of one shard. Not only solves the single point failure risk, but also disperses the storage of data to further improve the data support capability (can combine more service instances to store more data), higher processing efficiency (more instances work in parallel) and more reliable data guarantee (single instance failure has less impact on the whole data), so the cluster mode is the preferred deployment mode of large core systems.

[0010] Here, the implementation of multiple DB support in the cluster mode needs to solve: 1. Solve the dependence of data on slot numbers during shard data migration, so that the server side can create multiple DBs in the cluster mode; 2. Let the existing client use multiple DBs in the cluster mode.

[0011] At present, the traditional distributed in-memory database product cancels the support of multiple DBs in the cluster mode based on the traditional design concept and in order to avoid shard data migration problems, and the client application also does not provide DB selection function in the cluster mode. This also leads to the fact that some large core systems currently more suitable for cluster deployment have to adopt the sentinel deployment mode because the cluster mode cannot support multiple DBs. SUMMARY

[0012] A main object of the exemplary embodiments of the present disclosure is to provide a method and system for supporting multi-DB application in a distributed in-memory database cluster mode.

[0013] The first aspect of the present disclosure provides a method for supporting multi-DB application in a distributed in-memory database cluster mode, characterized in that comprising:

[0014] adding a DB configuration item in an access control list of the distributed in-memory database, the DB configuration item being used to configure a number of DBs accessible by a role in the access control list;

[0015] adding a function of reading the DB configuration item in a server end of the distributed in-memory database, the DB configuration item being read as a list of numbers of DBs accessible by the role in the access control list;

[0016] when a login application of a client is verified, checking the DB configuration item corresponding to the role in the access control list corresponding to the client, and when the client accesses the server end, the client is controlled by the DB configuration item in the access control list; and

[0017] in the cluster mode, when the server end of the distributed in-memory database performs data migration, the migration is performed in sequence according to the DB order of the DB configuration item in the access control list corresponding to the client until the end of the data list.

[0018] According to the exemplary embodiments of the present disclosure, the number of DBs accessible by the role is a positive integer starting from 0, and the maximum value is less than the number of DBs created when the server end of the distributed in-memory database is started.

[0019] According to the exemplary embodiments of the present disclosure, the server end reads the role configuration in the access control list through an Authen object, including a list of executable commands (cmd_list), a list of key prefixes of accessible data (pre_list), and a list of numbers of accessible DBs.

[0020] According to the exemplary embodiments of the present disclosure, the checking of the DB configuration item corresponding to the role in the access control list corresponding to the client includes: if there is a DB number list configuration, the smallest value in the list is set as the initial DB of the currently logged-in client.

[0021] According to the exemplary embodiments of the present disclosure, when the login application of the client is verified, the checking of the DB configuration item corresponding to the role in the access control list corresponding to the client includes:

[0022] the client inputs a username and a password to initiate a login application;

[0023] The server reads the username and password entered by the client.

[0024] The server uses the username to look up the corresponding access control list;

[0025] If the user is not found or the password is incorrect, the request will be rejected and an error message will be returned to the client.

[0026] If the user is found and the password verification is successful, then the current access control list will be bound to the current client.

[0027] Check the DB configuration items corresponding to the roles in the access control list. If there is a DB number list configuration, take the smallest value in the list and set it as the initial DB for the currently logged-in client.

[0028] The client logged in successfully, and a success message was returned to the client.

[0029] According to an exemplary embodiment of this disclosure, the permission control of the DB configuration item in the access control list when the client accesses the server includes:

[0030] The client sends an operation request;

[0031] When the server receives a client request, it parses out the database used, operation commands, and access data information, and then calls the access control list to perform a permission check.

[0032] The access control list first determines whether the client has permission to use this database; if not, it returns an error prohibiting the operation.

[0033] The access control list checks whether the operation command is authorized; if not, it returns an error and prohibits the operation.

[0034] The access control list continues to determine whether the data being accessed is authorized; if not, it returns an error prohibiting the operation.

[0035] Execute the client request and return the execution result to the client.

[0036] According to an exemplary embodiment of this disclosure, in cluster mode, when the server side of the distributed in-memory database performs data migration, the migration is performed sequentially according to the DB configuration items in the access control list corresponding to the client until the end of the data list, including:

[0037] Starting from DB0, iterate through each DB, with each DB created when the server-side program starts.

[0038] Within a database, iterate through each data entry starting from the head of the data list;

[0039] First, take the data key and calculate the slot number of the current key;

[0040] If the calculated slot number needs to be migrated, take the expiration time of the data again;

[0041] Determine whether the migration condition is met by judging whether the current data is expired through the expiration time taken;

[0042] If the data meets the migration condition, the data is taken out completely and a data packet is constructed and sent;

[0043] Delete the data that has been successfully migrated in the node;

[0044] Complete the migration of one piece of data, continue to loop and check the subsequent data until the end of the data list.

[0045] The exemplary embodiments of the present disclosure provide a system for supporting multi-DB application in a distributed memory database cluster mode, characterized by comprising: a processor; a memory coupled to the processor and storing instructions that, when executed by the processor, cause the processor to perform the method for supporting multi-DB application in a distributed memory database cluster mode according to the first aspect of the present disclosure.

[0046] The exemplary embodiments of the present disclosure provide a computer program product tangibly stored on a non-transitory computer readable medium and comprising computer readable program instructions that, when executed on a device, cause the device to perform the method for supporting multi-DB application in a distributed memory database cluster mode according to the first aspect of the present disclosure.

[0047] The exemplary embodiments of the present disclosure provide a computer readable storage medium having stored thereon computer readable program instructions for performing the method for supporting multi-DB application in a distributed memory database cluster mode according to the first aspect of the present disclosure. BRIEF DESCRIPTION OF DRAWINGS

[0048] In order to more clearly illustrate the technical solutions of the present application, the following will briefly introduce the drawings needed in the embodiment description. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor.

[0049] Figure 1 It is a workflow diagram of the existing product.

[0050] Figure 2 It is a process diagram after the improvement of the exemplary embodiments of the present application. DETAILED DESCRIPTION

[0051] The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, and not all the embodiments. Based on the embodiments in the present application, all the other embodiments obtained by a person of ordinary skill in the art without creative effort fall within the protection scope of the present application.

[0052] The existing product does not support multiple DBs when deployed in a cluster. In addition, the client does not support DB selection in a cluster mode, which prevents the application program from using multiple DBs.

[0053] Referring to Figure 1 The existing product workflow is shown in FIG. 1. For example, when the server works in a cluster mode, the Redis does not allow the creation of multiple DBs, but only allows the creation of DB0, which is provided for all clients to use. When the client logs in, DB0 is set as the default DB and cannot be switched. The client program does not provide the DB switching function because the server does not support it, and can only use the default DB0.

[0054] In order to realize the function of the traditional client using multiple DBs in the cluster mode of the existing mainstream distributed in-memory database product (the traditional client does not have the DB switching function and does not support the multiple DB feature), the exemplary embodiments of the present application improve the creation of multiple DBs in the server cluster mode.

[0055] Meanwhile, the exemplary embodiments of the present application also enhance the ACL function. On the basis of the original executable operation and accessible data permission function, the client DB permission management is added. When the client logs in, the server can set different initial DBs for the logged-in client according to the ACL DB permission, instead of setting the initial DB as DB0 as in the traditional product, so that different clients can use different DBs when they log in. This is one of the important improvements in the technical implementation of the exemplary embodiments of the present application. In the entire access process of the client, the ACL will also control the DB access permission of the client on the basis of the traditional permission function.

[0056] Figure 2is the workflow after the improvement of the exemplary embodiment of the present application. The technical implementation of the present application supports multiple DB applications on the server side (DB0, DB1, DB2, and multiple DBs are created according to the server configuration when the server starts), enhances the ACL function on the server side, increases the restriction capability of the DB that can be used by the client (dbs configuration is added in the ACL), and sets the current DB of the client as the DB specified by the dbs in the ACL after the login authentication of the client that does not support multiple DBs (DB switching is not supported) is completed, for example, DB1. In this way, the traditional client can use the multiple DB feature of the server side without any modification, that is, the multiple DB use is realized on the premise of transparent client application.

[0057] The exemplary embodiment of the present application provides a method for supporting multiple DB applications in a distributed memory database cluster mode, characterized in that it comprises:

[0058] A DB configuration item is added in the access control list of the distributed memory database, and the DB configuration item is used to configure the number of DBs that can be accessed by the role in the access control list;

[0059] A function of reading the DB configuration item is added on the server side of the distributed memory database, and the DB configuration item is read as a list of the number of DBs that can be accessed by the role in the access control list;

[0060] When the client login application authentication is passed, the DB configuration item corresponding to the role in the access control list corresponding to the client is checked, and the client is controlled by the DB configuration item in the access control list when accessing the server side; and

[0061] In the cluster mode, when the server side of the distributed memory database performs data migration, the migration is performed in the order of the DB configuration item in the access control list corresponding to the client until the end of the data list.

[0062] According to the exemplary embodiment of the present application, the number of DBs that can be accessed by the role is a positive integer starting from 0, and the maximum value is less than the number of DBs created when the server side of the distributed memory database starts.

[0063] According to the exemplary embodiment of the present application, the server side reads the role configuration in the access control list through the Authen object, including a list of executable commands (cmd_list), a list of accessible data key prefixes (pre_list), and a list of numbers of accessible DBs.

[0064] According to the example embodiment of the present disclosure, the DB configuration item corresponding to the role in the access control list corresponding to the client is checked, including: if there is a DB number list configuration, the smallest value in the list is set as the initial DB of the currently logged in client.

[0065] The example embodiment of the present application provides a method for supporting multi-DB application in a distributed memory database cluster mode, mainly including the following improved technologies.

[0066] First, the example embodiment of the present application enhances the function of the existing ACL access control

[0067] ACL (Access Control List) is a list of permissions and access rights of the client, which usually requires a username, password, command list, and accessible key features, etc. Its function is the existing function of the distributed memory database, and the control ability provided includes executable commands and accessible data of the client.

[0068] The existing ACL function of the server side is composed of two parts of role and logged-in user. The permissions are divided into different roles (role), and then different roles (set role id) are granted to each logged-in client user.

[0069] According to the example embodiment of the present disclosure, the access control list further includes a role configuration item, including role id, command list configuration, and prefix configuration of accessible key.

[0070] According to the example embodiment of the present disclosure, the access control list further includes a user configuration item, including user number, username, user password, and role id configuration.

[0071] (1) Each role contains the following items:

[0072] 1. There must be a role id (number), which is an integer code in the configuration, starting from 0, and role 0 corresponds to each item at the beginning of acl.role0 in the configuration.

[0073] 2. There can be a command list configuration, for example, the command list configuration item of role 0 is named "acl.role0.cmd_list", and its content is the allowed executable command, which can be configured with multiple items, each item is separated by a comma ",". If there is no such configuration, this role does not limit the executable command.

[0074] 3、Can have the prefix configuration of the accessible key, for example, the prefix configuration item name of the key of the accessible data of the role 0 is "acl.role0.key_prefix", the content is the key prefix, can configure multiple items, each item is separated by comma ",". If there is no such configuration, the data access of this role is not limited.

[0075] (II) The login user configuration contains the following items:

[0076] 1、Must have a user number, which is an integer code in the configuration, starting from 0, user 0 corresponds to the items at the beginning of WebSession.user0 in the configuration, user0 represents the configuration of the user with number 0.

[0077] 2、Must have a username, for example, the user with number 0, the configuration item name is "WebSession.user0.username", which is the username input by the client when logging in.

[0078] 3、Must have a user password, for example, the user with number 0, the configuration item name is "WebSession.user0.password", which is the password input by the client when logging in (the password in the configuration is SM3 algorithm encrypted ciphertext).

[0079] 4、Must have the configuration of role id, for example, the user with number 0, the configuration item name is "WebSession.user0.role_id", the value is the role id, which corresponds to the role code in the foregoing configuration.

[0080] (III) The example embodiment of the application adds DB permission function on the basis of traditional ACL

[0081] The example embodiment of the application adds DB permission function on the basis of traditional ACL function, which is specifically explained as follows:

[0082] 1、Increase the dbs configuration in the role configuration, which is used to configure the number of DBs that the role can access, the legal number is a positive integer starting from 0, and the maximum value is less than the number of DBs created when the server starts (according to the configuration when the server starts).

[0083] Because the ACL function supports the server to work in sentinel mode and cluster mode, and the mainstream application can support multiple DB operation ability in sentinel mode, the added dbs configuration supports configuring multiple DB numbers, and multiple numbers are separated by comma ",". For example: dbs=4, 5.

[0084] The following is the code of the configuration example of the example embodiment of the application.

[0085] acl.roles=3 / / Total number of roles in the current configuration, a total of 3 roles are configured, namely role0, role1, and role2.

[0086] acl.role0.cmd_list=info, config, memory / / Command list allowed for role0, allowing execution of info and other 3 commands.

[0087] acl.role0.dbs=0, 1, 2 / / List of DB numbers allowed for role0, the current configuration allows clients with role0 to use DB0, DB1, and DB2 (these DBs are pre-created when the server starts).

[0088] acl.role1.cmd_list=get, set, sadd, sismember, hset, hget / / Command list allowed for role1, allowing execution of get, set, and other commands.

[0089] acl.role1.dbs=1 / / List of DB numbers allowed for role1, the current configuration only allows clients with role1 to operate on DB1.

[0090] acl.role2.key_prefix=aa / / Prefix of the key allowed for role2, the current configuration allows clients with role2 to operate on keys starting with aa, such as aa1, aa2, aaa, etc.

[0091] acl.role2.dbs=2 / / List of DB numbers allowed for role2, the current configuration only allows clients with role2 to operate on DB2.

[0092] WebSession.users=2 / / Number of users in WebSession, the current configuration indicates a total of two users.

[0093] WebSession.user0.username=u1 / / Login username of user0 (user0) in WebSession is "u1".

[0094] WebSession.user0.password=6E0F9E14344C5406A0CF5A3B4DFB665F87F4A771A31F7EDBB5C72874A32B2957 / / The login password of the user numbered 0 (user0) in WebSession, which is encrypted by SM3 algorithm for security consideration. The password configured here is the SM3 encrypted password.

[0095] WebSession.user0.role_id=1 / / The role owned by the user numbered 0 (user0) in WebSession. The user named "u1" owns the role numbered 1 (role1) under the current configuration. According to the configuration of role 1 (acl.role1.dbs=1) above, the user "u1" can use the data of DB1. When the user "u1" logs in, the working DB will be set to DB1. If the role owned by the user has multiple dbs configured, the DB with the smallest code in the list will be set as the DB used by the user after login, for example: acl.role1.dbs=1,2,3. The program will find the DB (DB1) corresponding to the smallest number 1 from the list as the DB used by the user after login.

[0096] WebSession.user1.username=u2 / / The login username of the user numbered 1 (user1) in WebSession is "u2".

[0097] WebSession.user1.password=6E0F9E14344C5406A0CF5A3B4DFB665F87F4A771A31F7EDBB5C72874A32B2957 / / The login password of the user numbered 1 (user1) in WebSession, which is encrypted by SM3 algorithm for security consideration. The password configured here is the SM3 encrypted password.

[0098] WebSession.user1.role_id=2 / / The role owned by the user numbered 1 (user1) in WebSession. The user named "u2" owns the role numbered 2 (role2) under the current configuration. According to the configuration of role 2 (acl.role2.dbs=2) above, the user "u2" can use the data of DB2. When the user "u2" logs in, the working DB will be set to DB2.

[0099] acl.role0.dbs, acl.role1.dbs and acl.role2.dbs are the newly added DB configurations for the ACL control.

[0100] 2. The server-side ACL module adds the function of reading the dbs configuration, and reads the dbs configuration as the list of the numbers of the DBs accessible by the current role.

[0101] The Authen object in the program is used to read the role configuration in the ACL. The existing program reads the executable command list (cmd_list) and the key prefix list (pre_list) of the accessible data respectively. The exemplary embodiment of the present application improves the object, and adds the db list function. The Authen object analyzes and saves the above configurations when the instance is created. The exemplary code is as follows:

[0102] /

[0103] The Authen object is created according to the role configuration of the ACL.

[0104]

[0105] @param db_list The list of the numbers of the DBs allowed to use.

[0106] @param cmd_list The command list usable by the role.

[0107] @param pre_list The list of the key prefixes of the data operable by the role.

[0108] /

[0109] Authen(String db_list, String cmd_list, String pre_list) {

[0110] / / Analyze and save the usable command list.

[0111] if (cmd_list!= null &&!"NULL".equalsIgnoreCase(cmd_list)) { / / Judge whether the current role is configured with the usable command list. If the operation command list is not empty, it is configured with the operation command list, and the operation command needs to be controlled.

[0112] AuthedCommand = new HashSet<>(200); / / Create a HashSet collection object.

[0113] String[] cmds = cmd_list.split("[ \t] ,[ \t] / / Use commas to separate the string, splitting the command string into multiple commands.

[0114] for (String cmd : cmds) { / / Loop through the list of commands.

[0115] if (cmd.charAt(0) == '+') { / / Commands that start with a plus sign indicate that an actionable command has been added.

[0116] cmd = cmd.substring(1); / / Remove the leading "+".

[0117] if (cmd.charAt(0) == '@') { / / Determine if the command starts with @. Configurations starting with @ are command groups, and the part after @ is the group name. (For Redis-based products) predefine command groups such as @write, @read, @slow, and @admin, which can be used directly when configuring roles.

[0118] Commands.addCommands(AuthedCommand, cmd); / / cmd is a command group. It takes all commands from the corresponding command group from the Commands object and adds them to the list.

[0119] } else {

[0120] AuthedCommand.add(cmd); / / cmd is a command, add the command to the list.

[0121] }

[0122] } else if (cmd.charAt(0) == '-') { / / The command starts with a minus sign, indicating that it is a delete command.

[0123] cmd = cmd.substring(1); / / Remove the leading "-".

[0124] if (cmd.charAt(0) == '@') { / / Determine if the command starts with @. Configurations starting with @ are command groups, and the part after @ is the group name. (For Redis-based products) predefine command groups such as @write, @read, @slow, and @admin, which can be used directly when configuring roles.

[0125] Commands.removeCommands(AuthedCommand, cmd); cmd is a command group. This method retrieves all commands from the corresponding command group in the Commands object and removes them from the list.

[0126] } else {

[0127] AuthedCommand.remove(cmd); / / cmd is a command, remove the command from the list.

[0128] }

[0129] } else { / / The absence of "+" or "-" indicates that the "+" has been omitted, and an operation that allows the use of commands has been added.

[0130] if (cmd.charAt(0) == '@') { / / Determine if the command starts with @. Configurations starting with @ are command groups, and the part after @ is the group name. (For Redis-based products) predefine command groups such as @write, @read, @slow, and @admin, which can be used directly when configuring roles.

[0131] Commands.addCommands(AuthedCommand, cmd); / / cmd is a command group. It takes all commands from the corresponding command group from the Commands object and adds them to the list.

[0132] } else {

[0133] AuthedCommand.add(cmd); / / cmd is a command, add the command to the list.

[0134] }

[0135] }

[0136] }

[0137] } else { / / The input cmd_list parameter is empty, which means that there is no need to restrict the operation commands.

[0138] AuthedCommand = null; / / Set the command list to empty.

[0139] }

[0140] / / Analyze and save the key prefix of accessible data.

[0141] if (pre_list!= null &&!pre_list.isEmpty() &&!" ".equals(pre_list)) { / / The key prefix configuration is not empty, indicating that the accessible data prefix is configured, and access data needs to be controlled.

[0142] String[] pres = listSplit(pre_list); / / Split the key prefix list of strings into a key prefix string array.

[0143] KeyPres = new byte[pres.length][]; / / Create a two-dimensional byte array to save the key prefix.

[0144] for (int i = 0; i < pres.length; ++i) { / / Loop to read the key prefix.

[0145] KeyPres[i] = pres[i].getBytes(StandardCharsets.UTF_8); / / Convert the key prefix string to a byte array according to utf-8 encoding and save it.

[0146] }

[0147] } else { / / The key prefix configuration is empty.

[0148] KeyPres = null; / / Set the key prefix object to null.

[0149] }

[0150] / / Analyze and save the allowed DB number.

[0151] if (db_list!= null &&!"NULL".equalsIgnoreCase(db_list)) { / / Determine if the db number configuration is not empty, indicating that the accessible DB number list is configured, and the used DB needs to be controlled.

[0152] int min = MAX_TABLES + 1; / / Intermediate variable to calculate the minimum value in the list of db numbers. To facilitate the calculation of the minimum value, an initial value is set to be large enough.

[0153] String[] dbs = db_list.split("[ \t] ,[ \t] "); / / Split the list of db numbers by "," and divide the string into an array of strings, each item in the array is a number.

[0154] AuthedTable = new HashSet<>(dbs.length); / / Create a HashSet collection object

[0155] for (String cmd : dbs) { / / Loop through each number after splitting.

[0156] try {

[0157] int tab = Integer.parseInt(cmd) + 1; / / Convert the number of strings to an integer.

[0158] if (tab >= 0 && tab <= Configuration.getServerTables()) { / / Determine if the current number meets the requirements, the number must be greater than or equal to "0" and less than or equal to the number of DBs created on the server side.

[0159] if (min > tab) { / / Determine if the recorded minimum value is greater than the current number.

[0160] min = tab; / / The recorded minimum value is greater than the current number, update the minimum value.

[0161] }

[0162] AuthedTable.add(tab); / / The current number has been determined to be a legal configuration, add it to the DB authorization list.

[0163] }

[0164] } catch (Throwable t) {

[0165] }

[0166] }

[0167] MinTable = min; / / Use global variable MinTable to record the smallest number in the DB authorization number list.

[0168] } else {

[0169] MinTable = 1; / / The smallest number is 1 (here is an internal variable, and the DB number in the configuration is +1, that is, DB0 corresponds to MinTable = 1).

[0170] AuthedTable = null; / / Set the DB authorization to null.

[0171] }

[0172] }

[0173] According to the exemplary embodiments of the present disclosure, when the client login application of the distributed memory database is verified, the role corresponding to the DB configuration item in the access control list corresponding to the client is checked, including:

[0174] The client inputs a username and password to initiate a login application;

[0175] The server reads the username and password input by the client;

[0176] The server uses the username to find the corresponding access control list;

[0177] If the user is not found or the user password is incorrect, the client is rejected and an error message is returned;

[0178] If the user is found and the password verification is successful, the current access control list is bound to the current client;

[0179] Check the DB configuration item corresponding to the role owned by the access control list, if there is a DB number list configuration, take the smallest value in the list as the initial DB of the current login client;

[0180] The client login is successful, and the client success information is returned.

[0181] 3. When the client login application, input the username and password, the server gets the username and password input by the client, first uses the username to find the corresponding ACL item in the ACL manager, if the corresponding item is found, the password in the ACL is matched with the user input password, if the matching is successful, the verification is passed, and the client use environment (including the DB used after connection) is set, the processing flow is as follows:

[0182] (1) The client inputs a username and password to initiate a login application;

[0183] (2) The server reads the username and password input by the client;

[0184] (3) The server uses the username to find the corresponding ACL;

[0185] (4) If the user is not found or the user password is incorrect, the server rejects and returns error information to the client;

[0186] (5) If the user is found and the password verification is successful, the current ACL is bound to the current client;

[0187] (6) The roles corresponding to the dbs configuration in the ACL are checked. If there is a DB number list configuration, the smallest value in the list is set as the initial DB of the currently logged-in client. This step is newly added after the improvement of the exemplary embodiment of the present application;

[0188] (7) The client logs in successfully, and the client success information is returned.

[0189] The following is a code snippet for the server to process the client login in the exemplary embodiment of the present application:

[0190] AclAuthen acl = AccessController.auth(user, password); / / The server matches the correct AclAuthen object according to the username and password input by the client. The AccessController.auth method first finds the corresponding AclAuthen instance according to the username. If the corresponding AclAuthen is not found, null is returned. If the corresponding AclAuthen is found, the user password is matched. If the password is correct, the AclAuthen is returned. If the password matching is incorrect, null is returned.

[0191] if (acl!= null) { / / The acl variable is not empty, indicating that the username and password input by the client pass the verification, and the correct AclAuthen object is obtained.

[0192] AddressRestrictions.authSuccessed(((InetSocketAddress) ctx.channel().remoteAddress()).getAddress()); / / Record the current client address.

[0193] attribute.setAuthed(true); / / Set the client login success.

[0194] result.setAcl; / / Associate the current client with the correct AclAuthen object.

[0195] int min_db = acl.getMinTable(); / / Gets the minimum DB number configured in the current Acl.

[0196] if (min_db > MAX_TABLES) { / / Check if the smallest number is valid.

[0197] ctx.writeAndFlush("-ACL failed: No db available"); / / No database is configured in ACL, returning an error message to the client.

[0198] return false;

[0199] }

[0200] result.setTableId(min_db); / / The minimum valid number is set as the initial database for the current connection.

[0201] attribute.setAcl; / / Associates an ACL object with the attribute.

[0202] if (isAuth) { / / Whether to return client information.

[0203] ctx.writeAndFlush("OK"); / / Returns a successful login message to the client.

[0204] }

[0205] logger.infoLog("RedisAdapter::channelRead() User {} from '{}' authenok"

[0206] , user, ctx.channel().remoteAddress()); / / Log the message.

[0207] return true;

[0208] According to an exemplary embodiment of this disclosure, the permission control of the DB configuration item in the access control list when the client accesses the server includes:

[0209] The client sends an operation request;

[0210] The server receives the client request, parses the used DB, operation command, access data information, and then calls the access control list for permission check.

[0211] The access control list first judges whether the client has the right to use the DB, and returns an error to prohibit operation if not.

[0212] The access control list judges whether the operation command is authorized, and returns an error to prohibit operation if not.

[0213] The access control list continues to judge whether the accessed data is authorized, and returns an error to prohibit operation if not.

[0214] The client request is executed, and the execution result is returned to the client.

[0215] 4. The client successfully logged in will be controlled by the ACL permission when accessing the server, and the existing mainstream application (for example, Redis) can only control the operation command and access data of the client, but the improved ACL of the exemplary embodiment of the application has the permission control of using the DB, and the new control process is as follows:

[0216] (1) The client sends an operation request.

[0217] (2) The server receives the client request, parses the used DB, operation command, access data, etc., and then calls the ACL for permission check.

[0218] (3) The ACL first judges whether the client has the right to use the DB, and returns an error to prohibit operation if not, which is newly added in the application.

[0219] (4) The ACL judges whether the operation command is authorized, and returns an error to prohibit operation if not.

[0220] (5) The ACL continues to judge whether the accessed data is authorized, and returns an error to prohibit operation if not.

[0221] (6) The client request is executed.

[0222] (7) The execution result is returned to the client.

[0223] The following is a code segment for implementing the permission control of the ACL in the exemplary embodiment of the application:

[0224] /

[0225]

[0226] @param table_id Client's current access table number, corresponding to the DB number in the configuration table_id = db_id +1, so table_id is an integer greater than or equal to 1.

[0227] @param cmd Client's current command.

[0228] @param key Client's access data key value.

[0229] @return true: authentication success; false: authentication failure.

[0230] /

[0231] public boolean authentication(int table_id, String cmd, byte[] key) {

[0232] if (AuthedTable!= null && table_id > 0 &&!AuthedTable.contains(table_id)) { / / AuthedTable is not empty, indicating that DB access needs to be restricted, table_id is in AuthedTable, which is allowed to use, not in AuthedTable, indicating that the current access table has no permission, which needs to be rejected.

[0233] / / db is not in the allowed list.

[0234] return false; / / return authentication failure.

[0235] }

[0236] / / cmd is empty, do not do operation command authentication.

[0237] if (cmd!= null && AuthedCommand!= null &&!AuthedCommand.contains(cmd)) { / / AuthedCommand is not empty, indicating that the client's operation command needs to be verified, and the operation command is in AuthedCommand, which is allowed to execute, and not in AuthedCommand, which needs to be rejected.

[0238] / / command is not in the allowed list.

[0239] return false; / / Returns that verification failed.

[0240] }

[0241] / / No authentication is performed when keys are empty, based on the key prefix.

[0242] if (key == null) { / / Check if the key of the data being operated on by the client is empty. If it is empty, it means that the client has not operated on any data, so there is no need to verify data permissions. Return verification success directly.

[0243] / / No need to check the prefix.

[0244] return true; / / Returns that the verification was successful.

[0245] }

[0246] if (KeyPres == null) { / / If KeyPres is null, it means that data permission verification is not required, and success is returned directly.

[0247] / / No need to check the prefix.

[0248] return true; / / Returns that the verification was successful.

[0249] } else {

[0250] return authentication_keys(key); / / Determines whether the key is allowed. Returns success if allowed, otherwise returns authentication failure.

[0251] }

[0252] }

[0253] II. Implementing Multiple Databases in Product Cluster Mode

[0254] This exemplary embodiment of the invention improves the way traditional distributed in-memory databases (such as Redis) store data. Data is no longer stored by slot number, thus avoiding the problem of mutual interference between multiple databases when migrating data sequentially by slot number between different cluster shards. This exemplary embodiment of the invention also improves the ability of the server to create multiple databases (DB0, DB1, DB2, etc.) according to configuration when starting in both sentinel and cluster modes.

[0255] The exemplary embodiments of the present invention adopt the technical solution of the present invention application. The client can maintain its original usage habits and use the multi-DB feature without making any code adjustments, without affecting the implementation of existing clients and future clients.

[0256] The technical scheme of the exemplary embodiment of the present application realizes multi-DB support of a distributed memory database product in a cluster mode, makes up for the deficiencies of similar existing products, and provides a more efficient and safer multi-DB deployment mode. Meanwhile, the present application is fully compatible with existing client application modes, and the client can be used without any changes, and multi-DB use can be realized without the need for active support of multi-DB and / or DB switching.

[0257] According to the exemplary embodiment of the present application, in a cluster mode, when the server end of a distributed memory database performs data migration, migration is sequentially performed according to the DB order of the DB configuration item in the access control list corresponding to the client until the end of the data list, including:

[0258] Starting from DB0, each DB is created when the server end program is started;

[0259] In one DB, each piece of data is traversed from the head of the data list;

[0260] The key of the data is first taken and the slot number of the current key is calculated;

[0261] If the calculated slot number needs to be migrated, the expiration time of the data is taken again;

[0262] It is determined whether the current data is expired according to the taken expiration time to determine whether the migration condition is met;

[0263] If the data meets the migration condition, the data is completely taken out and a data packet is constructed and sent;

[0264] The data that has been successfully migrated is deleted in the node;

[0265] One piece of data migration is completed, and subsequent data is continuously checked in a loop until the end of the data list.

[0266] In the exemplary embodiment of the present application, when the server end performs data migration, migration is sequentially performed from DB0 according to the DB order until all DBs are completed. The data in each DB uses the same slot number algorithm and the same migration processing logic. The core process of data migration is as follows:

[0267] (1) Starting from DB0, each DB is created when the server end program is started;

[0268] (2) In one DB, each piece of data is traversed from the head of the data list;

[0269] (3) The key of the data is first taken and the slot number of the current key is calculated;

[0270] (4) If the calculated slot number needs to be migrated, take the expiration time of the data again;

[0271] (5) Determine whether the migration condition is met by judging whether the current data is expired according to the taken expiration time;

[0272] (6) If the data meets the migration condition, the data is taken out completely, a data packet is constructed, and the data packet is sent;

[0273] (7) The data that has been successfully migrated is deleted in the node;

[0274] (8) One piece of data migration is completed, and subsequent data is continuously checked in a loop until the data list ends.

[0275] The following is a code segment for actually migrating data in the DB according to an exemplary embodiment of the present application:

[0276] /

[0277] When the sharding configuration of a Cluster is changed, data is migrated between Cluster groups,

[0278]

[0279] This method can only be called when DumpBuf is invoked.

[0280]

[0281] @param moved_slots The data that needs to be migrated.

[0282] @param conn A connection to the target group.

[0283] @param table The original location of the data, used to delete the local data after migration.

[0284] @param table_id The table name, corresponding to the table configuration in cfg.xml.

[0285] @return The execution status, if an exception needs to be returned, it must be greater than 1. 0: normal; 2: the key to be migrated is too large.

[0286] @throws IOException

[0287] /

[0288] public int moveClusterData(byte[] moved_slots, ClusterNodeConnection conn, CacheTable table, int table_id, boolean needDel) throws IOException {

[0289] long timestamp = System.currentTimeMillis();

[0290] long max_value_size = Configuration.getMaxValueDuringClusterMigrate(); / / Read the maximum value limit in the configuration, i.e. the maximum migratable data size. When the actual migrated data is greater than this value, migration will be stopped and error code 2 will be returned.

[0291] if (Lock()) { / / Lock the data before operating on it.

[0292] try {

[0293] logger.infoLog("CacheArrayDuplicate::moveClusterData() Begin to moveddata to '{}({})'"

[0294] , conn.getAddress(), conn.getRemoteAddress());

[0295] int begin = ListBegin - 1; / / Get the index of the first data item at the beginning of the list. The current value of ListBegin is the question of preparing to insert the next data item, so ListBegin - 1 is the first valid data item.

[0296] int count = 0; / / Count counter.

[0297] for (int i = 0; i < LengthOfList; i++) { / / Iterate through the entire list, where LengthOfList is the total length of the list.

[0298] if (begin < 0) {

[0299] begin += LengthOfList; / / begin is out of range, so it will start at the other end of the array.

[0300] }

[0301] / / Determine if all data has been traversed.

[0302] if (!isInList(ListBegin, ListEnd, begin)) { / / isInList checks if there is data at the current index; returns "true" if there is data, and "false" if there is no data.

[0303] break; / / if isInList returns "false" to indicate that the data has been traversed, exit the loop.

[0304] }

[0305] byte[] bkey = Array.getBytes(COLUMN_KEY_OFFSET, begin); / / Get the key of the data at the begin position.

[0306] int slot = CRC16.getSlot(bkey); / / According to the key taken to calculate the slot number, it can be seen that data storage is not associated with slot number, which is more flexible compared with traditional product migration.

[0307] if (moved_slots[slot] > 0 &&!Array.valueIsEmpty(begin)) { / / Judge whether the slot number corresponding to the current data needs to be migrated, moved_slots is a 16384-item array, each item of which corresponds to the state of a slot: 0 is a slot that does not need to be migrated; 1 is a slot that needs to be migrated, moved_slots[slot] > 0 indicates that the data corresponding to begin needs to be migrated.

[0308] String key = Array.getString(COLUMN_KEY_OFFSET, begin); / / Take the key in string form.

[0309] long value_len = Array.getDataLength(COLUMN_VALUE_OFFSET, begin); / / Take the total length of the data.

[0310] if (value_len > max_value_size) { / / Judge whether the data is larger than the maximum migratable data size, if it is larger than the maximum migratable data size, terminate migration and return error code 2.

[0311] logger.warnLog("CacheArrayDuplicate::moveClusterData() Found the bigkey '{}'({}) is bigger then {}", key, value_len, max_value_size);

[0312] return 2; / / The data has exceeded the maximum size of the migratable data, terminate migration and return error code 2.

[0313] }

[0314] long data_time = Array.getLong(COLUMN_TIMESTAMP_OFFSET, begin); / / Take the update time of the current data.

[0315] String data_time2 = Array.getString(COLUMN_TIMESTAMP2_OFFSET, begin); / / Take the expiration time of the current data.

[0316] if (!isExpired(Array.getLong(COLUMN_TIMESTAMP2_OFFSET, begin),timestamp)) { / / Determine if the current data is expired, in order to save network loans, only data that has not expired will be migrated.

[0317] ArrayList <string>value = new ArrayList<>(); / / ArrayList object user organization data sending, subsequent commands will add the current data to this object respectively to prepare for sending.

[0318] value.add(data_time2);

[0319] value.add(Array.getRescueString(COLUMN_VALUE_OFFSET, begin));

[0320] Vector <string>idxs = Array.getIndexes(begin);

[0321] / / buf format: crt_time cmd table_id key upd_time combo_value index1index2...

[0322] ArrayList data = new ArrayList();

[0323] data.add(0);

[0324] data.add(data_time);

[0325] data.add("sync_cluster");

[0326] data.add(table_id);

[0327] data.add(key);

[0328] data.add(value);

[0329] data.add(idxs);

[0330] / / Send to asynchronous, to speed up the synchronization.

[0331] / / At the same time, the receiving end no longer returns any information.

[0332] conn.send(data);

[0333] ++count; / / Send successful count.

[0334] }

[0335] if (needDel) { / / Determine whether the data needs to be deleted from the current node after the data is sent successfully. In some cases, it does not need to be deleted, specified by the parameter needDel.

[0336] try {

[0337] table.del(key, data_time + 1); / / Data migration is successful, delete from the current shard.

[0338] } catch (Throwable e) {

[0339] logger.warnLog(e, "CacheArrayDuplicate::moveClusterData() error whendelete: {}", e);

[0340] }

[0341] }

[0342] logger.debugLog("CacheArrayDuplicate::moveClusterData() Move {} to{}", key, conn);

[0343] if (count % 100 == 0) { / / Output an info log for every 100 records executed.

[0344] logger.infoLog("CacheArrayDuplicate::moveClusterData() Move {} datato {}", count, conn.getAddress());

[0345] }

[0346] }

[0347] begin--; / / Moves the current data index forward, allowing the loop to continue only for new data.

[0348] }

[0349] } finally { / / When the loop terminates.

[0350] Unlock(); / / Releases the lock.

[0351] }

[0352] }

[0353] return 0; / / Returns a successful migration flag.

[0354] }

[0355] An exemplary embodiment of this disclosure provides a system supporting multiple database applications in a distributed in-memory database cluster mode, characterized in that it includes: a processor; and a memory coupled to the processor and storing instructions, which, when executed by the processor, cause the processor to perform a method for supporting multiple database applications in a distributed in-memory database cluster mode according to the above disclosure.

[0356] An exemplary embodiment of the present disclosure provides a computer program product tangibly stored on a non-transitory computer readable medium and comprising computer readable program instructions that, when executed on a device, cause the device to perform a method of supporting multi-DB application in distributed in-memory database cluster mode according to the present disclosure described above.

[0357] An exemplary embodiment of the present disclosure provides a computer readable storage medium having stored thereon computer readable program instructions for performing a method of supporting multi-DB application in distributed in-memory database cluster mode according to the present disclosure described above

[0358] The term "comprising" and variations thereof as used herein are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements is not necessarily limited to those elements, but can include other elements not expressly listed or inherent to such process, method, article, or apparatus. The term "based on" is intended to cover "based at least in part on" and "based at least in part on". The term "one embodiment" is intended to mean "at least one embodiment" such that when a feature is described in "one embodiment", that particular feature is included in at least one embodiment. The term "another embodiment" is intended to mean "at least one additional embodiment" such that when a feature is described in "another embodiment", that particular feature is included in at least one additional embodiment. Other definitions will be apparent from the description that follows.

[0359] The methods and functions described in this disclosure can be performed, at least in part, by one or more hardware logic components. Exemplary types of hardware logic components that can be used include, but are not limited to, a field-programmable gate array (FPGA), an application-specific integrated circuit (ASIC), an application-specific standard product (ASSP), a system-on-a-chip (SOC), a complex programmable logic device (CPLD), etc.

[0360] The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium can be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium include the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or punched tape, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.

[0361] Computer readable program instructions described herein can be downloaded to respective computing / processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and / or a wireless network. The network can comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and / or edge servers. A network adapter card or network interface in each computing / processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing / processing device.

[0362] Computer readable program instructions for carrying out operations of the present disclosure can be assembler instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++ or the like, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer readable program instructions can execute entirely on the user's computing device, partly on the user's computing device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device or entirely on the remote computing device or server. In the latter scenario, the remote computing device can be connected to the user's computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or the connection can be made to an external computing device, for example, through the Internet using an Internet Service Provider. In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) can execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present disclosure.

[0363] The computer readable program instructions described herein can be downloaded to respective computing / processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and / or a wireless network. The network can comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and / or edge servers. A network adapter card or network interface in each computing / processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing / processing device.

[0364] These computer readable program instructions can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks. These computer readable program instructions can also be stored in a computer readable storage medium that can include a non-transitory computer readable storage medium that can be a computer readable storage medium that does not include propagation media. The instructions can be stored in a computer readable storage medium that can be implemented in any method or technology for storage of information, including magnetic storage media, optical storage media, solid-state storage media, and others. The instructions can also be stored in the computer readable storage medium that can be a computer program product, which can be implemented by a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process to achieve the functions / acts specified in the flowchart and / or block diagram block or blocks.

[0365] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable data processing apparatus, or other device implement the functions / acts specified in the flowchart and / or block diagram block or blocks.

[0366] The flow diagrams and the block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flow diagrams and the block diagrams can represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical functions (‘instruction(s)’). In some alternative implementations, the functions noted in the block can occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks can sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and / or flow diagrams, and combinations thereof, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and

[0367] Furthermore, while operations are depicted in the drawings in a particular, chronological order, this should not be understood as requiring or implying that the operations be performed in that order - and that all illustrated operations be performed to achieve desirable results. In certain circumstances, multitasking and parallel processing can be advantageous. Likewise, while several specific implementation details are contained in the above discussion, these should not be construed as limitations on the scope of the present disclosure. Certain features that are described in the context of separate implementations can also be implemented in combination in a single implementation. Conversely, various features that are described in the context of a single implementation can also be implemented in subcombination or as separate implementations in accordance with the application.

[0368] Those skilled in the art can clearly understand that the present application can be implemented by other structures through the above description of the embodiments of the present application, and the features of the present application are not limited to the above preferred embodiments. Any changes or modifications that can be easily thought of by those skilled in the art within the technical field of the present application should be covered by the patent protection scope of the present application.< / string> < / string>

Claims

1. A method for supporting multiple database applications in a distributed in-memory database cluster mode, characterized in that, include: Add a DB configuration item to the access control list of the distributed memory database. The DB configuration item is used to configure the number of DBs that roles in the access control list can access. Add a function to the server side of the distributed memory database to read the DB configuration items, and use the DB configuration items as a list of DB numbers that roles can access in the access control list; When the client login application of the distributed memory database is verified, the DB configuration item corresponding to the role in the access control list of the client is checked, and the client is subject to the permission control of the DB configuration item in the access control list when accessing the server. as well as In cluster mode, when the server side of the distributed in-memory database performs data migration, the migration is performed sequentially according to the DB configuration items in the access control list corresponding to the client until the data list is exhausted.

2. The method for supporting multiple database applications in a distributed in-memory database cluster mode according to claim 1, characterized in that, The databases accessible to the role are numbered as positive integers starting from 0, with a maximum value less than the number of databases created when the distributed memory database server starts.

3. The method for supporting multiple database applications in a distributed in-memory database cluster mode according to claim 1 or 2, characterized in that, The server reads the role configuration in the access control list through the Authen object, including the list of executable commands, the list of key prefixes for accessible data, and the list of database numbers that can be accessed.

4. The method for supporting multiple database applications in a distributed in-memory database cluster mode according to claim 1 or 2, characterized in that, Check the DB configuration item corresponding to the role in the access control list of the client, including: if there is a DB number list configuration, take the smallest value in the list and set it as the initial DB of the currently logged-in client.

5. The method for supporting multiple database applications in a distributed in-memory database cluster mode according to claim 1 or 2, characterized in that, When a client login request to the distributed in-memory database is successfully verified, the DB configuration items corresponding to the role in the client's access control list are checked, including: The client enters its username and password to initiate a login request; The server reads the username and password entered by the client. The server uses the username to look up the corresponding access control list; If the user is not found or the password is incorrect, the request will be rejected and an error message will be returned to the client. If the user is found and the password verification is successful, then the current access control list will be bound to the current client. Check the DB configuration items corresponding to the roles in the access control list. If there is a DB number list configuration, take the smallest value in the list and set it as the initial DB for the currently logged-in client. The client logged in successfully, and a success message was returned to the client.

6. The method for supporting multiple database applications in a distributed in-memory database cluster mode according to claim 1 or 2, characterized in that, The access control provided by the client to the server is subject to the permission control of the DB configuration items in the access control list, including: The client sends an operation request; When the server receives a client request, it parses out the database used, operation commands, and access data information, and then calls the access control list to perform a permission check. The access control list first determines whether the client has permission to use this database; if not, it returns an error prohibiting the operation. The access control list checks whether the operation command is authorized; if not, it returns an error and prohibits the operation. The access control list continues to determine whether the data being accessed is authorized; if not, it returns an error prohibiting the operation. Execute the client request and return the execution result to the client.

7. The method for supporting multiple database applications in a distributed in-memory database cluster mode according to claim 1 or 2, characterized in that, In cluster mode, when the server-side of the distributed in-memory database performs data migration, the migration is executed sequentially according to the DB configuration items in the client's access control list until the end of the data list, including: Starting from DB0, iterate through each DB, with each DB created when the server-side program starts. Within a database, iterate through each data entry starting from the head of the data list; First, retrieve the key of the data and calculate the slot number of the current key; If the calculated slot number needs to be migrated, then retrieve the expiration time of this data. The expiration time is used to determine whether the current data has not expired and whether it meets the migration conditions. If the data meets the migration criteria, then the entire data entry is retrieved, a data packet is constructed, and the data is sent. Delete data that has been successfully migrated within this node; Once a data migration is complete, continue checking subsequent data in a loop until the data list is finished.

8. A system supporting multiple database applications in a distributed in-memory database cluster mode, characterized in that, include: processor; A memory, coupled to the processor and storing instructions, which, when executed by the processor, cause the processor to perform a method for supporting multi-DB applications in a distributed in-memory database cluster mode according to any one of claims 1-7.

9. A computer program product tangibly stored on a non-transient computer-readable medium and comprising computer-readable program instructions that, when executed on a device, cause the device to perform a method for supporting multi-DB applications in a distributed in-memory database cluster mode according to any one of claims 1-7.

10. A computer-readable storage medium having computer-readable program instructions stored thereon, the computer-readable program instructions being used to perform a method for supporting multi-DB applications in a distributed in-memory database cluster mode according to any one of claims 1-7.

Citation Information

Patent Citations

  • ACL configuration method, device, equipment and medium

    CN115242493A

  • Application of non-triggering type access control list, and method for synchronizing rules of access control list

    CN1697422A