Database authority management method and device based on fdb
By collecting and caching user information in the database, real-time and consistency of database permission management is achieved, the problems of data consistency and performance losses in the database cluster are solved, the performance and security of the database are improved, and scalability and flexibility are supported. sex.
Patent Information
- Application Number
- CN202411613117.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2024-12-13
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
When database clusters ensure the consistency of user data and permission information, resource consumption is high and it is difficult to ensure data consistency, and performance losses are serious due to network transmission and read-write conflicts.
Adopt the database permission management method based on fdb, collect administrator and user information through the management database, store it into the fdb database, and store user information in the form of k-v to realize local cache management, authenticate and modify, and update it to the cluster simultaneously Other nodes within it to avoid frequent interaction with storage services.
Improves database performance and data consistency, reduces network load, simplifies permission management process, enhances security and scalability, supports a variety of data models and query methods, and is easy to maintain and upgrade.
Smart Images

Figure CN119128835A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of database management, and in particular to a database authority management method and device based on FDB. Background Art
[0002] In order to ensure the consistency of user data and permission information, database clusters usually use local storage to record user data and permission information on all nodes. When a user operates on this information, the operating node usually notifies all nodes in the cluster through messages to update the locally stored information. In this way, each node in the cluster needs to store data, consumes resources, and data consistency is difficult to ensure.
[0003] In addition, you can also use a unified storage method and deploy the storage service on one node. All database service nodes share this data storage. If you need to modify the information, notify the storage node through a message to make the modification. When reading this information, you can directly obtain it from the storage service. This can better ensure data consistency, but the performance loss caused by network transmission and read-write conflicts is more serious. Summary of the invention
[0004] The present invention aims to solve at least one of the technical problems existing in the related art. To this end, the present invention provides a database authority management method and device based on fdb.
[0005] The present invention provides a database authority management method based on fdb, comprising: S1: Collecting administrator information and user information corresponding to a user database, and storing the administrator information and the user information in a management database; S2: The management database reads the user information and writes the user information into a local cache to obtain cache data; S3: managing the user database through the cache data.
[0006] According to a fdb-based database authority management method provided by the present invention, the administrator information in step S1 includes administrator data and management authority information, and the user information includes user data and user authority information.
[0007] According to the fdb-based database authority management method provided by the present invention, the user information in step S1 is stored in the form of kv.
[0008] According to the fdb-based database authority management method provided by the present invention, the management database in step S1 is the fdb database.
[0009] According to the fdb-based database authority management method provided by the present invention, the management of the user database in step S3 includes authentication and modification.
[0010] According to a database authority management method based on FDB provided by the present invention, the step of authenticating the user database specifically includes: S311: receiving a user's SQL statement and determining that the SQL statement is an authentication request; S312: Parse the cache data to obtain user authority information corresponding to the user information; S313: Authenticate the user by parsing the obtained user authority information. When the authentication succeeds, allow the user to perform the next operation; when the authentication fails, return an authentication failure feedback result to the user.
[0011] According to a database authority management method based on fdb provided by the present invention, the step of modifying the user database specifically includes: S321: receiving a user's SQL statement, and determining that the SQL statement is a modification request; S322: Parse the SQL statement to obtain a modification task; S323: Modify the user information in the local cache according to the modification task to obtain updated user information; S324: The management database synchronizes the updated user information to other nodes in the cluster based on the updated user information sent by the local cache.
[0012] According to a fdb-based database authority management method provided by the present invention, in step S324, the management data synchronizes the updated user information to other nodes in the cluster through a monitoring mechanism.
[0013] The present invention also provides a database rights management device based on FDB, which is used to execute a database rights management method based on FDB as described in any one of the above items, comprising: Management database writing module: used to collect administrator information and user information corresponding to the user database, and store the administrator information and user information into the management database; Cache writing module: used for reading the user information from the management database and writing the user information into the local cache to obtain cache data; Management module: used to manage the user database through the cache data according to user needs.
[0014] The present invention provides a database authority management method and device based on fdb, which uses foundationDB as a database system for authority management and implements database management operations including authentication, user data modification, user authority modification, etc. through interaction between cache and users. It can not only ensure good scalability, but also ensure the consistency of data synchronization, thereby avoiding interaction with storage services and improving database performance.
[0015] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 It is a flowchart of a database authority management method based on FDB provided by an embodiment of the present invention.
[0018] Figure 2 It is a structural schematic diagram of a database authority management device based on FDB provided by an embodiment of the present invention.
[0019] Reference numerals: 100. Management database write module; 200. Cache write module; 300. Management module. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical scheme and advantages of the present invention clearer, the technical scheme of the present invention will be clearly and completely described below in conjunction with the drawings in the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present invention. The following embodiments are used to illustrate the present invention, but cannot be used to limit the scope of the present invention.
[0021] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the embodiment of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0022] Combine the following Figure 1 to Figure 2 Embodiments of the present invention are described.
[0023] like Figure 1 As shown, the present invention provides a database authority management method based on fdb, comprising: S1: Collecting administrator information and user information corresponding to a user database, and storing the administrator information and the user information in a management database; The administrator information in step S1 includes administrator data and management authority information, and the user information includes user data and user authority information.
[0024] Wherein, the user information in step S1 is stored in kv format.
[0025] Furthermore, the above-mentioned management database, that is, the authority management system of the present invention is implemented based on foundationDB. In this stage, the user data and authority information of the database product are first stored in the corresponding foundationDB server in the form of kv. In addition, when the database product is installed and configured, the administrator is also required to write the initial administrator user and authority information of the database into foundationDB.
[0026] Wherein, the management database in step S1 is the fdb database.
[0027] The present invention uses foundationDB as the permission management system because foundationDB is a distributed database system designed to process large-scale structured data. The database runs on a multi-node commercial server cluster and organizes data in the form of ordered key-value pairs. It can complete both read / write intensive workloads and write performance efficiently. In addition, it has good fault tolerance and can ensure data integrity and availability when a failure occurs. Its distributed architecture allows data to be replicated and distributed on multiple nodes, thereby improving the reliability and availability of the system.
[0028] S2: The management database reads the user information and writes the user information into a local cache to obtain cache data; After deploying the corresponding database products on different nodes, user data and permission information are first read from foundationDB and recorded in the cache. When users operate on the library table, they can directly use the cached data for authentication, avoiding interaction with the storage service, thereby improving performance.
[0029] S3: managing the user database through the cache data.
[0030] The management of the user database in step S3 includes authentication and modification.
[0031] The step of authenticating the user database specifically includes: S311: receiving a user's SQL statement and determining that the SQL statement is an authentication request; S312: Parse the cache data to obtain user authority information corresponding to the user information; S313: Authenticate the user by parsing the obtained user authority information. When the authentication succeeds, allow the user to perform the next operation; when the authentication fails, return an authentication failure feedback result to the user.
[0032] Furthermore, the specific authentication process is as follows: after the database process is started, user data and permission information are first read from foundationDB and recorded in the cache; the user executes the SQL statement; permission information is obtained from the cache and authentication is performed. If the authentication is successful, the specific task is executed. If it fails, the failure result is returned to the user.
[0033] The step of modifying the user database specifically includes: S321: receiving a user's SQL statement, and determining that the SQL statement is a modification request; S322: Parse the SQL statement to obtain a modification task; S323: Modify the user information in the local cache according to the modification task to obtain updated user information; S324: The management database synchronizes the updated user information to other nodes in the cluster based on the updated user information sent by the local cache.
[0034] In step S324, the management data synchronizes the updated user information to other nodes in the cluster through a monitoring mechanism.
[0035] Furthermore, the specific process of modifying permission information is as follows: the user of the first node executes the SQL to modify the permission information; the first node sends the modification task to foundationDB; foundationDB modifies the permission information in the storage, and if it fails, returns the result to the first node. If successful, it notifies the second node and all other database product nodes in the cluster to update the cache.
[0036] When a user modifies user data and permission information through SQL statements, the data in the local cache is updated first, and then sent to the foundationDB storage service through a message to modify the data in foundationDB. The modification is notified to other nodes in the cluster through the monitoring mechanism of foundationDB, and the corresponding cache data is modified to ensure the consistency of user data and permission information.
[0037] The present invention also provides a database rights management device based on FDB, which is used to execute a database rights management method based on FDB as described in any one of the above items, comprising: Management database writing module 100: used to collect administrator information and user information corresponding to the user database, and store the administrator information and the user information into the management database; The cache writing module 200 is used to read the user information from the management database and write the user information into the local cache to obtain cache data; Management module 300: used to manage the user database through the cache data according to user needs.
[0038] The present invention provides a database authority management method and device based on FDB. First, by storing user information in a management database, and reading and writing from the management database into a local cache when needed, the present invention can significantly improve the efficiency of data access. At the same time, due to the existence of cached data, it can respond to user requests in real time, ensuring the real-time nature of database management. Second, both administrator information and user information are stored in the management database, which makes authority management more centralized and controllable. The administrator can easily configure and modify the authority of the user database to ensure that only authorized users can access and operate the database, greatly improving the security of the database. Third, due to the use of FDB as the underlying database, the method of the present invention has good scalability. The distributed architecture of FDB enables the database to be easily expanded to cope with the growing data and user requests. In addition, the present invention also supports a variety of data models and query methods, so that users can choose the data storage and retrieval method that best suits them according to actual needs, providing great flexibility; fourthly, by caching user information locally, frequent requests to access remote databases are reduced, thereby reducing network load and improving the overall performance of the system; fifthly, the authority management method of the present invention centrally manages administrator and user information, simplifies the authority management process, and administrators can configure and modify permissions through a unified management interface without having to access user databases one by one to perform operations, greatly improving management efficiency; sixthly, it can be seamlessly integrated with the existing FDB database system without the need for large-scale transformation of the existing system. At the same time, due to the use of standard APIs and protocols, the present invention is easy to maintain and upgrade.
[0039] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A database rights management method based on fdb, characterized in that: include: S1: Collecting administrator information and user information corresponding to a user database, and storing the administrator information and the user information in a management database; S2: The management database reads the user information and writes the user information into a local cache to obtain cache data; S3: managing the user database through the cache data.
2. A database authority management method based on fdb according to claim 1, characterized in that: The administrator information in step S1 includes administrator data and management authority information, and the user information includes user data and user authority information.
3. A database authority management method based on fdb according to claim 1, characterized in that: The user information in step S1 is stored in kv format.
4. A method for managing database rights based on fdb according to claim 1, characterized in that: The management database in step S1 is the fdb database.
5. The method for managing database rights based on fdb according to claim 1, characterized in that: The management of the user database in step S3 includes authentication and modification.
6. A method for managing database rights based on fdb according to claim 5, characterized in that: The steps of authenticating the user database specifically include: S311: receiving a user's SQL statement and determining that the SQL statement is an authentication request; S312: Parse the cache data to obtain user authority information corresponding to the user information; S313: Authenticate the user by parsing the obtained user authority information. When the authentication succeeds, allow the user to perform the next operation; when the authentication fails, return an authentication failure feedback result to the user.
7. The method for managing database rights based on fdb according to claim 5, characterized in that: The step of modifying the user database specifically includes: S321: receiving a user's SQL statement, and determining that the SQL statement is a modification request; S322: Parse the SQL statement to obtain a modification task; S323: Modify the user information in the local cache according to the modification task to obtain updated user information; S324: The management database synchronizes the updated user information to other nodes in the cluster based on the updated user information sent by the local cache.
8. A method for managing database rights based on fdb according to claim 7, characterized in that: In step S324, the management data synchronizes the updated user information to other nodes in the cluster through a monitoring mechanism.
9. A database rights management device based on fdb, used to execute a database rights management method based on fdb as claimed in any one of claims 1 to 8, characterized in that: include: Management database writing module: used to collect administrator information and user information corresponding to the user database, and store the administrator information and user information into the management database; Cache writing module: used for reading the user information from the management database and writing the user information into the local cache to obtain cache data; Management module: used to manage the user database through the cache data according to user needs.
Citation Information
Patent Citations
Method and system for updating cache data of Web node
CN103338243A
Distributed caching method and system, computer equipment and storage medium
CN111159233A
Database management method, system and device, equipment and computer storage medium
CN111737232A
Data processing method, device and system
CN114945026A
Local cache-based api gateway authentication system and method
CN115865415A
