Multi-tenant distributed file system, request method and device based on gRPC
By designing a multi-tenant distributed file system based on gRPC, the problems of resource isolation and performance fluctuations in traditional systems in a multi-tenant environment are solved, and resource isolation, performance stability and scheduling fairness are achieved.
Patent Information
- Application Number
- CN202411629992.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-02-28
- Estimated Expiration
- 2044-11-15
AI Technical Summary
Traditional distributed file systems have problems such as resource isolation, performance fluctuations, scheduling fairness, hardware bottlenecks, and business impact in a multi-tenant environment.
Design a multi-tenant distributed file system based on gRPC. Through the combination of storage server, registration center, client SDK and metadata storage, it realizes functions such as tenant management, storage management, flow limit control, file synchronization and error statistics to ensure resource isolation and fair performance.
Through this system, resource isolation, stable performance, fair scheduling and efficient utilization of hardware resources in a multi-tenant environment are achieved, reducing business impact.
Smart Images

Figure 00000000_0000_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of file system technology, and in particular to a gRPC-based multi-tenant distributed file system, request method, and device. Background Art
[0002] A distributed file system (DFS) is a file system that allows users on multiple computing nodes to share and access data stored on multiple nodes over a network. This system is designed to address the storage limitations of a single machine and provide high-performance, high-availability, and fault-tolerant data access.
[0003] Although current distributed file systems provide scalability and high availability, in traditional distributed file systems, data management and resource allocation are usually performed on a single tenant basis. This approach has some limitations, such as excessive resource consumption, performance degradation, and data isolation issues. However, in a multi-tenant environment, where multiple users or applications share the same storage resources, there are a series of defects, including resource isolation, performance fluctuations, scheduling fairness, hardware bottlenecks, and business impact. Summary of the invention
[0004] The purpose of this application is to provide a multi-tenant distributed file system, request method and device based on gRPC to solve the above technical problems.
[0005] On the first aspect, the present application provides a multi-tenant distributed file system based on gRPC, the system includes: a storage service end, a registration center, a client SDK and a metadata storage end connected in sequence; the storage service end is also connected to the client SDK and the metadata storage end respectively; the registration center is built based on Zookeeper and is used to store server registration information and disk registration information; the server registration information includes: detailed information of the server cluster; the disk registration information includes: information of the storage servers and disks corresponding to the multiple tenants; the metadata storage end is used to store a variety of information; the various information includes: tenant information, file mapping, file information, master-slave information, synchronization information and configuration information; the storage service end includes multiple storage server clusters, each of which integrates: storage service module, tenant management module, storage management module, current limiting control Module, file synchronization module, disk management module, monitoring management module, error statistics module; each storage server is equipped with hard disk space, and storage service software is deployed, and a WEB access layer is provided to facilitate users to perform file operations on the specified storage server; the client SDK is used to initialize the connection with the registration center after the target tenant logs in; the registration center monitors the Zookeeper node and finds the storage server and disk information accessible to the target tenant from the disk data list; a gRPC connection is created for the accessible storage server to complete the SDK initialization work; respond to the file read and write operation request of the target tenant, determine the target disk under the target storage server in the storage service end based on the data stored in the metadata storage end, and perform the operation corresponding to the file read and write operation request based on the target disk under the target storage server.
[0006] Furthermore, the above-mentioned storage service module is used to process file operation requests from the client SDK and is the server of gRPC; the storage service module is deployed and runs on multiple storage servers, jointly assuming the data storage function of distributed files; the tenant management module is used to provide an isolated, secure, and customizable service environment for different users; it is used to define the upper limit of resources that each tenant can access, including storage capacity, file write rate, and file read rate, to ensure that all tenants can share resources fairly.
[0007] Furthermore, the above-mentioned storage management module includes three management functions for the storage server: enabling or disabling the server, configuring the number of backup copies, and group server settings; the disk management module is used to perform management operations on the disks on the corresponding storage server, and the management operations include: disk registration operations to bind the disks and tenants, and settings of the master disk and the slave disk.
[0008] Furthermore, the above-mentioned file synchronization module is used to automatically manage the data replication process to ensure that the number of copies of each data block meets the preset value; the replication modes adopted by the file synchronization module include: synchronous replication and asynchronous replication; a file or data is copied and saved to multiple storage servers; multiple storage servers are used to respectively save the master copy and multiple slave copies of the file; the master copy is used to push file update data to all slave copies; the current limiting control module is used to control data writing and reading using a token bucket algorithm according to the tenant's configuration policy.
[0009] Furthermore, the above-mentioned error statistics module is used to track and count the statistical data within each preset time, and regularly write the statistical data into the MongoDB database, and display the statistical data on the monitoring page for viewing; the statistical data includes: file read information and file write information; the file read information includes: the number of attempts to read the file, the number of successful completions of reading the file, and the number of file read failures; the file write information includes: the number of attempts to write the file, the number of successful file writes, and the number of file write failures; in the storage service, the system will continue to count the operation errors of each disk; the monitoring management module is used to perform the following monitoring functions: data integrity check, system health monitoring, resource usage, performance monitoring, alarm mechanism, and log monitoring.
[0010] On the second aspect, the present application also provides a gRPC-based multi-tenant request method, which is applied to the client SDK in a gRPC-based multi-tenant file storage system, and the method includes: responding to a login request sent by a target tenant, and initializing a connection with a registration center based on the target tenant information carried in the login request; receiving the storage server and disk information accessible to the target tenant found from the disk data list by the registration center through monitoring the Zookeeper node; creating a gRPC connection to the accessible storage server; responding to the file operation request of the target tenant, and performing the operation corresponding to the file operation request based on the accessible storage server and disk.
[0011] Furthermore, the above-mentioned file operation request includes: a file query request; in response to the file operation request of the target tenant, based on the accessible storage server and disk, the steps of performing the operation corresponding to the file operation request include: calling the file reading API to search for file mapping information in the metadata storage end, and determining the target disk under the target storage server where the file mapping information is located; performing file addressing according to the file mapping information, establishing a connection with the target storage server, and sending gRPC call information for reading the file to the target storage server to obtain file information.
[0012] Furthermore, the above-mentioned file operation request includes: a file write request; in response to the file operation request of the target tenant, based on the accessible storage server and disk, the steps of performing the operation corresponding to the file operation request include: calling the file write API to search for the target disk under the target storage server from the accessible storage servers; writing the file content to the target disk under the target storage server, and storing the file mapping information corresponding to the file content to the metadata storage end; the file mapping information includes: the namespace, the file name and the associated data of the disk.
[0013] Furthermore, the above-mentioned step of searching for the target disk under the target storage server from the accessible storage servers includes: according to the data balance principle, determining the target storage server and the target disk from the accessible storage servers; the method also includes: when the storage server is started, or when the registration center is reconnected, the storage server registers the service with the registration center and writes its running data to the registration center; the running data includes: service IP and service port information; when it is detected that the operation error rate of a certain disk is abnormally increased, it is determined that there is a problem with the disk; redirecting the data access request to another healthy data copy, and establishing it as the new primary copy.
[0014] On the third aspect, the present application also provides a gRPC-based multi-tenant request device, which is applied to the client SDK in the gRPC-based multi-tenant file storage system, and the device includes: an initialization module, which is used to respond to the login request sent by the target tenant, and initialize the connection with the registration center based on the target tenant information carried in the login request; a search module, which is used to receive the storage server and disk information accessible to the target tenant from the disk data list found by the registration center through monitoring the Zookeeper node; a connection module, which is used to create a gRPC connection to the accessible storage server; an operation module, which is used to respond to the file operation request of the target tenant, and perform the operation corresponding to the file operation request based on the accessible storage server and disk.
[0015] In the multi-tenant distributed file system, request method and device based on gRPC provided by the present application, the system includes: a storage service end, a registration center, a client SDK and a metadata storage end connected in sequence; the storage service end is also connected to the client SDK and the metadata storage end respectively; the registration center is built based on Zookeeper and is used to store server registration information and disk registration information; the server registration information includes: detailed information of the server cluster; the disk registration information includes: information of the storage server and disk corresponding to the multiple tenants respectively; the metadata storage end is used to store a variety of information; the various information includes: tenant information, file mapping, file information, master-slave information, synchronization information and configuration information; the storage service end includes multiple storage server clusters, each of which integrates: storage service module, tenant management module, storage management module, flow control module, etc. The system consists of a control module, a file synchronization module, a disk management module, a monitoring management module, and an error statistics module; each storage server is equipped with hard disk space, and the storage service software is deployed, and a WEB access layer is provided to facilitate users to perform file operations on the specified storage server; the client SDK is used to initialize the connection with the registration center after the target tenant logs in; the registration center monitors the Zookeeper node and finds the storage server and disk information that the target tenant can access from the disk data list; a gRPC connection is created for the accessible storage server to complete the SDK initialization work; the target tenant's file read and write operation request is responded to, and the target disk under the target storage server in the storage service end is determined based on the data stored in the metadata storage end, and the operation corresponding to the file read and write operation request is performed based on the target disk under the target storage server. Through the above multi-end settings and functional configuration, the problems of resource isolation, performance fluctuations, scheduling fairness, hardware bottlenecks, and business impact in the existing technology are solved. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0017] Figure 1 A schematic diagram of a gRPC-based multi-tenant distributed file system provided in an embodiment of the present application;
[0018] Figure 2 A schematic diagram of data storage in a registration center provided in an embodiment of the present application;
[0019] Figure 3A flowchart of a gRPC-based multi-tenant request method provided in an embodiment of the present application;
[0020] Figure 4 A schematic diagram of a file reading process provided in an embodiment of the present application;
[0021] Figure 5 A schematic diagram of a file writing process provided in an embodiment of the present application;
[0022] Figure 6 A structural diagram of a gRPC-based multi-tenant request device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0023] The technical solution of the present application will be described clearly and completely below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0024] The purpose of designing a distributed file system is to solve the limitations of traditional single-node file systems in data storage and access. By distributing workloads and storage among multiple nodes, the scalability, performance, and reliability of the system are improved. The key features of a distributed file system are:
[0025] Scalability: Ability to adapt to the increase in storage demand and horizontally expand system capacity by adding more nodes. Data replication: In order to improve data reliability and system fault tolerance, data is usually replicated to multiple nodes. Transparent access: Users can access and manage remote data through standard file system interfaces, just like operating local files. Consistency and synchronization: The system ensures that data remains consistent across all replicas, even in the event of a node failure. Load balancing: Distributed file systems usually include built-in load balancing mechanisms to optimize data access and balance the overall load of the system.
[0026] Popular distributed file systems in the industry include Hadoop Distributed File System (HDFS), Ceph, Google File System (GFS), etc. Although current distributed file systems provide scalability and high availability, in traditional distributed file systems, data management and resource allocation are usually based on a single tenant. This approach has some limitations, such as excessive resource consumption, performance degradation, and data isolation issues. However, in a multi-tenant environment, where multiple users or applications share the same storage resources, there are a series of defects. These mainly include resource isolation, performance fluctuations, scheduling fairness, hardware bottlenecks, and business impacts.
[0027] Data isolation is a logical isolation mechanism that is implemented through permission allocation or isolation based on tags. In a multi-tenant environment, applications of different users may have inconsistent resource requirements, and contention for resources may lead to performance degradation. Due to the complexity of resource allocation and scheduling, the performance of applications may be unstable, bringing uncertainty to the business. In a multi-tenant environment, competition for hardware resources among different processes may lead to low resource utilization. Traditional monitoring systems may not provide enough granularity to track the hardware usage of each process on each node, making performance issues difficult to diagnose and resolve.
[0028] Based on this, an embodiment of the present application provides a distributed file system platform that uses gRPC as a remote call framework. The system is not only easy to operate and user-friendly, but also has multi-tenant functions. The platform uses an integrated Web interface to maintain, manage, and monitor the system, greatly simplifying the expansion management operations of the storage server, allowing users to easily perform operations such as storage expansion, suspending services, or removing servers. In addition, the platform supports multi-tenant management, allowing administrators to configure dedicated capacity space and access restriction policies for different tenants. During the system initialization phase, the number of copies of the file can also be set to ensure high data availability and system reliability.
[0029] To facilitate understanding of this embodiment, a multi-tenant distributed file system based on gRPC disclosed in an embodiment of the present application is first introduced in detail.
[0030] Figure 1 The overall block diagram of a gRPC-based multi-tenant distributed file system provided in an embodiment of the present application includes: a storage service end, a registration center, a client SDK, and a metadata storage end connected in sequence; the storage service end is also connected to the client SDK and the metadata storage end respectively;
[0031] Grpc high-performance remote procedure call protocol is a modern open source high-performance remote procedure call (RPC) framework that can run in any environment. It can efficiently connect services within and across data centers, supporting load balancing, tracking, health checks, and authentication. It is also suitable for the last mile of distributed computing, connecting devices, mobile applications, and browsers to backend services.
[0032] The registration center is built on Zookeeper and is used to store server registration information and disk registration information; server registration information includes: detailed information of the server cluster; disk registration information includes: information of storage servers and disks corresponding to multiple tenants; ZooKeeper is a distributed, open source distributed application coordination service, an open source implementation of Google's Chubby, and an important component of Hadoop and Hbase. It is a software that provides consistency services for distributed applications, and provides functions including: configuration maintenance, domain name services, distributed synchronization, group services, etc.
[0033] Metadata storage end, used to store a variety of information; the various information includes: tenant information, file mapping, file information, master and backup information, synchronization information and configuration information;
[0034] The storage service end includes multiple storage server clusters, each of which integrates: storage service module, tenant management module, storage management module, current limiting control module, file synchronization module, disk management module, monitoring management module, and error statistics module; each storage server is equipped with hard disk space, and deployed with storage service software, and provides a WEB access layer to facilitate users to perform file operations on the specified storage server;
[0035] Client SDK: It is the client of the distributed file system. Applications need to use the client SDK to access the distributed file system. The client SDK runs in applications that need to access the distributed file system. Through configuration, the client SDK can obtain a list of accessible storage services and connect to them, so as to call the functions of reading and writing files to the storage server.
[0036] The storage service end includes multiple clusters of storage servers, each of which is a dedicated computer server designed to provide data storage and management services. These servers are equipped with a large amount of hard disk space and support high-speed data access and transmission. In addition, storage service software is deployed on each storage server and includes a WEB access layer, allowing users to easily view files and perform access statistics on the specified storage server. This architecture ensures the efficiency and manageability of data storage, while providing flexible access control and monitoring capabilities.
[0037] The above client SDK is the client of the distributed file system. Applications need to access the distributed file system through the client SDK of the distributed file system. This SDK runs in the application that needs to access the distributed file system. Through configuration, the client SDK can obtain the corresponding accessible storage service list and connect. Through these connections, functions such as reading files and writing files can be called on the storage server.
[0038] The above-mentioned client SDK is used to initialize the connection with the registration center after the target tenant logs in; receive the storage server and disk information that the target tenant can access from the disk data list found by the registration center through monitoring the Zookeeper node; create a gRPC connection to the accessible storage server to complete the SDK initialization work; respond to the file read and write operation request of the target tenant, determine the target disk under the target storage server in the storage service end based on the data stored in the metadata storage end, and perform the operation corresponding to the file read and write operation request based on the target disk under the target storage server.
[0039] The client SDK is also configured with a service discovery function, which monitors the data of the registration center. Because of this function, it can dynamically sense when the storage server is online or offline. The client SDK also has a data routing function. When performing a file write operation, it will select a suitable storage server and disk for file storage based on the data balance principle. During the writing process, the SDK will also record the associated data of the namespace, file name, and disk into the file mapping information. This file mapping information is then stored in the MongoDB database. When it is necessary to read a file, the SDK will first read the mapping table information from MongoDB to determine the specific location of the file, and then instruct the storage server to perform the file reading operation based on the obtained file path. The entire file data routing process is completed in the client SDK, ensuring efficient and accurate file access.
[0040] The above registration center is built on Zookeeper, which mainly stores two types of key data. The first is server registration information, which contains detailed information about the server cluster, such as IP addresses and service ports. The second is disk registration information, which is actually multi-tenant information and is used to configure the storage space size settings of each tenant. Specifically, the data stored is the information about the storage server and disk corresponding to each namespace. This structure ensures the orderly management and access control of resources in a distributed system.
[0041] When the system starts or reconnects to the registry, the storage service client will register the service with the registry and write its running data to the registry. This includes recording the service IP and service port information to the registry. This process enables the entire distributed environment to know that the service has been launched and can start providing services to the outside world. This registration mechanism ensures that the storage service can be discovered dynamically and improves the scalability of the system.
[0042] The relationship between the above four parts is as follows:
[0043] The storage service end provides independent storage services. Administrators can register two types of information to the registration center through management services. The first type of information is the storage service registration information, namely the aforementioned server registration information; the second type of information is the disk registration information, which is bound to the corresponding tenant information.
[0044] The registration center is similar to a bulletin board. The registration center accepts registrations from storage services and writes the registration information into the bulletin board. It also accepts file operation requests from the client SDK and passes the data from the registration center bulletin board to the SDK. It also provides real-time notifications when there are changes in the data.
[0045] The client SDK is a client that accesses storage and provides a unified access API interface. It obtains the accessible server list and disk list data from the registration center. The client SDK can implement data access routing through metadata storage and access data by calling the storage end.
[0046] The metadata storage end saves metadata, such as multi-tenant configuration information, access control information, and the correspondence information between tenants' data files and disks. These data are generally written to the management service to facilitate data reading by the client SDK.
[0047] In addition, the embodiments of the present application provide a unique storage space configuration method, that is, directly allocating an independent disk to each tenant. This method has significant advantages. Since each disk only serves one tenant, highly accurate data isolation, data access security control, and data reading speed management can be achieved. In addition, this configuration also supports convenient expansion operations.
[0048] In a multi-tenant environment, using the above storage space configuration method in combination with a distributed file system can greatly simplify the access control process. By ensuring that each tenant's data is stored on a separate disk, data interference and potential access restrictions between different tenants are effectively prevented. This storage configuration method has shown significant results in improving data security and management convenience.
[0049] In another embodiment, different levels of permissions such as access permissions and operation permissions can be set to allow authorized tenants to access or operate the disk information of authorized tenants. That is, a tenant can also set access permissions or operation permissions for another tenant to allow the other tenant to access or operate its disk information.
[0050] The gRPC-based multi-tenant distributed file system provided in the embodiment of the present application is a distributed file system platform that uses gRPC as a remote call framework. The system is not only easy to operate and user-friendly, but also has multi-tenant functions. The platform implements maintenance, management and monitoring of the system through an integrated Web interface, which greatly simplifies the expansion management operations of the storage server, allowing users to easily perform operations such as storage expansion, suspension of services or removal of servers. In addition, the platform supports multi-tenant management, allowing administrators to configure dedicated capacity space and access restriction policies for different tenants. During the system initialization phase, the number of copies of the file can also be set to ensure high data availability and system reliability.
[0051] This platform is designed with strict requirements in large-scale environments in mind. Its efficient remote calling capabilities are provided by the gRPC framework, ensuring the speed and efficiency of data transmission. By leveraging the low latency characteristics of gRPC, the platform can quickly respond to various requests, whether it is file operations or system management tasks. At the same time, the multi-tenant architecture ensures efficient isolation and utilization of system resources, ensuring that the performance of each tenant is not affected by the activities of other tenants.
[0052] The multi-tenant distributed file system can effectively save the cost of developing applications while ensuring data security. By reusing resources, the cost of physical machines is reduced. At the same time, since multiple tenants share the core code of the system, only the same core code needs to be upgraded when the system is upgraded, which simplifies the update process.
[0053] The main function of the storage service end is to provide core data storage services. In addition, it also integrates a series of key configuration and management functions. These functions include tenant management, storage and disk resource management, and data backup configuration. In terms of data protection, the storage service end is also responsible for synchronizing data to the backup storage system to ensure data redundancy and security.
[0054] In order to maintain the stability and reliability of the service, the storage service will monitor the errors of service calls in real time and count the error rate within a specific time window. These statistics are then recorded in the metadata storage for analysis and improvement. At the same time, in order to ensure performance optimization, the storage service will also track a series of service performance indicators as monitoring data and display them on the monitoring dashboard, so that administrators can understand the system's operating status in real time and make timely adjustments.
[0055] The following is a detailed description of the multiple modules in the storage service end (storage service module, tenant management module, storage management module, current limiting control module, file synchronization module, disk management module, monitoring management module, and error statistics module):
[0056] (1) The storage service module is used to process file operation requests from the client SDK and is the server of gRPC. The storage service module is deployed and runs on multiple storage servers and jointly undertakes the data storage function of distributed files.
[0057] In actual applications, the storage service module is the core component of the system. It is responsible for processing file operation requests from clients, including file reading, writing, and deletion operations. This service is also the server of gRPC. The storage service is deployed and runs on multiple storage servers. These multiple nodes jointly assume the data storage function of distributed files.
[0058] (2) Tenant management module, which is used to provide an isolated, secure, and customizable service environment for different users; it is used to define the upper limit of resources that each tenant can access, including storage capacity, file write rate, and file read rate, to ensure that all tenants can share resources fairly.
[0059] The tenant management module is a critical part of the multi-tenant architecture. It involves how to effectively provide isolated, secure, and customizable service environments for different users. Define the upper limit of resources that each tenant can access, including storage capacity, file write rate, and file read rate, to ensure that all tenants can share resources fairly.
[0060] (3) Storage management module, including three management functions for storage servers: enabling or disabling servers, configuring the number of backup copies, and group server settings;
[0061] In specific implementation, the storage management module: implements the management function of the storage server, which mainly has three functions. ① Enable or disable the server: the system administrator can set the operating status of each server and choose to enable or disable. When the server needs maintenance or upgrade, it is set to disabled state. At this time, the server no longer processes new file operation requests until it is enabled again. ② Configure the number of backup copies: In order to prevent data loss and improve the fault tolerance of the system, the number of copies of data backup can be set. The system will automatically manage the data replication process according to this setting to ensure that each data block has a sufficient number of copies. ③ Group server settings: In a cluster, certain servers can be designated to serve specific groups, and the roles of the master server and the slave server can be clarified. The master server is responsible for processing the client's write requests and synchronizing data to the slave server, thereby achieving load balancing and failover. When there is a problem with the master server, the slave server can quickly take over to maintain the continuity of the service.
[0062] (4) A disk management module is used to perform management operations on the disks on the corresponding storage server. The management operations include: disk registration operations to bind disks to tenants, and settings of master disks and slave disks.
[0063] The disk management module manages the disks on the storage server and can register the disks and set the master and slave disks. The disk registration function will bind the disks to the tenants, so that the tenants' data is physically isolated.
[0064] (5) A file synchronization module, which is used to automatically manage the data replication process and ensure that the number of copies of each data block meets the preset value; the replication modes adopted by the file synchronization module include: synchronous replication and asynchronous replication; a file or data is replicated and saved to multiple storage servers; multiple storage servers are used to store the master copy and multiple slave copies of the file respectively; the master copy is used to push the file update data to all slave copies;
[0065] In actual applications, the file synchronization module usually stores data on multiple nodes in order to improve data availability and fault tolerance. Automatically manage the data replication process to ensure that the number of copies of each data block meets the preset value, and is divided into two modes of synchronization. ① Synchronous replication: also known as strong consistency replication, requires that all copies are successfully updated before confirming that the write is successful. This method is used for synchronization when there are slave disks and the slave disks are all in a healthy state. ② Asynchronous replication: also known as final consistency replication, allows data consistency to be achieved after a certain period of time. When the slave disk recovers from an error to normal, synchronize the data of the primary disk and collect synchronization in this way.
[0066] In this embodiment, the number of replicas, i.e., the replication factor, is pre-set according to the system requirements and storage strategy. For example, a common practice is to save three replicas to cope with the failure of one or more nodes. A file or data is usually replicated to multiple nodes. This is mainly to improve the reliability of the data and the fault tolerance of the system. The primary replica of the data is responsible for pushing updates to all secondary replicas. This method can quickly update all replicas.
[0067] (6) Current limiting control module, which is used to control data writing and reading using a token bucket algorithm based on the tenant's configuration policy.
[0068] The current limiting control module uses the TokenBucket algorithm to control data writing and reading on the storage service side according to the tenant's configuration policy.
[0069] (7) Error statistics module, used to track and count the statistics within each preset time, and regularly write the statistics to the MongoDB database, and display the statistics on the monitoring page for viewing; the statistics include: file read information and file write information; file read information includes: the number of attempts to read the file, the number of successful completion of the file read, and the number of file read failures; file write information includes: the number of attempts to write the file, the number of successful file writes, and the number of file write failures; in the storage service, the system will continuously count the operation errors of each disk;
[0070] In actual applications, the above error statistics module will track and count the file read and write activities per minute. This includes recording the number of attempts to read the file, the number of successful completions, and the number of failures. With this data, the success rate of reading the file can be calculated. The same method also applies to write operations. The system will count the number of write attempts, successes and failures, and then get the success rate of writing the file. These statistical data will also be written into the metadata for storage.
[0071] When the client SDK detects that the operation error rate of a disk has increased abnormally, it will determine that there may be a problem with the disk. At this time, the SDK will automatically redirect the data access request to another healthy data copy and set it as the new primary copy. This mechanism ensures that the system can continue to operate even if a disk fails, and timely fault detection and recovery are performed to ensure data security and high system availability.
[0072] In the storage service, the system will continuously collect statistics on the operation errors of each disk. These statistics are written to the MongoDB database regularly. At the same time, these statistics can be viewed on the monitoring page, which is convenient for real-time monitoring and management of the operation status of the disk. This mechanism helps to timely discover and deal with potential disk problems and ensure the stable operation of the system.
[0073] (8) Monitoring management module, used to perform the following monitoring functions: data integrity check, system health monitoring, resource usage, performance monitoring, alarm mechanism, and log monitoring.
[0074] The following is a detailed description of the registration center:
[0075] The core of the registration center is based on Zookeeper, which is responsible for maintaining and managing distributed data and metadata in the platform. In this architecture, the storage server writes key configuration and status information to the Zookeeper cluster through the Zookeeper client. This information includes server lists, tenant configuration information, and dynamic mapping of disk resources.
[0076] In order to maintain the real-time and consistency of data, the storage client is responsible for monitoring data changes in Zookeeper. Once it detects that relevant data has been updated, such as a new storage server has been added or the status of an existing server has changed, Zookeeper will immediately notify the storage client. This ensures that the storage client can always access the latest server list information and the disk list information of the corresponding tenant. This registration center design based on Zookeeper not only enhances the scalability and high availability of the system, but also greatly improves the response speed of the entire platform to changes in resource configuration through a real-time data synchronization mechanism. See Figure 2 As shown, the data of the registration center in Zookeeper is divided into two categories:
[0077] 1. Storage node: stores the list information of storage servers. The list of storage servers and their status (such as enabled, disabled) will be recorded in Zookeeper. As long as the storage server is online and running normally, its information will continue to be retained by Zookeeper; if the storage server is disconnected from the network or the service stops abnormally, the corresponding server list information will be automatically removed from Zookeeper.
[0078] 2. Multi-tenant information: Maintains a tenant list containing detailed configuration information for each tenant. This list also specifies the disk list that each tenant has access to, ensuring that tenants can only use the disk resources on the storage server assigned to them.
[0079] The multi-tenant distributed file system based on gRPC provided in the embodiment of the present application is a simple and efficient distributed file system. This system not only supports multi-tenancy, provides strict data isolation for each tenant, but also implements strict read and write security access control to ensure the security and privacy of the data. Therefore, it provides an efficient, reliable and scalable data storage and processing solution, which is very suitable for enterprises or organizations that need to process large amounts of data. Using this technology, significant technical advantages have been achieved in building distributed file systems, including high fault tolerance of the system, strong support for big data, performance optimization and improvement, flexible adaptability in operation and configuration, ensuring data consistency and improving safety performance. In addition, the system also has a disk monitoring function, which can promptly perform fault management when a fault is found, further enhancing the stability and reliability of the system. These features enable distributed file systems to provide efficient and reliable services when dealing with large-scale data storage and access requirements.
[0080] The beneficial effects of this embodiment are as follows:
[0081] 1. Implemented a simple and easy-to-use distributed file system that is completely autonomous and controllable.
[0082] 2. It realizes the management function of multiple tenants and provides a flexible resource allocation mechanism. By allocating resource quotas to each tenant, it can ensure fair use and effective utilization of resources.
[0083] 3. Use independent physical disk space for each tenant, and perform access control and permission control to achieve physical-level data isolation.
[0084] 4. Multi-tenant storage is an indispensable part of modern IT architecture. It can not only improve resource utilization and reduce costs, but also provide users with flexible, reliable and secure services.
[0085] Based on the above system embodiment, the embodiment of the present application also provides a multi-tenant request method based on gRPC, which is applied to the client SDK in the multi-tenant file storage system based on gRPC. The functions of the client SDK include disk routing, access control, storage service discovery, disk discovery and other functions, which realize the reading and writing functions of the distributed file system from the client. Figure 3 As shown, the method comprises the following steps:
[0086] Step S302, responding to the login request sent by the target tenant, and initializing a connection with the registration center based on the target tenant information carried in the login request;
[0087] Step S304, receiving the storage server and disk information accessible to the target tenant found from the disk data list by the registration center through monitoring the Zookeeper node;
[0088] Step S306, creating a gRPC connection to an accessible storage server;
[0089] Step S308, responding to the file operation request of the target tenant, and performing the operation corresponding to the file operation request based on the accessible storage server and disk.
[0090] Furthermore, the above-mentioned file operation request includes: a file query request; responding to the file operation request of the target tenant, based on the accessible storage server and disk, executing the operation corresponding to the file operation request, including: calling the file reading API to find the file mapping information in the metadata storage end, and determining the target disk under the target storage server where the file mapping information is located; performing file addressing according to the file mapping information, establishing a connection with the target storage server, and sending gRPC call information for reading the file to the target storage server to obtain the file information.
[0091] See also Figure 4 As shown, the process of reading a file specifically includes the following steps:
[0092] 1. SDK initialization: Initialize the connection to the registration center based on the configured tenant name, password, and Zookeeper connection address.
[0093] 2. After the Zookeeper connection is completed, monitor the Zookeeper nodes and obtain the data list to obtain the storage servers and disks that the tenant can access.
[0094] 3. Create a gRPC connection to the storage server based on the storage server that the tenant can access. This completes the initialization of the entire SDK.
[0095] 4. After initialization, the user uses the SDK to make API calls for file reading.
[0096] 5. The SDK will search for file mapping information in the metadata to find out which storage server and which disk the specified file is on.
[0097] 6. After obtaining the file mapping information, perform file addressing, obtain the specified storage server connection, and make a gRPC call to the storage server to read the file. After obtaining the file information, the file reading operation is completed.
[0098] Furthermore, the above-mentioned file operation request includes: a file write request; responding to the file operation request of the target tenant, based on the accessible storage server and disk, executing the operation corresponding to the file operation request, including: calling the file write API, searching for the target disk under the target storage server from the accessible storage servers; writing the file content to the target disk under the target storage server, and storing the file mapping information corresponding to the file content to the metadata storage end; the file mapping information includes: the namespace, the file name and the associated data of the disk.
[0099] See also Figure 5 As shown in the figure, the difference between the write file operation and the disk routing is that when the file is written, the disk selection is performed first. After the disk is selected, the file is written to the disk. When writing, the file mapping information is also written to the metadata storage end synchronously.
[0100] That is, the process of writing a file specifically includes the following steps:
[0101] 1. SDK initialization: Initialize the connection to the registration center based on the configured tenant name, password, and Zookeeper connection address.
[0102] 2. After the Zookeeper connection is completed, monitor the Zookeeper nodes and obtain the data list to obtain the storage servers and disks that the tenant can access.
[0103] 3. Create a gRPC connection to the storage server based on the storage server that the tenant can access. This completes the initialization of the entire SDK.
[0104] 4. After initialization, the user uses the SDK to make API calls for writing files.
[0105] 5. The SDK performs disk routing to find which storage server's disk the specified file should be written to.
[0106] 6. Write the content to a file on the target disk;
[0107] 7. Synchronously write the file mapping information to the metadata storage end to complete the file writing operation.
[0108] Furthermore, the above-mentioned step of searching for the target storage server and the target disk from the accessible storage servers includes: determining the target storage server and the target disk from the accessible storage servers according to the data balance principle; the method also includes: when the storage server is started, or when the registration center is reconnected, the storage server registers the service with the registration center and writes its running data to the registration center; the running data includes: service IP and service port information; when it is detected that the operation error rate of a certain disk is abnormally increased, it is determined that there is a problem with the disk; redirecting the data access request to another healthy data copy, and establishing it as the new primary copy.
[0109] Based on the above method embodiment, the present application also provides a gRPC-based multi-tenant request device, which is applied to a client SDK in a gRPC-based multi-tenant file storage system, see Figure 6 As shown, the device includes: an initialization module 62, which is used to respond to the login request sent by the target tenant, and initialize the connection with the registration center based on the target tenant information carried in the login request; a search module 64, which is used to receive the storage server and disk information accessible to the target tenant found from the disk data list by the registration center through monitoring the Zookeeper node; a connection module 66, which is used to create a gRPC connection to the accessible storage server; an operation module 68, which is used to respond to the file operation request of the target tenant, and perform the operation corresponding to the file operation request based on the accessible storage server and disk.
[0110] Furthermore, the above-mentioned file operation request includes: a file query request; an operation module 68, which is used to call a file reading API to search for file mapping information in the metadata storage end, and determine the target disk under the target storage server where the file mapping information is located; according to the file mapping information, perform file addressing, establish a connection with the target storage server, and send gRPC call information for reading files to the target storage server to obtain file information.
[0111] Furthermore, the above-mentioned file operation request includes: a file write request; an operation module 68, which is used to call a file write API to search for a target disk under a target storage server from accessible storage servers; write the file content to the target disk under the target storage server, and store the file mapping information corresponding to the file content to the metadata storage end; the file mapping information includes: namespace, file name and disk association data.
[0112] Furthermore, the above-mentioned operation module 68 is used to determine the target storage server and the target disk from the accessible storage servers according to the data balance principle; the device is also used for: when the storage server is started, or when it is reconnected to the registration center, the storage server registers the service with the registration center and writes its running data to the registration center; the running data includes: service IP and service port information; when it is detected that the operation error rate of a certain disk is abnormally increased, it is determined that there is a problem with the disk; redirecting the data access request to another healthy data copy, and establishing it as the new primary copy.
[0113] The device provided in the embodiment of the present application has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the embodiment of the device, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0114] The device provided in the embodiment of the present application has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the embodiment of the device, reference may be made to the corresponding contents in the aforementioned method embodiment.
[0115] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.
[0116] In the description of the present application, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present application. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0117] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A multi-tenant distributed file system based on gRPC, characterized in that: The system comprises: a storage service end, a registration center, a client SDK and a metadata storage end connected in sequence; the storage service end is also connected to the client SDK and the metadata storage end respectively; The registration center is built based on Zookeeper and is used to store server registration information and disk registration information; the server registration information includes: detailed information of the server cluster; the disk registration information includes: information of storage servers and disks corresponding to multiple tenants respectively; The metadata storage end is used to store a variety of information; the various information includes: tenant information, file mapping, file information, master and backup information, synchronization information and configuration information; The storage service end includes a plurality of storage server clusters, each of which integrates: a storage service module, a tenant management module, a storage management module, a current limiting control module, a file synchronization module, a disk management module, a monitoring management module, and an error statistics module; each of the storage servers is equipped with hard disk space, and the storage service software is deployed, and a WEB access layer is provided to facilitate users to perform file operations on the specified storage server; The client SDK is used to initialize the connection with the registration center after the target tenant logs in; receive the storage server and disk information that the target tenant can access from the disk data list found by the registration center through monitoring the Zookeeper node; create a gRPC connection to the accessible storage server to complete the SDK initialization work; respond to the file read and write operation request of the target tenant, determine the target disk under the target storage server in the storage service end based on the data stored in the metadata storage end, and perform the operation corresponding to the file read and write operation request based on the target disk under the target storage server.
2. The system according to claim 1, characterized in that The storage service module is used to process file operation requests from the client SDK and is the server of gRPC; the storage service module is deployed and runs on multiple storage servers, jointly assuming the data storage function of distributed files; The tenant management module is used to provide an isolated, secure, and customizable service environment for different users; It is used to define the upper limit of resources that each tenant can access, including storage capacity, file write rate, and file read rate, to ensure that all tenants can share resources fairly.
3. The system according to claim 1, characterized in that The storage management module includes three management functions for the storage server: enabling or disabling the server, configuring the number of backup copies, and group server settings; The disk management module is used to perform management operations on the disks on the corresponding storage server, and the management operations include: disk registration operations for binding the disks to tenants, and settings of master disks and slave disks.
4. The system according to claim 1, characterized in that The file synchronization module is used to automatically manage the data replication process to ensure that the number of copies of each data block meets the preset value; The replication modes adopted by the file synchronization module include: synchronous replication and asynchronous replication; a file or data is replicated and saved to multiple storage servers; multiple storage servers are used to respectively save the master copy and multiple slave copies of the file; the master copy is used to push the file update data to all slave copies; The current limiting control module is used to control data writing and reading using a token bucket algorithm according to the tenant's configuration policy.
5. The system according to claim 1, characterized in that The error statistics module is used to track and count the statistical data within each preset time, and regularly write the statistical data into the MongoDB database, and display the statistical data on the monitoring page for viewing; The statistical data includes: file read information and file write information; the file read information includes: the number of attempts to read the file, the number of successful completions of reading the file, and the number of file read failures; the file write information includes: the number of attempts to write the file, the number of successful file writes, and the number of file write failures; in the storage service, the system will continuously count the operation errors of each disk; The monitoring management module is used to perform the following monitoring functions: data integrity check, system health monitoring, resource usage, performance monitoring, alarm mechanism, and log monitoring.
6. A multi-tenant request method based on gRPC, characterized in that: The method is applied to a client SDK in a gRPC-based multi-tenant distributed file system as described in any one of claims 1 to 5, and the method includes: Respond to the login request sent by the target tenant, and initialize the connection with the registration center based on the target tenant information carried in the login request; Receiving the storage server and disk information accessible to the target tenant found from the disk data list by the registration center through monitoring the Zookeeper node; Creating a gRPC connection to the accessible storage server; In response to the file operation request of the target tenant, an operation corresponding to the file operation request is performed based on the accessible storage server and disk.
7. The method according to claim 6, characterized in that The file operation request includes: a file query request; in response to the file operation request of the target tenant, the step of performing an operation corresponding to the file operation request based on the accessible storage server and disk includes: Calling a file reading API to search for file mapping information in the metadata storage end, and determining a target disk under a target storage server where the file mapping information is located; According to the file mapping information, file addressing is performed, a connection with the target storage server is established, and gRPC call information for reading the file is sent to the target storage server to obtain file information.
8. The method according to claim 6, characterized in that The file operation request includes: a file write request; in response to the file operation request of the target tenant, the step of performing an operation corresponding to the file operation request based on the accessible storage server and disk includes: Call the file write API to search for the target disk under the target storage server from the accessible storage servers; The file content is written into the target disk under the target storage server, and the file mapping information corresponding to the file content is stored in the metadata storage end; the file mapping information includes: the namespace, the file name and the association data of the disk.
9. The method according to claim 8, characterized in that The steps to find the target disk under the target storage server from the accessible storage servers include: According to the data balance principle, determining a target disk under a target storage server from accessible storage servers; the method further comprises: When the storage server is started, or when it reconnects to the registration center, the storage server registers the service with the registration center and writes its running data into the registration center; the running data includes: service IP and service port information; When it is detected that the operation error rate of a disk is abnormally increased, it is determined that there is a problem with the disk; the data access request is redirected to another healthy data copy, and it is established as the new primary copy.
10. A multi-tenant request device based on gRPC, characterized in that: The device is applied to a client SDK in a gRPC-based multi-tenant distributed file system according to any one of claims 1 to 5, and the device includes: An initialization module, used to respond to a login request sent by a target tenant and to initialize a connection with a registration center based on the target tenant information carried in the login request; A search module is used to receive the storage server and disk information accessible to the target tenant found from the disk data list by the registration center through monitoring the Zookeeper node; A connection module, used to create a gRPC connection to the accessible storage server; The operation module is used to respond to the file operation request of the target tenant and perform the operation corresponding to the file operation request based on the accessible storage server and disk.