CN110266665B - Connection method, device and equipment of network block equipment and readable storage medium - Google Patents

Connection method, device and equipment of network block equipment and readable storage medium Download PDF

Info

Publication number
CN110266665B
CN110266665B CN201910484976.3A CN201910484976A CN110266665B CN 110266665 B CN110266665 B CN 110266665B CN 201910484976 A CN201910484976 A CN 201910484976A CN 110266665 B CN110266665 B CN 110266665B
Authority
CN
China
Prior art keywords
nbd
requests
ceph
rbd
devices
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
CN201910484976.3A
Other languages
Chinese (zh)
Other versions
CN110266665A (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 CN201910484976.3A priority Critical patent/CN110266665B/en
Publication of CN110266665A publication Critical patent/CN110266665A/en
Application granted granted Critical
Publication of CN110266665B publication Critical patent/CN110266665B/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/14Session management
    • H04L67/141Setup of application sessions
    • 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]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a method, a device, equipment and a readable storage medium for connecting network block equipment, wherein the method comprises the following steps: when the starting of an rbd-nbd process is detected, the number of core CPUs of a Ceph client is obtained to determine that a first number of port pair structure sockets are generated, wherein the sockets are connected with a network block nbd device and the rbd-nbd process; if a plurality of io requests of a Ceph client are detected, sending a first number of sockets to target nbd devices respectively pointed by the io requests according to the plurality of io requests so as to respectively establish first connections between the target nbd devices and rbd-nbd processes; forwarding the plurality of io requests to a Ceph cluster based on the first connection to obtain processed data. The invention solves the technical problem that the processing performance of the Rbd equipment cannot be fully exerted in the prior art.

Description

Connection method, device and equipment of network block equipment and readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a readable storage medium for connecting network block devices.
Background
The Ceph distributed system comprises a Ceph client and a Ceph cluster, wherein the Ceph client comprises a network block device (network block device), the network block device is abbreviated as an nbd device, the nbd device is a block device widely used by a linux system of the Ceph client, the Ceph client can locally select a created nbd device, the created nbd device is connected with the rbd device of the Ceph cluster through a preset nbd protocol, specifically, the rbd device can be understood as a storage volume in the Ceph cluster, it needs to be noted that in the Ceph distributed system, reading and writing on the Nbd device of the Ceph client needs to be converted into reading and writing on the rbd device in the Ceph cluster, reading and writing contents of the rbd device are obtained after the reading and writing of the rbd device in the Ceph cluster are completed, and the reading and writing contents of the rbd device are returned to the Ceph client.
The nbd device of the Ceph client is connected with the Rbd device of the Ceph cluster through the established Rbd _ nbd process, when the connection between the nbd _ nbd process and the Ceph cluster is established, a port is created to construct a socket so as to forward a plurality of io requests of upper-layer application, then the Rbd _ nbd process reads a plurality of io requests from the socket in a numerical sequence and forwards the io requests to the Rbd device, and the Rbd device is of a distributed storage type, can simultaneously process a plurality of requests, reads a plurality of io requests from the socket in a numerical sequence, and cannot fully play the processing performance of the Rbd device.
Disclosure of Invention
The invention mainly aims to provide a connection method, a connection device and a readable storage medium of a network block device, and aims to solve the technical problem that in the prior art, a plurality of io requests are sequentially read from a port pair structure socket, and the processing performance of an Rbd device cannot be fully exerted.
In order to achieve the above object, the present invention provides a method for connecting network block devices, where the method for connecting network block devices is applied to a Ceph client in a Ceph distributed system, and the method for connecting network block devices includes:
when the starting of an rbd-nbd process is detected, the number of core CPUs of the Ceph client is obtained, and a port pair structure socket with a first number is determined and generated according to the number of the core CPUs, wherein the socket is connected with a network block nbd device and the rbd-nbd process;
if a plurality of io requests of the Ceph client are detected, sending the sockets with the first number to target nbd devices respectively pointed by the plurality of io requests according to the plurality of io requests so as to respectively establish first connections between the target nbd devices and the rbd-nbd processes;
and forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection, so that the Ceph cluster can process the plurality of io requests to obtain processed data.
Optionally, if a plurality of io requests of the Ceph client are detected, sending the first number of sockets to target nbd devices respectively pointed to by the plurality of io requests according to the plurality of io requests, so as to respectively establish a first connection between the target nbd devices and the rbd-nbd process, where the first connection includes:
if a plurality of io requests of the Ceph client are detected, acquiring a second number of target nbd devices respectively pointed to by the plurality of io requests;
comparing the first number with the second number, and if the first number is smaller than or equal to the second number, sending the socket with the first number to a plurality of target nbd devices respectively pointed by the io requests so as to respectively establish first connection between the target nbd devices and the rbd-nbd processes;
and if the first number is larger than the second number, selecting the second number of sockets from the first number of sockets and sending the second number of sockets to target nbd devices pointed by the io requests respectively so as to establish first connections between the target nbd devices and the rbd-nbd processes respectively.
Optionally, the step of sending the first number of sockets to target nbd devices to which the io requests respectively point, so as to respectively establish a first connection between the target nbd devices and the rbd-nbd process includes:
sending the first number of sockets to target nbd devices respectively pointed by the io requests so as to respectively establish first connection between the target nbd devices and the rbd-nbd processes;
and sending the plurality of io requests to the socket through the target nbd device, and forwarding the plurality of io requests in the socket to the rbd-nbd process, wherein the rbd-nbd process establishes a thread read request for each socket.
Optionally, the step of sending a plurality of io requests to the socket via the target nbd device and forwarding the plurality of io requests in the socket to the rbd-nbd process includes:
and sending the plurality of io requests to the socket through the target nbd device, forwarding the plurality of io requests in the socket to the rbd-nbd process, and creating identification marks of the forwarding sockets of the plurality of io requests in the rbd-nbd process.
Optionally, the step of forwarding, based on the first connection, the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system, so that the Ceph cluster performs processing on the plurality of io requests, so as to obtain processed data includes:
forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection, so that the Ceph cluster can process the plurality of io requests to obtain processed data, wherein the processed data carries an identification mark of the forwarding socket;
and feeding back the processing data to the target nbd equipment respectively pointed by the plurality of io requests based on the identification mark of the forwarding socket in the processing data.
Optionally, the step of forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection includes:
and if detecting that a plurality of io requests exist in each socket, sequentially forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in the Ceph distributed system based on the first connection.
The present invention also provides a connection device for a network block device, where the connection device for the network block device is applied to a Ceph client in a Ceph distributed system, and the connection device for the network block device includes:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring the number of core CPUs of a Ceph client when detecting that an rbd-nbd process is started, and determining and generating a port pair structure socket with a first number according to the number of the core CPUs, wherein the socket is connected with a network block nbd device and the rbd-nbd process;
a first sending module, configured to send, according to a plurality of io requests when the plurality of io requests of the Ceph client are detected, the first number of sockets to target nbd devices to which the plurality of io requests respectively point, so as to establish first connections between the target nbd devices and the rbd-nbd processes respectively;
and the second sending module is used for forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection, so that the Ceph cluster can process the plurality of io requests to obtain processing data.
Optionally, the first sending module comprises:
an obtaining unit, configured to obtain, if a plurality of io requests of the Ceph client are detected, a second number of target nbd devices to which the plurality of io requests respectively point;
a comparing unit, configured to compare the first number with the second number, and if the first number is smaller than or equal to the second number, send the sockets of the first number to target nbd devices respectively pointed to by the io requests, so as to respectively establish first connections between the target nbd devices and the rbd-nbd processes;
and the selecting unit is used for selecting the second number of sockets from the first number of sockets and sending the second number of sockets to the target nbd devices pointed by the io requests respectively so as to establish first connection between the target nbd devices and the rbd-nbd process respectively if the first number is greater than the second number.
Optionally, the alignment unit includes:
a building subunit, configured to send the first number of sockets to target nbd devices to which the io requests respectively point, so as to respectively build first connections between the target nbd devices and the rbd-nbd processes;
and the forwarding subunit is configured to send the plurality of io requests to the socket via the target nbd device, and forward the plurality of io requests in the socket to the rbd-nbd process, where the rbd-nbd process establishes a thread read request for each socket.
Optionally, the forwarding subunit is configured to implement:
and sending the plurality of io requests to the socket through the target nbd device, forwarding the plurality of io requests in the socket to the rbd-nbd process, and creating identification marks of the forwarding sockets of the plurality of io requests in the rbd-nbd process.
Optionally, the forwarding subunit is further configured to implement:
forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection, so that the Ceph cluster can process the plurality of io requests to obtain processed data, wherein the processed data carries an identification mark of the forwarding socket;
and feeding back the processing data to the target nbd equipment respectively pointed by the plurality of io requests based on the identification mark of the forwarding socket in the processing data.
Optionally, the second sending module includes:
and the detection unit is used for sequentially forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in the Ceph distributed system based on the first connection if the plurality of io requests are detected to exist in each socket.
In addition, to achieve the above object, the present invention also provides a connection device of a network block device, including: a memory, a processor, a communication bus, and a connection program for a network block device stored on the memory.
The communication bus is used for realizing communication connection between the processor and the memory;
the processor is used for executing the connection program of the network block device to realize the following steps:
when detecting that an rbd-nbd process is started, acquiring the number of core CPUs of the Ceph client, and determining to generate a first number of port pair structure sockets according to the number of the core CPUs, wherein the sockets are connected with a network block nbd device and the rbd-nbd process;
if a plurality of io requests of the Ceph client are detected, sending the sockets with the first number to target nbd devices respectively pointed by the plurality of io requests according to the plurality of io requests so as to respectively establish first connections between the target nbd devices and the rbd-nbd processes;
and forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in the Ceph distributed system based on the first connection, so that the Ceph cluster can process the plurality of io requests to obtain processed data.
Further, to achieve the above object, the present invention also provides a readable storage medium storing one or more programs, the one or more programs being executable by one or more processors for:
when the starting of an rbd-nbd process is detected, the number of core CPUs of the Ceph client is obtained, and a port pair structure socket with a first number is determined and generated according to the number of the core CPUs, wherein the socket is connected with a network block nbd device and the rbd-nbd process;
if a plurality of io requests of the Ceph client are detected, sending the sockets with the first number to target nbd devices respectively pointed by the plurality of io requests according to the plurality of io requests so as to respectively establish first connections between the target nbd devices and the rbd-nbd processes;
and forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in the Ceph distributed system based on the first connection, so that the Ceph cluster can process the plurality of io requests to obtain processed data.
According to the method, when the start of an rbd-nbd process is detected, the number of core CPUs of a Ceph client is obtained, and a port pair structure socket with a first number is determined to be generated according to the number of the core CPUs, wherein the socket is connected with a network block nbd device and the rbd-nbd process; if a plurality of io requests of the Ceph client are detected, sending the sockets with the first number to target nbd devices respectively pointed by the plurality of io requests according to the plurality of io requests so as to respectively establish first connections between the target nbd devices and the rbd-nbd processes; and forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection, so that the Ceph cluster can process the plurality of io requests to obtain processed data. In the application, the port pair structure socket with the first number is determined and generated according to the number of the core CPUs, the number of the core CPUs is multi-core, therefore, the port pair structure socket is a plurality, forwarding a plurality of io requests according to the plurality of sockets and the corresponding rbd-nbd process, for the Ceph cluster to perform the processing of the plurality of io requests, so as to obtain processing data, that is, in this embodiment, when the rbd-nbd process and the nbd device establish connection, a mode of creating a plurality of sockets, so that there are multiple sockets between the nbd device and the rbd nbd process for io forwarding, and the sequential reading of a plurality of io requests from the socket is not only achieved, so that the processing performance of the Rbd device can be fully exerted, and the technical problem that the processing performance of the Rbd device cannot be fully exerted by sequentially reading a plurality of io requests from the socket in the prior art is solved.
Drawings
Fig. 1 is a flowchart illustrating a first embodiment of a connection method for a network block device according to the present invention;
fig. 2 is a detailed flowchart illustrating a first connection step of sending, according to a plurality of io requests, a first number of sockets to a target nbd device to which the plurality of io requests respectively point when the plurality of io requests of the Ceph client are detected, so as to respectively establish the target nbd device and the rbd-nbd process according to the plurality of io requests in the second embodiment of the connection method for network block devices according to the present invention;
FIG. 3 is a schematic diagram of an apparatus architecture of a hardware operating environment to which a method of an embodiment of the invention relates;
FIG. 4 is a schematic diagram of a scenario involving a method of an embodiment of the present invention;
fig. 5 is a schematic overall flow chart related to the method according to the embodiment of the invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In a first embodiment of the method for connecting network block devices according to the present invention, referring to fig. 1, the method for connecting network block devices is applied to a Ceph client in a Ceph distributed system, and the method for connecting network block devices includes:
step S10, when detecting that the rbd-nbd process is started, acquiring the number of core CPUs of the Ceph client, and determining and generating a port pair structure socket with a first number according to the number of the core CPUs, wherein the socket is connected with a network block nbd device and the rbd-nbd process;
step S20, if a plurality of io requests of the Ceph client are detected, sending the first number of sockets to a plurality of target nbd devices respectively pointed by the io requests according to the plurality of io requests so as to respectively establish first connections between the target nbd devices and the rbd-nbd processes;
step S30, forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection, so that the Ceph cluster performs processing on the plurality of io requests to obtain processed data.
The method comprises the following specific steps:
step S10, when detecting that the rbd-nbd process is started, acquiring the number of core CPUs of the Ceph client, and determining and generating a port pair structure socket with a first number according to the number of the core CPUs, wherein the socket is connected with a network block nbd device and the rbd-nbd process;
it should be noted that, in this embodiment, the Ceph distributed system includes a Ceph client, and the Ceph distributed system further includes a Ceph cluster, as shown in fig. 4, in this embodiment, it is implemented that the Ceph client maps data content in the Ceph cluster to a local client through a mapping network driver, that is, the Ceph client maps data content in the Ceph cluster to a local (Ceph client) through the mapping network driver, an rbd-nbd process needs to be triggered by the Ceph client in a manual manner, where two ends of the rbd-nbd process are respectively the Ceph client and the Ceph cluster, the rbd-nbd process is triggered in the manual manner, that is, the Ceph cluster is selected by the user at the Ceph client, and a local disk is selected, after the selection is completed, an rbd-nbd process is created by an operation such as a click, and after the d-rbd process is determined to be created, creating nbd equipment in a local disk of a Ceph client based on the rbd-nbd process, wherein after the nbd equipment is created, a user can read or write data of the Ceph cluster into the local nbd equipment to finish reading and writing of the local nbd equipment, and changing the mode, namely the reading and writing on the nbd equipment of the Ceph client needs to be converted into the reading and writing on the rbd equipment in the Ceph cluster, and after the reading and writing of the rbd equipment in the Ceph cluster are finished, the reading and writing content of the rbd equipment is obtained and returned to the nbd equipment of the Ceph client to finish the reading and writing of the nbd equipment of the Ceph client.
For convenience of understanding, a Ceph cluster can be used as an online neighbor device, if data content in the online neighbor device is to be read locally, a user needs to determine an address of the online neighbor device and a local disk first, after the address of the online neighbor device and the local disk are determined, an rbd-nbd process is triggered, an nbd device is created in the local disk according to the rbd-nbd process, corresponding content is acquired from an online neighbor based on the rbd-nbd process, and the corresponding content is stored in the nbd device to determine that reading and writing of the nbd device are completed.
In this embodiment, when detecting that an rbd-nbd process is started, acquiring the number of core CPUs of the Ceph client, where the number of core CPUs may generally be 2 cores or 4 cores, and the rbd-nbd process determines to generate a first number of port-to-structure sockets according to the number of core CPUs, that is, the number of sockets created by the rbd-nbd process is the same as the number of core CPUs, each core CPU corresponds to one socket, when the number of core CPUs is 2, the number of port-to-structure sockets of the first number is 2, and when the number of core CPUs is 4, the number of port-to-structure sockets of the first number is 4, and because each core CPU corresponds to one socket, a plurality of io requests processed by the core CPU are all forwarded to the socket corresponding to the core CPU.
Step S20, if a plurality of io requests of the Ceph client are detected, sending, according to the plurality of io requests, the first number of sockets to target nbd devices to which the plurality of io requests respectively point, so as to respectively establish first connections between the target nbd devices and the rbd-nbd processes;
in this embodiment, after a first number of port pair structure sockets are generated, if a plurality of io requests of the Ceph client are detected, the first number of sockets are sent to a plurality of target nbd devices to which the io requests respectively point according to the plurality of io requests, so as to respectively establish first connections between the target nbd devices and the rd-nbd processes, specifically, as shown in fig. 4, it is required to say that a socket is generated by a rd-nbd process, after a socket is generated, if a plurality of io requests are detected, a plurality of network block nbd devices are created based on the plurality of io requests, after a network block device is created, different core CPUs send the plurality of io requests to the corresponding plurality of nbd devices, it is required to say that, when a plurality of io requests are to be processed, the plurality of io requests are allocated to the target nbd devices according to processing capabilities and idle states of the different core CPUs, in the prior art, only one socket is connected with all the network block nbd devices, and one socket is connected with all the network block nbd devices, so that a plurality of io requests can be queued in the socket in order to be sequentially acquired by the rd-nbd processes, and the rd-nbd processes are distributed corresponding to the other end of the rd devices, that is, the rd devices can process a plurality of io requests in a parallel mode, and can be acquired sequentially after the plurality of io requests are queued in the socket.
It should be noted that, in this embodiment, if a plurality of io requests of the Ceph client are detected, the first number of sockets are sent to the target nbd devices to which the plurality of io requests respectively point according to the plurality of io requests, so as to respectively establish first connections between the target nbd devices and the rbd-nbd processes.
Referring to fig. 2, when a plurality of io requests of the Ceph client are detected, the first connecting step of sending, according to the plurality of io requests, the first number of sockets to target nbd devices respectively pointed to by the plurality of io requests, so as to respectively establish the target nbd devices and the rbd-nbd processes includes:
step S21, if a plurality of io requests of the Ceph client are detected, acquiring a second number of target nbd devices to which the plurality of io requests respectively point;
in this embodiment, the second number of target nbd devices is obtained for comparing the number of target nbd devices with the number of sockets.
Step S22, comparing the first number with the second number, and if the first number is less than or equal to the second number, sending the sockets of the first number to target nbd devices respectively pointed by the io requests, so as to respectively establish first connections between the target nbd devices and the rbd-nbd processes;
in this embodiment, the first number is compared with the second number, and if the first number is less than or equal to the second number, it is determined that a plurality of target nbd devices share one socket, and at this time, a plurality of io requests need to share one socket, so that the socket number is required to be the first number and all distributed to the corresponding target nbd devices, that is, the socket of the first number is sent to the target nbd devices to which the io requests respectively point.
Step S23, if the first number is greater than the second number, selecting the second number of sockets from the first number of sockets, and sending the selected second number of sockets to target nbd devices to which the io requests respectively point, so as to respectively establish first connections between the target nbd devices and the rbd-nbd processes.
In this embodiment, if the first number is greater than or equal to the second number, the number of target nbd devices is less than that of sockets, and at this time, the second number of sockets is selected from the first number of sockets and sent to the target nbd devices to which the io requests respectively point, so as to respectively establish the first connections between the target nbd devices and the rd-nbd processes, that is, avoid the waste of sockets.
Wherein the step of sending the first number of sockets to a plurality of target nbd devices to which the io requests respectively point to establish first connections between the target nbd devices and the rbd-nbd processes respectively includes:
step S231, sending the first number of sockets to a plurality of target nbd devices respectively pointed by the io requests so as to respectively establish first connections between the target nbd devices and the rbd-nbd processes;
it should be noted that, in this embodiment, the first number of sockets is sent to the target nbd devices to which the io requests respectively point, so as to respectively establish first connections between the target nbd devices and the rbd-nbd processes, that is, to establish multiple first connections.
Step S232, sending the plurality of io requests to the socket via the target nbd device, and forwarding the plurality of io requests in the socket to the rbd-nbd process, where the rbd-nbd process establishes a thread read request for each socket.
In this embodiment, the rbd-nbd process establishes a thread read request for each socket, that is, in the rbd-nbd process, a thread read request is established for each socket, so as to read an io request from each socket, so as to implement concurrent forwarding of io requests in different sockets.
Step S30, forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection, so that the Ceph cluster performs processing on the plurality of io requests to obtain processed data.
After the first connection is determined, forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in the Ceph distributed system based on the first connection, so that the Ceph cluster performs processing on the plurality of io requests to obtain processed data, where it needs to be noted that the Ceph cluster is distributed, and therefore, an rbd device in the Ceph cluster can perform synchronous processing on the plurality of io requests, and therefore, resources of the rbd device can be effectively utilized, and waste of resources is avoided.
According to the method, when the start of an rbd-nbd process is detected, the number of core CPUs of a Ceph client is obtained, and a port pair structure socket with a first number is determined to be generated according to the number of the core CPUs, wherein the socket is connected with a network block nbd device and the rbd-nbd process; if a plurality of io requests of the Ceph client are detected, sending the first number of sockets to a plurality of target nbd devices respectively pointed by the io requests according to the plurality of io requests so as to respectively establish first connections between the target nbd devices and the rbd-nbd processes; and forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection, so that the Ceph cluster can process the plurality of io requests to obtain processed data. In the application, a port pair structure socket with a first number is determined and generated according to the number of the core CPUs, the number of the core CPUs is multi-core, therefore, the port pair structure socket is a plurality, forwarding a plurality of io requests according to the plurality of sockets and the corresponding rbd-nbd process, for the Ceph cluster to perform the processing of the plurality of io requests, so as to obtain the processing data, that is, in this embodiment, when the rbd-nbd process and the nbd device establish connection, a mode of creating a plurality of sockets, so that there are multiple sockets between the nbd device and the rbd nbd process that can do io forwarding, and the sequential reading of a plurality of io requests from the socket is not only achieved, so that the processing performance of the Rbd device can be fully exerted, and the technical problem that the processing performance of the Rbd device cannot be fully exerted by sequentially reading a plurality of io requests from the socket in the prior art is solved.
Further, the present invention provides another embodiment of a connection method for a network block device, in this embodiment, the sending, by the target nbd device, a plurality of io requests to the socket, and forwarding the plurality of io requests in the socket to the rd-nbd process includes:
step A1, sending a plurality of io requests to the socket through the target nbd device, forwarding the plurality of io requests in the socket to the rbd-nbd process, and creating a plurality of identification marks of forwarding sockets of the io requests in the rbd-nbd process.
In this embodiment, after the target nbd device sends the plurality of io requests to the socket, an identification tag of a forwarding socket of the plurality of io requests is created in the rbd-nbd process, that is, corresponding tag identification is performed on each io request and the forwarding socket of the io request, where the tag is used to search for a corresponding return path in time and return the processing data after the processing data of the io request is obtained.
Further, in this application, the step of forwarding, based on the first connection, the plurality of io requests to a Ceph cluster corresponding to the Ceph client in the Ceph distributed system, so that the Ceph cluster performs processing on the plurality of io requests to obtain processed data includes:
step B1, forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection, so that the Ceph cluster can process the plurality of io requests to obtain processed data, wherein the processed data carries an identification mark of the forwarding socket;
referring to fig. 5, in this embodiment, the plurality of io requests are forwarded to a Ceph cluster corresponding to the Ceph client in the Ceph distributed system based on the first connection, so that the Ceph cluster performs processing on the plurality of io requests to obtain processed data, after the processed data is obtained, the identification mark of the forwarding socket corresponding to the io request is dropped, and the dropped identification mark of the socket is added to the processed data.
And step B2, based on the identification mark of the forwarding socket in the processing data, feeding back the processing data to the target nbd devices respectively pointed by the io requests.
And acquiring identification marks of forwarding sockets in the processed data to feed the processed data back to a plurality of target nbd devices to which the io requests respectively point, wherein in the process of returning the processed data, the returned data is firstly fed to an rbd-nbd process, and the rbd-nbd process returns the processed data to the corresponding sockets based on the identification marks of the forwarding sockets, so that the processed data is finally fed back to the target nbd devices to which the io requests respectively point and is not fed back by only one socket.
In this embodiment, the plurality of io requests are forwarded to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection, so that the Ceph cluster performs processing on the plurality of io requests to obtain processed data, where the processed data carries an identification mark of the forwarding socket; based on the identification mark of the forwarding socket in the processing data, the processing data is fed back to the target nbd devices to which the io requests respectively point.
Further, in another embodiment of the method for connecting network block devices, the forwarding, based on the first connection, the plurality of io requests to a Ceph cluster corresponding to the Ceph client in the Ceph distributed system includes:
step C1, if it is detected that a plurality of io requests exist in each socket, sequentially forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in the Ceph distributed system based on the first connection.
In this embodiment, there may be a case that each socket needs to forward a plurality of io requests, and if it is detected that a plurality of io requests exist in each socket, the plurality of io requests are sequentially forwarded to a Ceph cluster corresponding to the Ceph client in the Ceph distributed system based on the first connection.
Referring to fig. 3, fig. 3 is a schematic device structure diagram of a hardware operating environment according to an embodiment of the present invention.
The connection device of the network block device in the embodiment of the present invention may be a PC, or may be a terminal device such as a smart phone, a tablet computer, an e-book reader, an MP3 (Moving Picture Experts Group Audio Layer III, motion Picture Experts compression standard Audio Layer 3) player, an MP4 (Moving Picture Experts Group Audio Layer IV, motion Picture Experts compression standard Audio Layer 4) player, a portable computer, or the like.
As shown in fig. 3, the connection device of the network block device may include: a processor 1001, such as a CPU, memory 1005, and a communication bus 1002. The communication bus 1002 is used to realize connection and communication between the processor 1001 and the memory 1005. The memory 1005 may be a high-speed RAM memory or a non-volatile memory such as a disk memory. The memory 1005 may alternatively be a storage device separate from the processor 1001 described previously.
Optionally, the connection device of the network block device may further include a target user interface, a network interface, a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, and the like. The target user interface may comprise a Display (Display), an input unit such as a Keyboard (Keyboard), and the optional target user interface may also comprise a standard wired interface, a wireless interface. The network interface may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface).
Those skilled in the art will appreciate that the connection device configuration of the network block device shown in fig. 3 does not constitute a limitation of the connection device of the network block device and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 3, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, and a connection program of a network block device. The operating system is a program that manages and controls the connected device hardware and software resources of the network block device, supporting the operation of the connected program of the network block device as well as other software and/or programs. The network communication module is used to enable communication between the various components within the memory 1005, as well as with other hardware and software in the network block device's connections.
In the connection device of the network block device shown in fig. 3, the processor 1001 is configured to execute the connection program of the network block device stored in the memory 1005, and implement the steps of the connection method of the network block device described in any one of the above.
The specific implementation of the connection device of the network block device of the present invention is basically the same as the embodiments of the connection method of the network block device, and is not described herein again.
The present invention also provides a connection device for a network block device, where the connection device for the network block device is applied to a Ceph client in a Ceph distributed system, and the connection device for the network block device includes:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring the number of core CPUs of a Ceph client when detecting that an rbd-nbd process is started, and determining and generating a port pair structure socket with a first number according to the number of the core CPUs, wherein the socket is connected with a network block nbd device and the rbd-nbd process;
a first sending module, configured to send, according to a plurality of io requests when the plurality of io requests of the Ceph client are detected, the first number of sockets to target nbd devices to which the plurality of io requests respectively point, so as to establish first connections between the target nbd devices and the rbd-nbd processes respectively;
and the second sending module is used for forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection, so that the Ceph cluster can process the plurality of io requests to obtain processing data.
Optionally, the first sending module includes:
an obtaining unit, configured to obtain, if multiple io requests of the Ceph client are detected, a second number of target nbd devices to which the multiple io requests respectively point;
a comparing unit, configured to compare the first number with the second number, and if the first number is less than or equal to the second number, send the socket with the first number to target nbd devices to which the io requests respectively point, so as to establish first connections between the target nbd devices and the rbd-nbd processes respectively;
and the selecting unit is used for selecting the second number of sockets from the first number of sockets and sending the second number of sockets to the target nbd devices pointed by the io requests respectively so as to establish first connection between the target nbd devices and the rbd-nbd process respectively if the first number is greater than the second number.
Optionally, the alignment unit includes:
a building subunit, configured to send the first number of sockets to target nbd devices to which the io requests respectively point, so as to respectively build first connections between the target nbd devices and the rbd-nbd processes;
and the forwarding subunit is configured to send the plurality of io requests to the socket via the target nbd device, and forward the plurality of io requests in the socket to the rbd-nbd process, where the rbd-nbd process establishes a thread read request for each socket.
Optionally, the forwarding subunit is configured to implement:
and sending the plurality of io requests to the socket through the target nbd device, forwarding the plurality of io requests in the socket to the rbd-nbd process, and creating identification marks of the forwarding sockets of the plurality of io requests in the rbd-nbd process.
Optionally, the forwarding subunit is further configured to implement:
forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection, so that the Ceph cluster can process the plurality of io requests to obtain processed data, wherein the processed data carries an identification mark of the forwarding socket;
and feeding back the processing data to the target nbd equipment respectively pointed by the plurality of io requests based on the identification mark of the forwarding socket in the processing data.
Optionally, the second sending module includes:
and the detection unit is used for sequentially forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in the Ceph distributed system based on the first connection if the plurality of io requests are detected to exist in each socket.
The specific implementation of the connection apparatus of the network block device of the present invention is substantially the same as the embodiments of the connection method of the network block device, and is not described herein again.
The present invention provides a readable storage medium storing one or more programs, which are also executable by one or more processors for implementing the steps of the method for connecting a network block device as described in any one of the above.
The specific implementation of the readable storage medium of the present invention is substantially the same as the embodiments of the connection method of the network block device, and is not described herein again.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by the contents of the present specification and drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A connection method of a network block device is applied to a Ceph client in a Ceph distributed system, and comprises the following steps:
when detecting that an rbd-nbd process is started, acquiring the number of core CPUs of the Ceph client, and determining to generate a first number of port pair structure sockets according to the number of the core CPUs, wherein the sockets are connected with a network block nbd device and the rbd-nbd process;
if a plurality of io requests of the Ceph client are detected, sending the sockets with the first number to target nbd devices respectively pointed by the plurality of io requests according to the plurality of io requests so as to respectively establish first connections between the target nbd devices and the rbd-nbd processes;
and forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection, so that the Ceph cluster can process the plurality of io requests to obtain processed data.
2. The method of connecting network block devices of claim 1,
if a plurality of io requests of the Ceph client are detected, sending the first number of sockets to a plurality of target nbd devices respectively pointed by the io requests according to the plurality of io requests, so as to respectively establish a first connection between the target nbd devices and the rbd-nbd process, wherein the first connection comprises the following steps:
if a plurality of io requests of the Ceph client are detected, acquiring a second number of target nbd devices respectively pointed to by the plurality of io requests;
comparing the first number with the second number, and if the first number is smaller than or equal to the second number, sending the sockets of the first number to a plurality of target nbd devices respectively pointed by the io requests so as to respectively establish first connection between the target nbd devices and the rbd-nbd processes;
and if the first number is larger than the second number, selecting the second number of sockets from the first number of sockets and sending the second number of sockets to a plurality of target nbd devices respectively pointed by the io requests so as to respectively establish first connection between the target nbd devices and the rbd-nbd processes.
3. The method according to claim 2, wherein the step of sending the first number of sockets to target nbd devices respectively pointed to by the io requests to respectively establish the first connections between the target nbd devices and the rbd-nbd processes comprises:
sending the first number of sockets to target nbd devices respectively pointed by the io requests so as to respectively establish first connection between the target nbd devices and the rbd-nbd processes;
and sending the plurality of io requests to the socket through the target nbd device, and forwarding the plurality of io requests in the socket to the rbd-nbd process, wherein the rbd-nbd process establishes a thread read request for each socket.
4. A connection method of a network block device as claimed in claim 3, wherein the step of sending a plurality of the io requests to the socket via the target nbd device and forwarding a plurality of the io requests in the socket to the rbd-nbd process comprises:
and sending the plurality of io requests to the socket through the target nbd device, forwarding the plurality of io requests in the socket to the rbd-nbd process, and creating identification marks of the forwarding sockets of the plurality of io requests in the rbd-nbd process.
5. The method according to claim 4, wherein the step of forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection, so that the Ceph cluster processes the plurality of io requests to obtain processed data comprises:
forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection, so that the Ceph cluster can process the plurality of io requests to obtain processed data, wherein the processed data carries an identification mark of the forwarding socket;
and feeding back the processing data to the target nbd equipment respectively pointed by the plurality of io requests based on the identification mark of the forwarding socket in the processing data.
6. The method of connecting network block devices of claim 1, wherein the step of forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection comprises:
if it is detected that a plurality of io requests exist in each socket, sequentially forwarding the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection.
7. A connection device of a network block device, wherein the connection device of the network block device is applied to a Ceph client in a Ceph distributed system, and the connection device of the network block device comprises:
the system comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is used for acquiring the number of core CPUs of a Ceph client when detecting that an rbd-nbd process is started, and determining and generating a port pair structure socket with a first number according to the number of the core CPUs, wherein the socket is connected with a network block nbd device and the rbd-nbd process;
a first sending module, configured to send, according to a plurality of io requests when the plurality of io requests of the Ceph client are detected, the first number of sockets to target nbd devices to which the plurality of io requests respectively point, so as to establish first connections between the target nbd devices and the rbd-nbd processes respectively;
and a second sending module, configured to forward the plurality of io requests to a Ceph cluster corresponding to the Ceph client in a Ceph distributed system based on the first connection, so that the Ceph cluster performs processing on the plurality of io requests to obtain processed data.
8. The connection apparatus of a network block device of claim 7, wherein the first sending module comprises:
an obtaining unit, configured to obtain, if a plurality of io requests of the Ceph client are detected, a second number of target nbd devices to which the plurality of io requests respectively point;
a comparing unit, configured to compare the first number with the second number, and if the first number is less than or equal to the second number, send the socket with the first number to target nbd devices to which the io requests respectively point, so as to establish first connections between the target nbd devices and the rbd-nbd processes respectively;
and the selecting unit is used for selecting the second number of sockets from the first number of sockets and sending the second number of sockets to the target nbd devices pointed by the io requests respectively so as to establish first connection between the target nbd devices and the rbd-nbd process respectively if the first number is greater than the second number.
9. A connection device of a network block device, characterized in that the connection device of the network block device comprises: a memory, a processor, a communication bus, and a connection program of a network block device stored on the memory,
the communication bus is used for realizing communication connection between the processor and the memory;
the processor is configured to execute a connection program of the network block device to implement the steps of the connection method of the network block device according to any one of claims 1 to 6.
10. A readable storage medium, characterized in that the readable storage medium has stored thereon a connection program of a network block device, which when executed by a processor, implements the steps of the connection method of a network block device according to any one of claims 1-6.
CN201910484976.3A 2019-05-31 2019-05-31 Connection method, device and equipment of network block equipment and readable storage medium Active CN110266665B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910484976.3A CN110266665B (en) 2019-05-31 2019-05-31 Connection method, device and equipment of network block equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910484976.3A CN110266665B (en) 2019-05-31 2019-05-31 Connection method, device and equipment of network block equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN110266665A CN110266665A (en) 2019-09-20
CN110266665B true CN110266665B (en) 2022-08-19

Family

ID=67916841

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910484976.3A Active CN110266665B (en) 2019-05-31 2019-05-31 Connection method, device and equipment of network block equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN110266665B (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104636077A (en) * 2013-11-15 2015-05-20 中国电信股份有限公司 Network block device storage system and method for virtual machine
CN109814996A (en) * 2019-01-04 2019-05-28 平安科技(深圳)有限公司 Streaming media control method, device and storage medium, computer equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7475124B2 (en) * 2002-09-25 2009-01-06 Emc Corporation Network block services for client access of network-attached data storage in an IP network
US20080133654A1 (en) * 2006-12-01 2008-06-05 Chei-Yol Kim Network block device using network asynchronous i/o

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104636077A (en) * 2013-11-15 2015-05-20 中国电信股份有限公司 Network block device storage system and method for virtual machine
CN109814996A (en) * 2019-01-04 2019-05-28 平安科技(深圳)有限公司 Streaming media control method, device and storage medium, computer equipment

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
云存储系统中网络块设备的研究与应用;韦伟等;《计算机与数字工程》;20151220(第12期);全文 *

Also Published As

Publication number Publication date
CN110266665A (en) 2019-09-20

Similar Documents

Publication Publication Date Title
CN107168905B (en) File display method and device, storage medium and mobile terminal
US9699276B2 (en) Data distribution method and system and data receiving apparatus
US11853767B2 (en) Inter-core data processing method, system on chip and electronic device
CN104756080A (en) Augmenting capabilities of a host device
CN110995817B (en) Request callback method and device and client equipment
CN113014510B (en) Data caching method and device in distributed test of inertial navigation system
CN110764688A (en) Method and device for processing data
US8667157B2 (en) Hardware bus redirection switching
CN117033275B (en) DMA method and device between acceleration cards, acceleration card, acceleration platform and medium
CN110321321B (en) Snapshot read-write method, device and equipment for network block equipment and storage medium
CN116820527B (en) Program upgrading method, device, computer equipment and storage medium
CN110266665B (en) Connection method, device and equipment of network block equipment and readable storage medium
US9787755B2 (en) Method and device for browsing network data, and storage medium
CN108112052B (en) Terminal network sharing method and device, air conditioner and storage medium
CN114070892A (en) Data transmission method and device
WO2022089384A1 (en) Data synchronization method and device
CN115114192B (en) Memory interface, functional core, many-core system and memory data access method
CN114422236A (en) Intelligent device access method and device and electronic device
CN110333823B (en) Data migration method, device, equipment and storage medium based on nbd equipment
CN116610648A (en) Log storage method and device, electronic equipment and storage medium
CN111124907A (en) Mobile phone game testing method and device and server
CN106776815B (en) RDMA friendly SPARQ L query method based on multi-mode switching
CN113626086A (en) Multi-core processor starting method and device based on shared starting space
CN112395245A (en) Processor access device and method and computer equipment
CN109144446B (en) Image display method, image display device, electronic equipment and computer readable storage medium

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