CN110784515B - Data storage method based on distributed cluster and related equipment thereof - Google Patents

Data storage method based on distributed cluster and related equipment thereof Download PDF

Info

Publication number
CN110784515B
CN110784515B CN201910884112.0A CN201910884112A CN110784515B CN 110784515 B CN110784515 B CN 110784515B CN 201910884112 A CN201910884112 A CN 201910884112A CN 110784515 B CN110784515 B CN 110784515B
Authority
CN
China
Prior art keywords
target
block
agent
iscsi
client
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910884112.0A
Other languages
Chinese (zh)
Other versions
CN110784515A (en
Inventor
杨淑娟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201910884112.0A priority Critical patent/CN110784515B/en
Priority to PCT/CN2019/117740 priority patent/WO2021051570A1/en
Publication of CN110784515A publication Critical patent/CN110784515A/en
Application granted granted Critical
Publication of CN110784515B publication Critical patent/CN110784515B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1008Server selection for load balancing based on parameters of servers, e.g. available memory or workload
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to the field of data processing, and provides a data storage method based on a distributed cluster and related equipment thereof, wherein the data storage method based on the distributed cluster comprises the following steps: receiving a block device creation request sent by an iscsi client, wherein the block device creation request carries parameter information and a client identifier of the iscsi client; generating N block devices as target block devices to store data according to the parameter information, and acquiring basic information of the target block devices; based on basic information of N target block devices, selecting N agent ends from the ceph distributed cluster as target agent ends in a load balancing mode; acquiring a target device identifier of an iscsi target device contained in each target agent end; and establishing a mapping relation among the target block device, the target device identifier and the client identifier. The technical scheme of the invention realizes the dynamic configuration and flexible selection of the target agent terminal, thereby improving the flexibility of system resource calling and ensuring the robustness of the system.

Description

Data storage method based on distributed cluster and related equipment thereof
Technical Field
The present invention relates to the field of data processing, and in particular, to a data storage method based on a distributed cluster and a related device thereof.
Background
The ISCSI protocol is a protocol based on TCP/IP technology between contact storage and client, and is receiving more and more attention due to its low cost and flexible and convenient characteristics, and has the following advantages compared with the FC protocol: the price is cheaper, the transmission distance is longer, and the existing Ethernet transmission network can be used.
Most of the existing storage devices use a dual-controller architecture, and compared with a single-controller storage architecture, the main advantage of the existing storage devices is redundancy between the dual controllers: when one controller is down due to some reasons, the other controller can take over the services of the down controller immediately, so that the service of the client is ensured to be uninterrupted, and the system is used for industries with high requirements on data storage protection, such as banks and the like.
However, if the number of user clients is large, the iscsi client will become a performance bottleneck, which easily causes insufficient system resources and even failure, so that the system robustness is not high.
Disclosure of Invention
Embodiments of the present invention provide a data storage method, an apparatus, a computer device and a storage medium based on a distributed cluster, so as to solve the problem that system robustness is affected due to insufficient system resources when the number of user clients is large.
A data storage method based on distributed clusters comprises the following steps:
receiving a block device creation request sent by an iscsi client, wherein the block device creation request carries parameter information and a client identifier of the iscsi client;
generating N block devices as target block devices to store data according to the parameter information, and acquiring basic information of the target block devices, wherein N is a positive integer;
based on basic information of N target block devices, selecting N agent ends from a ceph distributed cluster in a load balancing mode to serve as target agent ends, wherein each agent end comprises an iscsi target device, and each target block device corresponds to one target agent end;
acquiring a target device identifier of an iscsi target device contained in each target agent end;
and establishing a mapping relation among the target block device, the target device identifier and the client identifier.
A distributed cluster-based data storage apparatus, comprising:
the device comprises a receiving module, a sending module and a receiving module, wherein the receiving module is used for receiving a block device creation request sent by an iscsi client, and the block device creation request carries parameter information and a client identifier of the iscsi client;
the first generation module is used for generating N block devices as target block devices to store data according to the parameter information and acquiring basic information of the target block devices, wherein N is a positive integer;
a load balancing module, configured to select N proxy ends from the ceph distributed cluster as target proxy ends in a load balancing manner based on basic information of the N target block devices, where each proxy end includes an iscsi target device, and each target block device corresponds to one target proxy end;
a first obtaining module, configured to obtain an object device identifier of an iscsi object device included in each object agent;
and the establishing module is used for establishing the mapping relation among the target block equipment, the target device identifier and the client identifier.
A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the above-described distributed cluster-based data storage method when executing the computer program.
A computer-readable storage medium, storing a computer program which, when executed by a processor, performs the steps of the distributed cluster-based data storage method described above.
The data storage method, the device, the computer equipment and the storage medium based on the distributed cluster are used for receiving a block equipment creation request sent by an iscsi client, generating N block equipment serving as target block equipment according to parameter information and client identification of the iscsi client, acquiring basic information of the target block equipment, selecting N agent ends from the ceph distributed cluster in a load balancing mode to serve as target agent ends, acquiring target device identification of the target agent ends, and finally establishing a mapping relation among the target block equipment, the target device identification and the client identification. Therefore, by loading the iscsi client into the distributed cluster, the dynamic configuration of the target agent end is realized, the resource utilization rate is improved, and the robustness of the system is ensured; and the target agent end is selected in a load balancing mode, so that the flexibility of resource allocation is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments of the present invention will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art that other drawings can be obtained according to these drawings without inventive labor.
Fig. 1 is a flowchart of a distributed cluster-based data storage method according to an embodiment of the present invention;
fig. 2 is a flowchart of step S2 in the distributed cluster-based data storage method according to the embodiment of the present invention;
fig. 3 is a flowchart of step S3 in the distributed cluster-based data storage method according to the embodiment of the present invention;
fig. 4 is a flowchart of step S33 in the distributed cluster-based data storage method according to the embodiment of the present invention;
fig. 5 is a flowchart illustrating detecting a real-time status of a target agent and removing the downed target agent in the distributed cluster-based data storage method according to the embodiment of the present invention;
fig. 6 is a flowchart of receiving a data access request and sending the data access request to a corresponding iscsi target in the distributed cluster-based data storage method according to the embodiment of the present invention;
FIG. 7 is a schematic diagram of a distributed cluster-based data storage apparatus according to an embodiment of the present invention;
fig. 8 is a block diagram of a basic mechanism of a computer device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The data storage method based on the distributed cluster is applied to the server side, and the server side can be specifically realized by an independent server or a server cluster consisting of a plurality of servers. In an embodiment, as shown in fig. 1, a distributed cluster-based data storage method is provided, which includes the following steps:
s1: and receiving a block device creation request sent by the iscsi client, wherein the block device creation request carries parameter information and a client identifier of the iscsi client.
Specifically, when the iscsi client needs to create the block device, the iscsi client sends a block device creation request to the server through a network transport protocol, and when the server receives the block device creation request, the iscsi client obtains parameter information contained in the request and a client identifier of the iscsi client.
The client identifier of the iscsi client is used to represent the iscsi client, and specifically may include, but is not limited to, an iscsi client ID, an iscsi client device number, and other character strings used to uniquely identify the client.
Parameter information includes, but is not limited to: block device size, block device identification, block device type, etc.
Among them, iscsi (Internet Small Computer System Interface) is an Internet Computer System Interface, also called IP-SAN, a storage technology based on Internet and SCSI-3 protocol, proposed by IETF, and becoming a formal standard in 11/2/2003. The iscsi uses the TCP/IP protocol, e.g., typically TCP ports 860 and 3260. Essentially, iscsi allows two hosts to negotiate with each other via an IP Network and then exchange SCSI commands, which emulates a common high performance local Storage bus using a wide Area Network (wan), creating a Storage Area Network (SAN) that can operate over existing switching and IP infrastructures. However, deployment performance of an iscsi SAN can be severely degraded if a dedicated network or subnet, such as a LAN or VLAN, is not used.
It should be noted that iscsi mainly uses TCP/IP technology, and makes the storage device end through the function of iscsi target in iscsi target to be a server end capable of providing disk, and then through the function of iscsi initialization user in iscsi initiator, makes it possible to mount the client end using iscsi target, so that the application of disk can be performed through iscsi protocol, that is, the iscsi architecture mainly divides the storage device iscsi target and the used host iscsi initiator into two parts.
The iscsi target is a storage device end for storing a disk or RAID, and for example, a Linux host may be specifically emulated to the iscsi target; iscsi initiato is a client capable of using a target, i.e., an iscsi client in the present embodiment.
S2: and generating N block devices as target block devices to store data according to the parameter information, and acquiring basic information of the target block devices, wherein N is a positive integer.
Specifically, block device creation is performed according to parameter information acquired from the block device creation request to obtain N target block devices, and basic information of each target block device is acquired.
In this embodiment, the basic information of the target block device at least includes a block device size, a block device address, and a block device identifier.
It should be noted that initiator and target in iscsi can be logically addressed by iqn (iscsi qualified name) number. One iqn consists of four parts: domain name organization assigned names, such as: iqn.2017-06.com.example.
The number N of devices generating the target block may be preset according to actual situations, and is not limited herein.
Preferably, the number of block devices generated in this embodiment is 3.
Further, the generated target block device may be used to store data, and the generation of the target block device is equivalent to constructing a channel for data storage, and then storing the target block device to the corresponding target block device in the data storage process.
S3: based on basic information of N target block devices, N proxy ends are selected from the ceph distributed cluster in a load balancing mode to serve as target proxy ends, wherein each proxy end comprises an iscsi target device, and each target block device corresponds to one target proxy end.
In the embodiment of the invention, a host provided with an iscsi target is deployed in a ceph distributed cluster, when an iscsi client has a requirement, an agent end meeting the preset requirement of a user is determined from the ceph distributed cluster according to basic information of N target block devices, and the agent end meeting the condition is obtained from the determined agent end in a load balancing mode to be used as a target agent end, so that the dynamic acquisition of the iscsi target is realized, and the high availability of the system is ensured.
The load balancing refers to balancing and distributing loads, namely work tasks, to a plurality of operation units for operation, such as an FTP server, a Web server, an enterprise core application server, and other main task servers, so as to cooperatively complete the work tasks.
The proxy side is used to manage the persistence and reuse of the link, i.e., the association and reuse of the iscsi target with the user client in this embodiment.
S4: and acquiring the target device identification of the iscsi target device contained in each target agent end.
Specifically, the target device identification of the iscsi target device contained in each target agent end is directly obtained from a preset database. The preset database is a database which is specially used for storing the target device identification of the iscsi target device contained in each target agent end.
The target identifier is used to represent an iscsi target, and specifically may include, but is not limited to, a target id, a target name, and the like, for uniquely identifying the target.
S5: and establishing a mapping relation among the target block device, the target device identifier and the client identifier.
Specifically, after the target device identifier is obtained, the server establishes a mapping relationship among the target block device, the target device identifier and the client identifier, so that the target block device, the target device identifier or the client identifier with the mapping relationship can be quickly found in the subsequent data processing.
It should be noted that the target block device is used for storing data, the target device identifier and the client identifier are used for representing a path, and a mapping relationship between the target block device, the target device identifier and the client identifier is established, which is equivalent to establishing a channel for storing data, that is, data corresponding to the client identifier can be obtained through the client identifier, and the data is stored in the target block device corresponding to the target device identifier.
In this embodiment, a block device creation request sent by an iscsi client is received, the block device creation request includes parameter information and a client identifier of the iscsi client, N block devices are generated according to the parameter information and serve as target block devices, basic information of the target block devices is acquired, N proxy terminals are selected from a ceph distributed cluster as target proxy terminals in a load balancing manner, a target device identifier of the target proxy terminals is acquired, and finally a mapping relationship among the target block devices, the target device identifier and the client identifier is established. Therefore, by loading the iscsi client into the distributed cluster, the dynamic configuration of the target agent end is realized, the resource utilization rate is favorably improved, and the robustness of the system is ensured; and the target agent end is selected in a load balancing mode, so that the flexibility of resource allocation is improved.
In an embodiment, the parameter information includes a block device size, a block device type, and a block device identifier, as shown in fig. 2, in step S2, that is, according to the parameter information, N block devices are generated as target block devices to store data, and basic information of the target block devices is obtained, where N is a positive integer, including the following steps:
s21: and according to the size of the block device, dividing the space with the size of the block device from the preset storage device to be used as the storage space of the newly built block device.
In the embodiment of the present invention, the total storage space of the preset storage device is partitioned according to the size of the block device, a space with the same size as the block device is partitioned from the total storage space, and the space is used as the storage space of the newly-built block device. The preset storage device is specifically a storage device in the iscsi system, and the storage space of the storage device is far larger than the size of the block device.
For example, if the block device size is 500M, the total storage space of the preset storage device is 50G, and the total storage space is divided into 49.5G and 0.5G storage spaces, the block device is used as the storage space of the newly created block device because the block device size and the storage space are both 0.5G.
S22: and generating an initial block device in the storage space according to the block device type, wherein the initial block device contains identification information.
In this embodiment of the present invention, based on the type of the block device, the storage space of the block device acquired in step S21 is used, and an initial block device of the same type as the block device is generated in the storage space through a preset new port. The preset new port is a processing port specially used for newly building the initial block device.
For example, the block device type is ABC, and an initial block device with the block device type also ABC is generated in the storage space by using the preset new port.
S23: and modifying the identification information corresponding to the initial block device into a block device identification to obtain the modified target block device.
In this embodiment of the present invention, after the initial block device is generated in step S22, the initial block device is identified, the identification information of the initial block device is modified to the identification information that is the same as the block device identification, and the modified initial block device is used as the target block device.
It should be noted that, since the parameter information includes the block device identifier, and the target block device is generated according to the parameter information, the identifier information of the target block device needs to be the same as the parameter information, so that the identifier information of the initial block device is modified into the identifier information that is the same as the block device identifier.
S24: basic information of a target block device is acquired.
Specifically, the basic information of the target block device is extracted through an information recording table in a preset storage device. The information recording table refers to a data table of basic information in the preset storage device, which is specially used for recording the target block device.
It should be noted that, since the target block device is generated in the storage space partitioned by the preset storage device, the basic information corresponding to the target block device is stored in the information record table in the preset storage device.
In this embodiment, a storage space with the same size as the block device is partitioned from the preset storage device, an initial block device is generated in the storage space according to the type of the block device, the identification information of the initial block device is modified into the block device identification to obtain a target block device, and the basic information of the target block device is obtained. Therefore, the basic information of the target block device can be accurately acquired, and the accuracy of selecting the target agent end by using the basic information of the target block device in the follow-up process is improved.
In an embodiment, as shown in fig. 3, in step S3, that is, based on basic information of N target block devices, selecting N proxy terminals as target proxy terminals from a ceph distributed cluster in a load balancing manner, where each proxy terminal includes an iscsi target, and each target block device corresponds to one target proxy terminal includes the following steps:
s31: and determining a target size range based on the basic information and preset requirements of the N target block devices.
In the embodiment of the present invention, since the basic information of the target block device includes the block device size, a target size range that meets the preset requirement is calculated according to the device size. The preset requirement may specifically refer to that the maximum value and the minimum value of the block device size are selected from the N target block devices as a target size range.
For example, there are 3 target block devices O, P, Q, the corresponding block devices are 5G, 10G and 20G, and the target size range is determined to be 5G to 20G according to the preset requirement.
S32: and selecting an agent end which meets the target size range from the ceph distributed cluster.
In the embodiment of the present invention, the ceph distributed cluster includes X proxy terminals, and the proxy terminals include a space size, where X is a constant greater than N. And comparing the space size of each agent end in the ceph distributed cluster with the target size range according to the target size range, and selecting the agent end with the space size within the target size range.
For example, there are 5 agent terminals E1, E2, E3, E4, and E5 in the ceph distributed cluster, and the corresponding spatial sizes are 5G, 2G, 15G, 10G, and 3G, respectively, and if the target size range is 5G to 20G, the spatial sizes are compared with the target size range, so that the spatial sizes corresponding to the agent terminals E1, E3, and E4 are within the target size range, and therefore, the agent terminals E1, E3, and E4 are selected.
S33: and aiming at each agent end, acquiring the central processor model, the disk space parameter and the memory model of the agent end.
Specifically, according to the preset information table, the central processor model, the disk space parameter, and the memory model of each agent terminal selected in step S33 are directly obtained from the preset information table. The preset information table is a data table which is specially used for storing the central processing unit model, the disk space parameter and the memory model of the agent end.
S34: calculating the corresponding state score of each agent terminal according to the following formula:
Figure BDA0002206770630000101
wherein, S is the state score,
Figure BDA0002206770630000111
is the processor score corresponding to the central processor model,
Figure BDA0002206770630000112
is the corresponding parameter score of the disk space parameter, k is the preset weight, J Q3 The model value is corresponding to the memory model.
In the embodiment of the present invention, after the central processor model, the disk space parameter, and the memory model of each agent are obtained according to step S33, the processor score corresponding to the central processor model, the parameter score corresponding to the disk space parameter, and the model score corresponding to the memory model are respectively obtained from the preset score table. And calculating the state score corresponding to each agent terminal according to a formula (1):
Figure BDA0002206770630000113
wherein, S is the state score,
Figure BDA0002206770630000114
is the processor score corresponding to the central processor model,
Figure BDA0002206770630000115
is a parameter score corresponding to a disk space parameter, k is a preset weight, J Q3 The model value is corresponding to the memory model.
The preset score table is a data table specially used for storing processor scores corresponding to the models of the central processing units, parameter scores corresponding to the disk space parameters and model scores corresponding to the models of the internal memories.
It should be noted that, different cpu models have different processor scores, different disk space parameters have different parameter scores, and different memory models have different model scores.
For example, the processor score corresponding to the central processor model Q1 is 50, and the processor score corresponding to the central processor model P is 30; the parameter score corresponding to the disk space parameter 1G is 10, and the parameter score corresponding to the disk space parameter 10G is 12; the model score corresponding to the memory model Q3 is 10, and the model score corresponding to the memory model I is 10.
Further, the state score S is used to represent the performance of the current agent, and the state score S is proportional to the performance of the agent, i.e., the larger the state score S, the better the performance of the agent.
In a cluster, in order to reasonably utilize resources, dynamic space allocation is generally set, and meanwhile, a program also consumes a certain disk space in the processes of storage and execution.
S35: and determining the target agent terminal according to the state score based on a preset condition.
Specifically, when the preset condition is reached, the agent side corresponding to the state score meeting the preset condition is determined as the target agent side. The preset condition may be specifically the agent with the state score of the top ten of all the agent terminals, or the agent with the state score reaching the preset score of the user, and may be specifically set according to the actual requirement of the user, which is not limited herein.
For example, if the status score of agent a is 80, the status score of agent B is 85, and the status score of agent C is 90, and if the preset condition is that the status score is greater than or equal to 85, the status scores of agent B and agent C are both greater than or equal to 85, then agent B and agent C are determined as target agents.
In this embodiment, a target size range is determined based on basic information and preset requirements of N target block devices, then an agent end meeting the target size range is selected from the ceph distributed cluster, a state score corresponding to each agent end is calculated based on formula (1) according to a central processing unit model, a disk space parameter and a memory model of the obtained agent end, and the target agent end is determined according to preset conditions. The state score corresponding to each agent terminal can be rapidly and accurately calculated through the formula (1), and the accuracy of screening the target agent terminal by using the state scores is improved.
In an embodiment, as shown in fig. 4, the step S35 of determining the target agent according to the state score based on the preset condition includes the following steps:
s331: and sorting the state scores corresponding to all the agent terminals according to the descending order, and selecting the first N state scores as target state scores.
In the embodiment of the present invention, the state scores corresponding to all the agent terminals selected in step S32 are obtained through calculation in step S34, the state scores corresponding to all the agent terminals are sorted in the descending order, and the state score sorted to the top X is selected as the target state score.
For example, 8 agent terminals are a, b, c, d, e, f and g respectively, the corresponding state scores of the agent terminals are 90, 50, 60, 80, 85, 92 and 75 respectively, after the state scores are sorted in the descending order, the sorting order is 92, 90, 85, 80, 75, 60 and 50, if X is 3, the first 3 agent terminals are selected, namely the state scores are 92, 90 and 85 are selected as the target state scores.
S332: and obtaining an agent end corresponding to the target state score as a target agent end.
Specifically, according to the target state score determined in step S331, the agent side corresponding to the target state score is determined as the target agent side.
For example, as shown in the example in step S331, the agent terminals f, a, e corresponding to the target state scores 92, 90, 85 are determined as target agent terminals.
In this embodiment, the state scores corresponding to the agent terminals are sorted in descending order, the top N state scores are selected as target state scores, and the agent terminal corresponding to the target state scores is used as a target agent terminal. Therefore, the target agent end can be accurately obtained, and the accuracy of establishing the mapping relation by using the target device identification contained in the target agent end in the follow-up process is improved.
In an embodiment, as shown in fig. 5, after step S3, the distributed cluster-based data storage method further includes the following steps:
s61: and detecting the target agent terminal in real time based on a preset detection mechanism to obtain the real-time state of the target agent terminal.
In the embodiment of the present invention, the real-time status of the target agent is used to represent the current operating status of the target agent, which may be normal or down, and if the real-time status is normal, it indicates that the target agent corresponding to the real-time status can work normally; and if the real-time state is down, the target agent end corresponding to the real-time state is abnormal and cannot work normally.
Specifically, the real-time state of the target agent end is detected in real time through a preset detection mechanism, and the real-time state of the target agent end is obtained. The preset detection mechanism is a service mechanism specially used for detecting the real-time state of the target agent end, and may specifically be an attempt to make availability on the target agent end by using a probe at regular time, for example, sending a ping or a curl command to a port of the target agent end, if the return is normal, the target agent end is normal, and if the return is abnormal, the target agent end is abnormal or down.
It should be noted that, by detecting the target agent end in real time, the problem of loss caused by failure to find the abnormality at the target agent end in time can be effectively avoided.
S62: and if the target agent end with the real-time state of being down is detected to exist, removing the target agent end with the real-time state of being down from the target agent end set, wherein the target agent end set is used for collecting all the target agent ends.
In the embodiment of the present invention, because a plurality of target agents exist in the target agent set, in order to ensure that each target agent can work normally, an abnormal target agent needs to be removed, that is, according to the manner of the real-time status of the target agents in step S61, if it is detected that there is a target agent whose real-time status is down, the qualification of the target agent whose real-time status is down as the target agent is cancelled, and the target agent whose real-time status is down is removed from the target agent set.
For example, if the target agent end sets are H, I, J, K respectively, and the corresponding real-time states thereof are normal, down, normal, and normal respectively, if it is detected that the real-time state of the target agent end I is down, the target agent end I is removed from the target agent end sets, that is, only H, J and K remain in the target agent end sets obtained after removal.
It should be noted that, a reliable coordination system exists in the server, and when the target agent end whose real-time state is down is removed, the target agent end whose real-time state is down may be removed through the reliable coordination system.
The reliable coordination system may be a ZooKeeper system, the ZooKeeper is a distributed, open source code distributed application program coordination service, and provides a consistency service for the distributed application, where the provided functions include: configuration maintenance, domain name service, distributed synchronization, group service, etc. When event information is received, such as connection timeouts, node data changes, child node changes, corresponding actions may be invoked to process the event.
S63: and updating the target agent terminal set.
Specifically, after the downtime target agent is detected in step S62 and removed, the set of target agents is updated according to a preset updating manner in order to ensure that all the sets of target agents are normal target agents. The preset updating mode may specifically be to refresh an information list of the target agent end set, or to introduce a new target agent end list into the target agent end set again, which is not limited herein.
In this embodiment, by detecting the real-time state of the target agent, the target agent whose real-time state is down is removed from the set of target agents, and the target agent is updated. Therefore, real-time health of the target agent end is achieved, the target agent end can be removed in time in the downtime state of the target agent end, the situation that partial data are lost due to downtime of the target agent end when the target agent end is called for data processing is avoided, the stability of data processing is improved, and the robustness of the system is further improved.
In an embodiment, as shown in fig. 6, after step S5, the distributed cluster-based data storage method further includes the following steps:
s71: receiving a data access request of an iscsi client, and acquiring a client identifier of the iscsi client in the data access request, wherein the data access request comprises the client identifier of the client.
In the embodiment of the invention, the server and the iscsi client perform network communication based on a Transmission Control Protocol (TCP), and when a data access request sent by the iscsi client is monitored, access information in the data access request and a client identifier of the iscsi client are acquired.
Among other things, TCP provides a connection-oriented, reliable byte stream service. Connection-oriented means that two applications using TCP, e.g. a server and an iscsi client, must establish a TCP connection before exchanging packets with each other. In a TCP connection, only two parties are communicating with each other.
S72: and acquiring a target device identifier corresponding to the client identifier from the mapping relation, and sending a data access request to an iscsi target device corresponding to the target device identifier.
Specifically, according to the mapping relationship among the target block device, the target device identifier, and the client identifier established in step S5, the target device identifier corresponding to the client identifier of the iscsi client in step S71 is obtained, the corresponding iscsi target device is determined according to the target device identifier, and the data access request is sent to the iscsi target device.
It should be noted that the target id is used to indicate the unique iscsi target corresponding to the target id, i.e. different target ids correspond to different iscsi targets.
In the embodiment, the data access request of the iscsi client is received, the client identifier of the iscsi client is obtained, and the data access request is sent to the iscsi target corresponding to the target identifier according to the mapping relation. Therefore, the data access request is sent to the designated iscsi target device, the accuracy of data access is improved, and the accuracy of dynamic configuration of the target agent end is further ensured.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
In an embodiment, a data storage device based on a distributed cluster is provided, and the data storage device based on the distributed cluster corresponds to the data storage method based on the distributed cluster in the foregoing embodiment one to one. As shown in fig. 7, the distributed cluster-based data storage apparatus includes a receiving module 71, a first generating module 72, a load balancing module 73, a first obtaining module 74, and an establishing module 75. The functional modules are explained in detail as follows:
a receiving module 71, configured to receive a block device creation request sent by an iscsi client, where the block device creation request carries parameter information and a client identifier of the iscsi client;
a first generating module 72, configured to generate, according to the parameter information, N block devices as target block devices to store data, and acquire basic information of the target block devices, where N is a positive integer;
a load balancing module 73, configured to select N proxy ends from the ceph distributed cluster as target proxy ends in a load balancing manner based on basic information of the N target block devices, where each proxy end includes an iscsi target device, and each target block device corresponds to one target proxy end;
a first obtaining module 74, configured to obtain an object identifier of an iscsi object included in each object agent;
the establishing module 75 is configured to establish a mapping relationship between the target block device, the target device identifier, and the client identifier.
Further, the first generating module 72 includes:
the partitioning submodule is used for partitioning a space with the size of the block device from a preset storage device according to the size of the block device to be used as a storage space of the newly built block device;
the second generation submodule is used for generating initial block equipment in the storage space according to the type of the block equipment, wherein the initial block equipment contains identification information;
the modification submodule is used for modifying the identification information corresponding to the initial block device into a block device identification to obtain a modified target block device;
and the second acquisition submodule is used for acquiring the basic information of the target block device.
Further, the load balancing module 73 includes:
the determining module is used for determining a target size range based on the basic information and preset requirements of the N target block devices;
the selecting module is used for selecting an agent end which accords with the target size range from the ceph distributed cluster;
the third acquisition submodule is used for acquiring the model of a central processing unit, the disk space parameters and the memory model of each agent terminal;
the calculating submodule is used for calculating the state score corresponding to each agent terminal according to the following formula:
Figure BDA0002206770630000171
wherein, S is the state score,
Figure BDA0002206770630000181
is the processor score corresponding to the central processor model,
Figure BDA0002206770630000182
is the corresponding parameter score of the disk space parameter, k is the preset weight, J Q3 The model value is corresponding to the memory model;
and the target agent terminal determining submodule is used for determining the target agent terminal according to the state score based on the preset condition.
Further, the target agent side determination submodule includes:
the selecting unit is used for sequencing the state scores corresponding to all the agent terminals in a descending order, and selecting the first N state scores as target state scores;
and the fourth acquisition unit is used for acquiring the agent terminal corresponding to the target state score as the target agent terminal.
Further, the distributed cluster-based data storage apparatus further comprises:
the detection module is used for detecting the target agent terminal in real time based on a preset detection mechanism to obtain the real-time state of the target agent terminal;
the removing module is used for removing the target agent end with the real-time state of downtime from the target agent end set if the target agent end with the real-time state of downtime is detected to exist, wherein the target agent end set is used for collecting all the target agent ends;
and the updating module is used for updating the target agent terminal set.
Further, the distributed cluster-based data storage apparatus further comprises:
a fifth obtaining module, configured to receive a data access request of an iscsi client, and obtain a client identifier of the iscsi client in the data access request, where the data access request includes the client identifier of the client;
and the sending module is used for acquiring the target device identifier corresponding to the client identifier from the mapping relation and sending the data access request to the iscsi target device corresponding to the target device identifier.
Some embodiments of the present application disclose a computer device. Referring specifically to fig. 8, a basic structure block diagram of a computer device 90 according to an embodiment of the present application is shown.
As illustrated in fig. 8, the computer device 90 includes a memory 91, a processor 92, and a network interface 93 that are communicatively connected to each other via a system bus. It is noted that only a computer device 90 having components 91-93 is shown in FIG. 8, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may alternatively be implemented. As will be understood by those skilled in the art, the computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.
The memory 91 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the storage 91 may be an internal storage unit of the computer device 90, such as a hard disk or a memory of the computer device 90. In other embodiments, the memory 91 may also be an external storage device of the computer device 90, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, provided on the computer device 90. Of course, the memory 91 may also include both internal and external memory units of the computer device 90. In this embodiment, the memory 91 is generally used for storing an operating system installed on the computer device 90 and various types of application software, such as program codes of the distributed cluster-based data storage method. Further, the memory 91 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 92 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 92 is typically used to control the overall operation of the computer device 90. In this embodiment, the processor 92 is configured to execute the program code stored in the memory 91 or process data, for example, execute the program code of the distributed cluster-based data storage method.
The network interface 93 may include a wireless network interface or a wired network interface, and the network interface 93 is generally used to establish a communication connection between the computer device 90 and other electronic devices.
The present application further provides another embodiment, which is to provide a computer-readable storage medium, where a target agent-side data information entry program is stored in the computer-readable storage medium, where the target agent-side data information entry program is executable by at least one processor, so that the at least one processor executes the steps of any one of the above-mentioned distributed cluster-based data storage methods.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a computer device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
Finally, it should be noted that the above-mentioned embodiments illustrate only some of the embodiments of the present application, and do not limit the scope of the claims. This application is capable of embodiments in many different forms and is provided for the purpose of enabling a thorough understanding of the disclosure of the application. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that the present application may be practiced without modification or with equivalents of some of the features described in the foregoing embodiments. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields and are within the protection scope of the present application.

Claims (7)

1. A data storage method based on a distributed cluster is characterized in that the data storage method based on the distributed cluster comprises the following steps:
receiving a block device creation request sent by an iscsi client, wherein the block device creation request carries parameter information and a client identifier of the iscsi client;
generating N block devices serving as target block devices to store data according to the parameter information, wherein the parameter information comprises block device size, block device type and block device identification, and acquiring basic information of the target block devices, wherein N is a positive integer;
the step of generating N block devices as target block devices to store data according to the parameter information and acquiring basic information of the target block devices includes:
according to the size of the block device, dividing a space with the size of the block device from a preset storage device to be used as a storage space of a newly built block device;
generating initial block equipment in the storage space according to the block equipment type, wherein the initial block equipment contains identification information;
modifying the identification information corresponding to the initial block device into the block device identification to obtain the modified target block device;
basic information of the target block device is acquired,
based on basic information of N target block devices, selecting N agent ends from a ceph distributed cluster in a load balancing mode to serve as target agent ends, wherein each agent end comprises an iscsi target device, and each target block device corresponds to one target agent end;
acquiring a target device identifier of an iscsi target device contained in each target agent end;
establishing a mapping relation among the target block device, the target device identifier and the client identifier;
receiving a data access request of an iscsi client, and acquiring a client identifier of the iscsi client in the data access request, wherein the data access request comprises the client identifier of the iscsi client;
and acquiring the target device identification corresponding to the client identification from the mapping relation, and sending a data access request to the iscsi target device corresponding to the target device identification.
2. The distributed cluster-based data storage method of claim 1, wherein the step of selecting N proxy terminals from the ceph distributed cluster as target proxy terminals in a load balancing manner based on the basic information of the N target block devices comprises:
determining a target size range based on the basic information and preset requirements of the N target block devices;
selecting the agent end which meets the target size range from the ceph distributed cluster;
aiming at each agent end, acquiring the central processing unit model, the disk space parameter and the memory model of the agent end;
calculating the corresponding state score of each agent terminal according to the following formula:
Figure FDA0003896475450000021
wherein S is the state score,
Figure FDA0003896475450000022
is the processor score corresponding to the central processor model,
Figure FDA0003896475450000023
is the corresponding parameter score of the disk space parameter, k is the preset weight, J Q3 The model value is corresponding to the memory model;
and determining a target agent terminal according to the state score based on a preset condition.
3. The distributed cluster-based data storage method of claim 2, wherein the step of determining the target agent according to the state score based on the preset condition comprises:
sorting the state scores corresponding to all the agent terminals in a descending order, and selecting the first N state scores as target state scores;
and acquiring the agent end corresponding to the target state score as a target agent end.
4. The distributed cluster-based data storage method according to claim 1, wherein after the step of selecting N proxy terminals as target proxy terminals from the ceph distributed cluster in a load balancing manner based on the basic information of the N target block devices, the distributed cluster-based data storage method further comprises:
detecting the target agent terminal in real time based on a preset detection mechanism to obtain the real-time state of the target agent terminal;
if a target agent end with a real-time state of downtime is detected, removing the target agent end with the real-time state of downtime from a target agent end set, wherein the target agent end set is used for collecting all the target agent ends;
and updating the target agent terminal set.
5. A distributed cluster-based data storage apparatus, the distributed cluster-based data storage apparatus comprising:
the device comprises a receiving module, a sending module and a receiving module, wherein the receiving module is used for receiving a block device creation request sent by an iscsi client, and the block device creation request carries parameter information and a client identifier of the iscsi client;
the first generation module is used for generating N block devices as target block devices to store data according to the parameter information and acquiring basic information of the target block devices, wherein N is a positive integer;
the first generation module further comprises:
the partitioning submodule is used for partitioning a space with the size of the block device from a preset storage device according to the size of the block device to be used as a storage space of a newly-built block device;
a second generation submodule, configured to generate an initial block device in the storage space according to the block device type, where the initial block device includes identification information;
a modification submodule, configured to modify the identification information corresponding to the initial block device into the block device identification, so as to obtain a modified target block device;
the second obtaining submodule is used for obtaining the basic information of the target block device;
the load balancing module is used for selecting N agent ends from the ceph distributed cluster as target agent ends in a load balancing mode based on basic information of the N target block devices, wherein each agent end comprises an iscsi target device, and each target block device corresponds to one target agent end;
a first obtaining module, configured to obtain an object device identifier of an iscsi object device included in each object agent;
the establishing module is used for establishing a mapping relation among the target block equipment, the target device identifier and the client identifier;
the fifth acquisition module is used for receiving a data access request of the iscsi client and acquiring a client identifier of the iscsi client in the data access request, wherein the data access request comprises the client identifier of the client;
and the sending module is used for acquiring the target device identifier corresponding to the client identifier from the mapping relation and sending the data access request to the iscsi target device corresponding to the target device identifier.
6. A computer arrangement comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor, when executing the computer program, carries out the steps of the distributed cluster based data storage method according to any of claims 1 to 4.
7. A computer-readable storage medium, in which a computer program is stored, which, when being executed by a processor, carries out the steps of the distributed cluster-based data storage method according to any one of claims 1 to 4.
CN201910884112.0A 2019-09-19 2019-09-19 Data storage method based on distributed cluster and related equipment thereof Active CN110784515B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910884112.0A CN110784515B (en) 2019-09-19 2019-09-19 Data storage method based on distributed cluster and related equipment thereof
PCT/CN2019/117740 WO2021051570A1 (en) 2019-09-19 2019-11-13 Data storage method based on distributed cluster, and related device thereof

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910884112.0A CN110784515B (en) 2019-09-19 2019-09-19 Data storage method based on distributed cluster and related equipment thereof

Publications (2)

Publication Number Publication Date
CN110784515A CN110784515A (en) 2020-02-11
CN110784515B true CN110784515B (en) 2022-11-22

Family

ID=69383820

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910884112.0A Active CN110784515B (en) 2019-09-19 2019-09-19 Data storage method based on distributed cluster and related equipment thereof

Country Status (2)

Country Link
CN (1) CN110784515B (en)
WO (1) WO2021051570A1 (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112860190A (en) * 2021-02-25 2021-05-28 西北民族大学 Data reading and writing method based on computer equipment
CN113010498B (en) * 2021-03-25 2023-08-08 腾讯科技(深圳)有限公司 Data synchronization method, device, computer equipment and storage medium
CN113504951B (en) * 2021-07-08 2024-02-06 华云数据控股集团有限公司 Global iSCSI target configuration method and device, computing equipment and storage medium
CN114513501B (en) * 2022-02-15 2024-03-22 银联商务股份有限公司 Target distribution method and system
CN114265702B (en) * 2022-03-02 2022-05-31 苏州浪潮智能科技有限公司 iSCSI service load balancing method, device, equipment and medium
CN115378962B (en) * 2022-08-18 2023-04-21 北京志凌海纳科技有限公司 High-availability communication method and system for storage cluster based on iSCSI protocol

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101359279A (en) * 2008-10-06 2009-02-04 浪潮电子信息产业股份有限公司 ISCSI disc array controller with internal path redundant function

Family Cites Families (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7809833B2 (en) * 2008-07-15 2010-10-05 International Business Machines Corporation Asymmetric dynamic server clustering with inter-cluster workload balancing
CN102104600B (en) * 2011-01-11 2014-01-08 广州懒游网络技术有限公司 Distributed pluggable game server platform and cooperative working method thereof
US10740004B2 (en) * 2015-07-07 2020-08-11 International Business Machines Corporation Efficiently managing movement of large amounts object data in a storage hierarchy
CN106487936A (en) * 2016-12-29 2017-03-08 深圳市优必选科技有限公司 Data transmission method and device and distributed storage system
CN108282516B (en) * 2017-12-21 2021-09-10 深圳创新科技术有限公司 Distributed storage cluster load balancing method and device based on iSCSI
CN109327332B (en) * 2018-09-28 2020-12-01 南京易捷思达软件科技有限公司 LIO-based iSCSI GateWay high-availability implementation method under Ceph cloud storage
CN110046138B (en) * 2019-03-06 2024-03-01 平安科技(深圳)有限公司 iSCSI target multi-instance processing method and distributed storage system
CN110034951A (en) * 2019-03-06 2019-07-19 平安科技(深圳)有限公司 The failure switching method and iSCSI major heading device of iscsi target device
CN109981768B (en) * 2019-03-21 2021-12-07 上海霄云信息科技有限公司 IO multi-path planning method and device in distributed network storage system

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101359279A (en) * 2008-10-06 2009-02-04 浪潮电子信息产业股份有限公司 ISCSI disc array controller with internal path redundant function

Also Published As

Publication number Publication date
WO2021051570A1 (en) 2021-03-25
CN110784515A (en) 2020-02-11

Similar Documents

Publication Publication Date Title
CN110784515B (en) Data storage method based on distributed cluster and related equipment thereof
WO2020253347A1 (en) Container cluster management method, device and system
CN107547595B (en) Cloud resource scheduling system, method and device
CN107534570B (en) Computer system, method and medium for virtualized network function monitoring
US9813423B2 (en) Trust-based computing resource authorization in a networked computing environment
US9438476B2 (en) Self-organization of a satellite grid
US10346263B2 (en) Host swap hypervisor that provides high availability for a host of virtual machines
CN107666493B (en) Database configuration method and equipment thereof
US8543680B2 (en) Migrating device management between object managers
CN112698838B (en) Multi-cloud container deployment system and container deployment method thereof
EP3218805B1 (en) Method and system for model-driven, affinity-based, network functions
CN113014611B (en) Load balancing method and related equipment
CN110995480A (en) Block chain network deployment method, device, electronic equipment and medium
CN108073423A (en) A kind of accelerator loading method, system and accelerator loading device
CN114095567A (en) Data access request processing method and device, computer equipment and medium
CN113890879A (en) Load balancing method and device for data access, computer equipment and medium
CN113242299A (en) Disaster recovery system, method, computer device and medium for multiple data centers
JP5268589B2 (en) Information processing apparatus and information processing apparatus operating method
CN105324968A (en) Method and apparatus for allocating reliability resource
CN113242302A (en) Data access request processing method and device, computer equipment and medium
CN107426012B (en) Fault recovery method and device based on super-fusion architecture
CN112491592A (en) Storage resource grouping method, system, terminal and storage medium
CN110474787B (en) Node fault detection method and device
CN106330556B (en) A kind of method and apparatus calling related information for generating service module
CN113238893A (en) Disaster recovery system, method, computer device and medium for multiple data centers

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant