CN114531416A - Method and system for accessing single port of ceph rbd block storage across NAT network segments - Google Patents

Method and system for accessing single port of ceph rbd block storage across NAT network segments Download PDF

Info

Publication number
CN114531416A
CN114531416A CN202111302346.3A CN202111302346A CN114531416A CN 114531416 A CN114531416 A CN 114531416A CN 202111302346 A CN202111302346 A CN 202111302346A CN 114531416 A CN114531416 A CN 114531416A
Authority
CN
China
Prior art keywords
rbd
ceph
port
accessing
nat
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.)
Pending
Application number
CN202111302346.3A
Other languages
Chinese (zh)
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.)
SHANGHAI JINTU INFORMATION TECHNOLOGY CO LTD
Original Assignee
SHANGHAI JINTU INFORMATION TECHNOLOGY 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 SHANGHAI JINTU INFORMATION TECHNOLOGY CO LTD filed Critical SHANGHAI JINTU INFORMATION TECHNOLOGY CO LTD
Priority to CN202111302346.3A priority Critical patent/CN114531416A/en
Publication of CN114531416A publication Critical patent/CN114531416A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/09Mapping addresses
    • H04L61/25Mapping addresses of the same type
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/30Peripheral units, e.g. input or output ports

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention provides a method and a system for accessing a single ceph rbd block storage port across an NAT network segment, which comprises the following steps: accessing an internal local area network through the Internet according to the command request; the network address of the internet and the internal local area network is converted, and the ceph service is accessed after matching; vdisks are accessed through a port mapping with multiple osd process port numbers. The invention realizes the access of a single port of ceph rbd block storage across NAT network segments by using the rbd agent. Only the rbd agent needs to be configured for realizing the single port of the ceph rbd block storage of the cross-NAT network segment, thereby reducing the abuse of the public network port, avoiding the resource waste, reducing the complexity of the design and the realization of the application software for accessing the storage, and reducing the failure rate of storage reading and writing.

Description

Method and system for accessing single port of ceph rbd block storage across NAT network segments
Technical Field
The invention relates to the technical field of computer communication, in particular to a method, a system and a storage medium for accessing a ceph rbd block storage single port of a cross-NAT network segment.
Background
Multiple terminals are distributed in various places, access to internal ports of the server through a public network, and need to perform NAT port mapping on a local area network where the server is located. The multiple osd processes of the service end ceph occupy multiple port numbers, if there is no unified port access, multiple public network mapping ports are needed, the mapping rule is complex, and the abuse of the ports is caused.
Disclosure of Invention
The invention aims to provide a ceph rbd block storage single port access method and a system of a cross-NAT network segment, so as to solve the problems in the background technology.
In order to achieve the purpose, the invention provides the following technical scheme:
a ceph rb block storage single port access method crossing NAT network segments comprises the following steps:
accessing an internal local area network through the Internet according to the command request;
the network address of the internet and the internal local area network is converted, and the ceph service is accessed after matching;
the vdisk is accessed through a port to osd process port number mapping.
Preferably, the internet completes network address translation with an internal local area network through the NAT.
Preferably, there are multiple osd processes for the ceph service.
Preferably, one port communicates with a plurality of osd process port numbers and the local area network by using the rbdproxy protocol, and the mapping relationship between one port and a plurality of osd process port numbers comprises the following steps:
creating an rbdproxy connection;
closing the rbdproxy connection;
creating an rbd;
opening rbd;
obtaining rbd information;
reading the rbd;
and forcibly writing into the hard disk.
In order to achieve the above purpose, the invention also provides the following technical scheme:
a ceph rbd block storage single port access system across NAT segments, comprising:
the client is used for accessing the internal local area network through the Internet according to the command request;
the NAT module is used for converting the network addresses of the Internet and the internal local area network, and accessing ceph service after matching; and
and the rbd proxy module is used for mapping and accessing the vdisk with a plurality of osd process port numbers through one port.
In order to achieve the above purpose, the invention also provides the following technical scheme:
a computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor, when executing the computer program, performs the steps of the method as in any one of the above.
In order to achieve the above purpose, the invention also provides the following technical scheme:
a computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of the preceding claims.
Compared with the prior art, the invention has the beneficial effects that:
the invention realizes the access of a single port of ceph rbd block storage of a cross NAT network segment by using the rbd agent. Only the rbd agent needs to be configured for realizing the single port of the ceph rbd block storage of the cross-NAT network segment, thereby reducing the abuse of the public network port, avoiding the resource waste, reducing the complexity of the design and the realization of the application software for accessing the storage, and reducing the failure rate of storage reading and writing.
Drawings
FIG. 1 is a block diagram of the method of the present invention;
FIG. 2 is a schematic view of the overall structure of the present invention;
FIG. 3 is a block diagram of the apparatus of the present invention;
FIG. 4 is an internal block diagram of the computer apparatus of the present invention;
fig. 5 is a detailed structural diagram of the rbd agent 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 only a part of the embodiments of the present invention, and not all of the embodiments. 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.
Example (b):
referring to fig. 1 to 5, the present invention provides a technical solution:
a ceph rb block storage single port access method crossing NAT network segments comprises the following steps:
s101, accessing an internal local area network through the Internet according to a command request;
s102, converting the network address of the Internet and the internal local area network, and accessing ceph service after matching;
s103, mapping and accessing the vdisk through one port and a plurality of osd process port numbers.
Specifically, the internet completes network address translation with an internal local area network through the NAT.
Specifically, the ceph service has a plurality of osd processes.
The invention discloses a ceph rbd block storage single port access system crossing NAT network segments, which comprises:
the client is used for accessing the internal local area network through the Internet according to the command request;
the NAT module is used for converting the network addresses of the Internet and the internal local area network, and accessing ceph service after matching; and
and the rbd proxy module is used for mapping and accessing the vdisk with a plurality of osd process port numbers through one port.
The invention relates to a computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the steps of the method according to any one of the preceding claims when executing the computer program.
The invention, a computer-readable storage medium, has stored thereon a computer program which, when being executed by a processor, carries out the steps of the method according to any one of the preceding claims.
The invention realizes the single port access of the ceph rbd block storage of the cross NAT network segment based on the ceph rbd agent technology, and can perform single port mapping access on each osd port after the deployment is finished, thereby saving the port resources of the public network, reducing the complexity of the design and implementation of the application software for accessing the storage, and reducing the failure rate of storage reading and writing.
The rbd agent technology:
since ceph can have a plurality of osd processes, and the port number occupied by each osd process is different, terminals in various places can only access the port number of one osd process by mapping the terminals to a public network port through an intranet port, and a plurality of osd processes need to access a plurality of ports; using the rbd proxy technology, a client can complete a service by accessing a single rbd port number, with the rbd proxy communicating with the corresponding osd process port.
Multiple terminals are distributed in various places, access to internal ports of the server through a public network, and need to perform NAT port mapping on a local area network where the server is located. The multiple osd processes of the service end ceph occupy multiple port numbers, if there is no unified port access, multiple public network mapping ports are needed, the mapping rule is complex, and the abuse of the ports is caused.
The invention realizes the single port access of the ceph rbd block storage of the cross NAT network segment based on the ceph rbd agent technology, and can perform single port mapping access on each osd port after the deployment is finished, thereby saving the port resources of the public network, reducing the complexity of the design and implementation of the application software for accessing the storage, and reducing the failure rate of storage reading and writing.
The first module is explained in detail as follows:
1、vdisk
and (5) a virtual machine disk.
2、osd
In a data storage device, a service end ceph service generally has a plurality of osd processes, each osd process occupies one port number of a system, and a plurality of processes occupy multiple processes.
3. rbd proxy
Multiple ports of the system are occupied by osd processes and access to these ports via the internet requires mapping of multiple ports. By using the rbd agent, only one port needs to be mapped, and the communication work with the ports of the osds is completed by the rbd agent.
4. NAT (network address translation)
The internal LAN port is mapped to the public network port, and the client terminals of all the parts can access the service of the server terminal.
5. Client terminal
The program for providing local service for the client needs to be operated with the server.
6. Service terminal
Serving the client, the content of the service such as providing resources to the client, holding client data.
Secondly, in the invention, the specific structure of the rbd agent is shown in figure 5,
the rbdproxy SDK and the rbdproxy protocol are used for communication:
1、rbdproxy SDK
the rbdproxy SDK is a new SDK developed for facilitating the access to an external single port on the basis of an RBD SDK provided by a ceph official;
the rbdproxy SDK file defines a plurality of interfaces for accessing and operating the rbd, and the specific steps are as follows:
int rbsproxy _ connect (connect char host, unsigned short port, rbsproxy _ ioctx _ t ioctx); // create rbdproxy connection
int rbdproxy _ shutdown (rbdproxy _ ioctx _ t ioctx); // close rbdproxy connection
int rbproxy _ rbd _ create (rbproxy _ ioctx _ t ioctx, con char _ pool, con char _ image, unidimed long int size); // create rbd
int rbproxy _ rbd _ open (rbproxy _ ioctx _ t ioctx, const char _ pool, const char _ image); // opening rbd
int rbdproxy _ rbd _ close (rbdproxy _ ioctx _ t ioctx); // close rbd
int rbsproxy _ rbd _ info (rbsproxy _ ioctx _ t ioctx, rbsproxy _ image _ info _ t info); // obtaining rbd information
int rbdproxy_rbd_trucate(rbdproxy_ioctx_t ioctx,unsigned long int offset);//
int rodexy _ rbd _ aio _ read (rbsproxy _ ioctx _ t icctx, signed long int offset, signed long int size, char buf, rbsproxy _ completion _ t c); // read rbd
int rbsproxy _ rbd _ aio _ write (rbsproxy _ ioctx _ t ioctx, assigned long int offset, assigned long int size, const char buf, rbsproxy _ completion _ t c); // write rbd
int rbdproxy _ rbd _ aio _ flush (rbdproxy _ ioctx _ t ioctx, rbdproxy _ completion _ tc); // force write hard disk
int rbdproxy_rhd_aio_discard(rbdproxy_ioctx_t ioctx,unsigned long int offset,unsigned long int size,rbdproxy_completion_t c);//
int rbdproxy_rbd_invalidate_cache(rbdproxy_ioctx_t ioctx);//。
2. rbdproxy protocol
The rbdproxy protocol is a PDU (protocol data unit) protocol, and is an autonomously developed protocol for realizing rbdproxy communication;
the rbdproxy PDU protocol constructs a plurality of structures corresponding to the rbdproxy SDK, and the specific steps are as follows:
defining basic types of pdu protocol
Typedef enum_ProxyPDUType{
RBD_CREATE=1,
RBD_OPEN,
RBD_CLOSE,
RBD_INFO,
RBD_TRUCATE,
RBD_AIO_READ,
RBD_AIO_WRITE,
RBD_AIO_FLUSH,
RBD_AIO_DISCARD,
RBD_INVALIDATE_CACHE,
//response pdu
RBD_RESP_EC,
RBD_RESP_DATA
}ProxyPDUType;
The concrete implementation basic steps are as follows:
(1) create rbd proxy connection: calling a function rbdproxy _ connect () in the rbdproxy SDK, designating a host and a single port, and creating an rbdproxy connection;
(2) create an rbd connection: calling a function rbdproxy _ rbd _ create () in an rbdproxy SDK, transmitting pool _ name and image _ name, and designating pool _ name _ size and image _ name _ size by combining an rbdproxy PDU protocol to create an rbd connection;
the rbdproxy PDU protocol defines the specific structure of the module as follows:
typedef struct_ProxyRBDCreatePDUHeader{
ProxyPDUHeader header;
unsigned int pool_name_size;
unsigned int image_name_size;
char padding[4];
unsigned long int size;
ProxyRBDCreatePDUHeader;
typedef struct_ProxyRBDCreatePDU{
ProxyRBDCreatePDUHeader header;
unsigned long int payload_tail_index;
char*payload;
}ProxyRBDCreatePDU;
(3) opening the rbd connection: calling a function rbdproxy _ rbd _ open () in an rbdproxy SDK, transmitting pool _ name and image _ name, and designating pool _ name _ size and image _ name _ size by combining an rbdproxy PDU protocol, and opening an rbd connection;
the rbdproxy PDU protocol defines the specific structure of the module as follows:
typedef struct_ProxyRBDOpenPDUHeader{
ProxyPDUHeader header;
unsigned int pool_name_size;
unsigned int image_name_size;
}ProxyRBDOpenPDUHeader;
typedef struct_ProxyRBDOpenPDU{
ProxyRBDOpenPDUHeader header;
unsigned long int payload_tail_index;
char*payload;
}ProxyRBDOpenPDU;
(4) read rbd data: calling a function rbdproxy _ RBD _ aio _ read () in an rbdproxy SDK, and combining a structural body ProxyRBDAiorReadPDU of an rbdproxy PDU protocol to finish data asynchronous reading of RBD;
the rbdproxy PDU protocol defines the specific structure of the module as follows:
typedef struct_ProxyRBDAioReadPDUHeader{
ProxyPDUHeader header;
char padding[4];
AioReqID req_id;
unsigned long int offset;
unsigned long int size;
}ProxyRBDAioReadPDUHeader;
typedef struct_ProxyRBDAioReadPDU{
ProxyRBDAioReadPDUHeader header;
}ProxyRBDAioReadPDU;
(5) writing rbd data: calling a function rbdproxy _ RBD _ aio _ write in an rbdproxy SDK, and combining a structural body ProxyRBDAioWritePDU of an rbdproxy PDU protocol to finish data asynchronous writing of an RBD;
the rbdproxy PDU protocol defines the specific structure of the module as follows:
typedef struct_ProxyRBDAiowritePDUHeader{
ProxyPDUHeader header;
char padding[4];
AioReqID req_id;
unsigned long int offset;
unsigned long int size;
}ProxyRBDAioWritePDUHeader;
typedef struct_ProxyRBDAioWritePDU{
ProxyRBDAioWritePDUHeader header;
unsigned long int payload_tail_index;
char*payload;
}ProxyRBDAioWritePDU;
(6) closing the rbd connection: calling a function rbdproxy _ rbd _ close (), combining a structural body ProxyRBDClosePDU of an rbdproxy PDU protocol, and closing the rbd connection;
the rbdproxy PDU protocol defines the specific structure of the module as follows:
typedef struct_ProxyRBDClosePDU{
ProxyPDUHeader header;
}ProxyRBDClosePDU;
typedef struct_ProxyRBDInfoPDU{
ProxyPDUHeader header;
}ProxyRBDInfoPDU;
(7) closing the rbd proxy connection: and calling a function rbdproxy _ shutdown () in the rbdproxy SDK, and closing the rbdproxy connection.
The invention realizes the access of a single port of ceph rbd block storage of a cross NAT network segment by using the rbd agent. Only the rbd agent needs to be configured for realizing the single port of the ceph rbd block storage of the cross-NAT network segment, thereby reducing the abuse of the public network port, avoiding the resource waste, reducing the complexity of the design and the realization of the application software for accessing the storage, and reducing the failure rate of storage reading and writing.
The invention, the remaining parts not described, are the same as, or known or realizable by the prior art and will not be described in detail here.
Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that changes, modifications, substitutions and alterations can be made in these embodiments without departing from the principles and spirit of the invention, the scope of which is defined in the appended claims and their equivalents.

Claims (6)

1. A ceph rb block storage single port access method crossing NAT network segments is characterized by comprising the following steps:
accessing an internal local area network through the Internet according to the command request;
the network address of the internet and the internal local area network is converted, and the ceph service is accessed after matching;
vdisks are accessed through a port mapping with multiple osd process port numbers.
2. The method of claim 1, wherein the internet performs network address translation with an internal local area network through the NAT.
3. The method of claim 1, wherein there are multiple osd processes for ceph services.
4. A ceph rb block storage single port access system across NAT segments, comprising:
the client is used for accessing the internal local area network through the Internet according to the command request;
the NAT module is used for converting the network addresses of the Internet and the internal local area network, and accessing ceph service after matching; and
and the rbd proxy module is used for mapping and accessing the vdisk with a plurality of osd process port numbers through one port.
5. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method according to any of claims 1 to 3.
6. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 3.
CN202111302346.3A 2021-11-04 2021-11-04 Method and system for accessing single port of ceph rbd block storage across NAT network segments Pending CN114531416A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111302346.3A CN114531416A (en) 2021-11-04 2021-11-04 Method and system for accessing single port of ceph rbd block storage across NAT network segments

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111302346.3A CN114531416A (en) 2021-11-04 2021-11-04 Method and system for accessing single port of ceph rbd block storage across NAT network segments

Publications (1)

Publication Number Publication Date
CN114531416A true CN114531416A (en) 2022-05-24

Family

ID=81619431

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111302346.3A Pending CN114531416A (en) 2021-11-04 2021-11-04 Method and system for accessing single port of ceph rbd block storage across NAT network segments

Country Status (1)

Country Link
CN (1) CN114531416A (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140025770A1 (en) * 2012-07-17 2014-01-23 Convergent.Io Technologies Inc. Systems, methods and devices for integrating end-host and network resources in distributed memory
CN111800341A (en) * 2020-07-03 2020-10-20 珠海金山网络游戏科技有限公司 Cross-router terminal communication method and device
CN112583760A (en) * 2019-09-27 2021-03-30 中移(苏州)软件技术有限公司 Object storage access method, device, equipment and computer storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140025770A1 (en) * 2012-07-17 2014-01-23 Convergent.Io Technologies Inc. Systems, methods and devices for integrating end-host and network resources in distributed memory
CN112583760A (en) * 2019-09-27 2021-03-30 中移(苏州)软件技术有限公司 Object storage access method, device, equipment and computer storage medium
CN111800341A (en) * 2020-07-03 2020-10-20 珠海金山网络游戏科技有限公司 Cross-router terminal communication method and device

Similar Documents

Publication Publication Date Title
US6907457B2 (en) Architecture for access to embedded files using a SAN intermediate device
US11960430B2 (en) Remote mapping method, apparatus and device for computing resources, and storage medium
CN113904938B (en) System and method for dynamically configuring PCIe terminal equipment
US11829309B2 (en) Data forwarding chip and server
CN112905304B (en) Communication method and device between virtual machines, physical host and medium
KR20140021677A (en) Method and apparatus for remote delivery of managed usb services via a mobile computing device
CN110955517B (en) Message forwarding method, computer equipment and intermediate equipment
US20150113114A1 (en) Network interface adapter registration method, driver, and server
TW200522583A (en) IP-based method and apparatus for booting computers remotely in wide-area-network environment
EP4155925A1 (en) Data transmission method, processor system, and memory access system
CN101937406A (en) Method and system for driving 1394 devices in VxWorks operating system
US9069592B2 (en) Generic transport layer mechanism for firmware communication
WO2024082944A1 (en) Method and apparatus for data exchange between multiple processors, device, and storage medium
CN114996185A (en) Cross-address space bridging
CN101369987B (en) Method and apparatus for establishing communication channel
CN114172905A (en) Method and device for cluster network networking, computer equipment and storage medium
CN113821309B (en) Communication method, device, equipment and storage medium between microkernel virtual machines
CN111459632A (en) Serial port agent for calling terminal application program and implementation method
CN114584526B (en) ARP protocol processing method, system, storage medium and electronic equipment
CN115622878A (en) Method and device for realizing k8s network bridge plug-in, electronic equipment and readable storage medium
CN115576654A (en) Request processing method, device, equipment and storage medium
CN115543894A (en) Storage system, data processing method and device, storage medium and electronic device
CN113098955B (en) Data transmission method, device and equipment and computer readable storage medium
CN114531416A (en) Method and system for accessing single port of ceph rbd block storage across NAT network segments
JP2024501713A (en) Data access methods and related devices

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