WO2021088254A1 - Dual-stack access method, apparatus and device for user-mode network file system - Google Patents

Dual-stack access method, apparatus and device for user-mode network file system Download PDF

Info

Publication number
WO2021088254A1
WO2021088254A1 PCT/CN2020/073116 CN2020073116W WO2021088254A1 WO 2021088254 A1 WO2021088254 A1 WO 2021088254A1 CN 2020073116 W CN2020073116 W CN 2020073116W WO 2021088254 A1 WO2021088254 A1 WO 2021088254A1
Authority
WO
WIPO (PCT)
Prior art keywords
client
address
connection
dual
user
Prior art date
Application number
PCT/CN2020/073116
Other languages
French (fr)
Chinese (zh)
Inventor
臧林劼
Original Assignee
苏州浪潮智能科技有限公司
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 苏州浪潮智能科技有限公司 filed Critical 苏州浪潮智能科技有限公司
Publication of WO2021088254A1 publication Critical patent/WO2021088254A1/en

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]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/176Support for shared access to files; File sharing support
    • 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
    • H04L2101/00Indexing scheme associated with group H04L61/00
    • H04L2101/60Types of network addresses
    • H04L2101/686Types of network addresses using dual-stack hosts, e.g. in Internet protocol version 4 [IPv4]/Internet protocol version 6 [IPv6] networks

Definitions

  • the invention relates to the technical field of file systems, in particular to a user-mode network file system dual-stack access method, a user-mode network file system dual-stack access device, a user-mode network file system dual-stack access device and a computer-readable storage medium.
  • NFS Network File System
  • FreeBSD Free Software-Service Delivery
  • NFS-Ganesha is the kernel network file system, which is one of the file systems supported by FreeBSD. It allows computers on the network to share resources through the TCP/IP network.
  • NFS-Ganesha is a user-mode network file system, which is an open source project. In the case of system service failure, it has better management and maintainability than the kernel-mode network file system, and user-mode NFS-Ganesha is easy to implement and maintain. Therefore, NFS-Ganesha, a large-scale distributed object storage for big data, has great application prospects.
  • the server in the existing user-mode network file system allows only one IP address to access, and there is only one network connection between the server and a client, that is, only IPV4 address access or only IPV6 address access is allowed.
  • the server needs to be restarted to restore the network connection.
  • the operation of restoring the network connection is complicated and costly. Therefore, the existing user-mode network file system has a problem that it is difficult to recover after a network connection failure.
  • the purpose of the present invention is to provide a user-mode network file system dual-stack access method, a user-mode network file system dual-stack access device, a user-mode network file system dual-stack access device, and a computer-readable storage medium, which solves the problem
  • the existing user-mode network file system has the problem that it is difficult to recover after a network connection failure.
  • the present invention provides a dual-stack access method for a user-mode network file system, including:
  • the first IP address of the client is used to establish a first connection with the client, and a designated shared directory is used to provide access services for the client through the first connection; wherein, the designated shared directory is in a mounting format and The shared directory corresponding to the IP protocol version of the first IP address;
  • the second IP address of the client is determined by the identifier field corresponding to the client; wherein the IP protocol version of the first IP address and the second IP address are different ;
  • it also includes:
  • the target file When receiving the failure information of the NFS file lock of the target file, analyze the failure information to determine the type of the NFS file lock failure; wherein, the target file is a file accessed by the client;
  • the NFS file lock failure is a first type of failure, sending notification information to the client; wherein, the first type of failure is a failure caused by a server operation error;
  • the NFS file lock failure is a second type of failure
  • the NFS file lock is released; wherein the second type of failure is a failure caused by the interruption of the connection with the client.
  • it also includes:
  • said using the first IP address of the client to establish a first connection with the client, and using a designated shared directory to provide access services for the client through the first connection includes:
  • the first connection between the client and the designated shared directory is established, and the first connection is used to provide the access service for the client.
  • the determining the device specified by the access request in the specified shared directory includes:
  • the target mount format corresponds to the IP protocol version of the first IP address
  • the obtaining the access request sent by the client through the first IP address includes:
  • Establish a listening socket use the listening socket to monitor each port, and obtain the access request sent by the client through the first IP address when the access request is monitored.
  • the establishing the first connection between the client and the designated shared directory, and using the first connection to provide the access service for the client includes:
  • the target version corresponds to the IP protocol version of the first IP address
  • the TCP socket is used to provide access services for the client.
  • the method before the establishing a first connection with the client by using the first IP address of the client, the method further includes:
  • IPV6 configuration information after adding IPV6 configuration information to the configuration file, it further includes:
  • the port setting function uses the port setting function to set the IP address of each port; wherein, the IP address includes an IPV4 address and an IPV6 address;
  • the format of the IPV4 address is set to::ffff:a.b.c.d; where a.b.c.d is the original address of the IPV4 address.
  • the method before the establishing a first connection with the client by using the first IP address of the client, the method further includes:
  • it also includes:
  • IPV4 address and the IPV6 address are used to respond to the IP address check request.
  • the present invention also provides a dual-stack access device for a user-mode network file system, including:
  • the first connection module is configured to establish a first connection with the client by using the client's first IP address, and use a designated shared directory to provide access services for the client through the first connection; wherein, the designated share The directory is a shared directory whose mounting format corresponds to the IP protocol version of the first IP address;
  • the obtaining module is configured to determine the second IP address of the client through the identifier field corresponding to the client when the first connection is disconnected; wherein, the first IP address and the second IP address The version of the IP protocol is different;
  • the second connection module is configured to use the second IP address to establish a second connection between the designated shared directory and the client.
  • the present invention also provides a dual-stack access device for a user-mode network file system, including a memory and a processor, wherein:
  • the memory is used to store computer programs
  • the processor is configured to execute the computer program to implement the above-mentioned dual-stack access method of the user mode network file system.
  • the present invention also provides a computer-readable storage medium for storing a computer program, wherein the computer program is executed by a processor to implement the above-mentioned user-mode network file system dual-stack access method.
  • the present invention provides a user-mode network file system dual-stack access method, which uses the first IP address of the client to establish a first connection with the client, and uses a designated shared directory to provide access services for the client through the first connection;
  • the shared directory is a shared directory whose mounting format corresponds to the IP protocol version of the first IP address.
  • this method allows the client to connect to the server with the first IP address and the second IP address, and the IP protocol version numbers of the two IP addresses are different. Therefore, the client can first establish a first connection with the server using the first IP address, and obtain access services through the first connection.
  • the identifier field can be used to determine the second IP address of the client, and the second IP address can be used to re-establish the network connection between the server and the client.
  • the existing user-mode network file system has the problem that it is difficult to recover after a network connection failure.
  • the present invention also provides a user-mode network file system dual-stack access device, a user-mode network file system dual-stack access device, and a computer-readable storage medium, which also have the above-mentioned beneficial effects.
  • FIG. 1 is a flowchart of a dual-stack access method for a user-mode network file system according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a dual-stack setting method for a user-mode network file system according to an embodiment of the present invention
  • FIG. 3 is a flowchart of obtaining an access service according to an embodiment of the present invention.
  • FIG. 4 is a method for recovering from a file lock failure according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a dual-stack access device for a user-mode network file system according to an embodiment of the present invention
  • FIG. 6 is a schematic structural diagram of a dual-stack access device for a user-mode network file system according to an embodiment of the present invention.
  • FIG. 1 is a flowchart of a dual-stack access method for a user-mode network file system according to an embodiment of the present invention.
  • the method includes:
  • S101 Use the first IP address of the client to establish a first connection with the client, and use a designated shared directory to provide an access service for the client through the first connection.
  • the server provides access services for the client. Therefore, the method can be executed by the server.
  • the client and the server are both Linux system platforms.
  • the system type can be CentOS Linux release 7.2.1511.
  • the client in the embodiment of the present invention is a client with the dual-stack access service mounted
  • the server in the embodiment of the present invention is a server with the dual-stack access service mounted. Dual-stack access means to support both IPV4 and IPV6 protocols for access. Therefore, the client in the embodiment of the present invention can use the IPV4 address or the IPV6 address to connect to the server and obtain access services.
  • the server in the embodiment of the present invention can use IPV4 The address or IPV6 address establishes a connection with the client and provides access services for the client.
  • the server uses the client's first IP address to establish a first connection with the client.
  • the specific connection method and process are not limited in this embodiment. For example, it can monitor the connection port of the client. When it is monitored that the client is bound to the first IP address When the connection request is sent by the port, the first IP address of the client is used to establish a connection with the client; or the connection request sent by the client specifying the first IP address can be received. After receiving the connection request, use the The first IP address establishes a connection with the client.
  • the first IP address can be an IPV4 address or an IPV6 address.
  • the specific content is not limited in this embodiment.
  • the first IP address when the first IP address is an IPV4 address, the first IP address can be 100.7.44.1; or when the first IP address is In the case of an IPV6 address, the first IP address can be fe80::20c:29ff::fe26:5f62.
  • the server After the server establishes the first connection with the client by using the first IP address, it can use the designated shared directory to provide access services for the client through the first connection.
  • the designated shared directory is a shared directory whose mounting format corresponds to the IP protocol version of the first IP address.
  • the designated shared directory When the first IP address is an IPV4 address, the designated shared directory is a shared directory mounted in the IPV4 format;
  • the designated shared directory When the first IP address is an IPV6 address, the designated shared directory is the shared directory mounted in the IPV6 format.
  • One or more devices are mounted in the specified shared directory, and the devices are used to store files and provide services for clients.
  • the designated shared directory can be used to provide access services for the client through the first connection.
  • There may be multiple types of access services and the client can obtain corresponding access services according to its own needs and the instructions issued by the user to the client, which is not limited in this embodiment.
  • the reason for the disconnection of the first connection is not limited.
  • This step can be performed when the first connection is disconnected due to any situation or failure, for example, when the server switches from dual stack mode due to failure or other reasons
  • single-stack mode for example, when the first connection is an IPV4 connection, and the server switches from dual-stack mode to IPV6 single-stack mode; or when the client switches from dual-stack mode to single-stack mode due to a failure or other reasons, for example, when the first connection is One connection is an IPV6 connection, and the client switches from the dual-stack mode to the IPV4 single-stack mode; or it may be the first connection disconnection caused by a network failure.
  • the IP protocol versions of the first IP address and the second IP address are different.
  • the second IP address of the client can be determined through the identifier field corresponding to the client.
  • the identifier field is stored locally on the server and is used to manage and identify each client and its network address.
  • the identifier field may include the client id and the corresponding first and second IP addresses, or may only include the first and second IP addresses corresponding to each other. Since there are multiple protocol versions of the user mode network file system, the identifier field can be different in different versions. For example, in the NFSv3 version of the protocol, the caller_name field can be used as the identifier field, and each client has the same value in the caller_name field.
  • the construction process of the identifier field can be selected and adjusted according to the actual situation. For example, after the dual-stack protocol is mounted on the clients in the user-mode network file system, the first IP address and the second IP address of each client can be counted and combined. Enter the first IP address and the second IP address into the server to construct the identifier field; or after the dual-stack protocol is mounted on both the server and the client in the user-mode network file system, when each client sends an NFS request Use the IP address to count the first IP address and the second IP address corresponding to each client.
  • the client sequence id of the client is obtained, and the client sequence id is used to generate the identifier id in the identifier field, and
  • the identifier id, the first IP address, and the second IP address are used to form an identifier field corresponding to the client.
  • the first NFS request can be any request, for example, it can be an identification request, that is, a request for matching an identifier field.
  • the method for the server to obtain the client id of the client is not limited in this embodiment.
  • the client id can be the sort id of the client in the entire distributed network file system, or it can be the MAC address information of the client and the generation of the identifier id. There can be multiple methods. For specific methods, please refer to related technologies, which will not be repeated here.
  • S103 Establish a second connection between the designated shared directory and the client by using the second IP address.
  • the second IP address can be used to re-establish a connection with the client, that is, the second IP address is used to establish a second connection between the specified shared directory and the client.
  • the server can use the second connection to continue to provide access services for the client, or can perform other operations, which is not limited in this embodiment.
  • the method of using the second IP address to establish a second connection between the specified shared directory and the client is not limited.
  • the server can send a connection request to the second IP address and use it when the client receives the connection request.
  • the second IP address establishes a second connection with the server, and the server can connect the specified shared directory to the client through the second connection; or it can wait for the connection request sent by the client using the second IP address, when the IP address of the connection request is detected When it is the second IP address, a second connection between the designated shared directory and the client is established.
  • the application of the dual-stack access method for the user-mode network file system allows the client to use the first IP address and the second IP address to connect to the server, and the IP protocol version numbers of the two IP addresses are different. Therefore, the client can first establish a first connection with the server using the first IP address, and obtain access services through the first connection.
  • the identifier field can be used to determine the second IP address of the client, and the second IP address can be used to re-establish the network connection between the server and the client.
  • the method can recover the network connection problem between the server and the client without restarting the server, and solves the problem that the existing user-mode network file system is difficult to recover after a network connection failure.
  • FIG. 2 is a flowchart of a dual-stack setting method for a user-mode network file system according to an embodiment of the present invention, including:
  • /etc/sysctl.conf is the configuration file. After entering the above content, you need to execute the sysctl-p command to enable the IPV6 protocol. Since the server portmap daemon is not compatible with IPV6, the TI-RPC library needs to be loaded to enable the rpcbind service.
  • the port setting function is used to set the IP address corresponding to the port. Since both the server and the client support dual-stack access services, it is necessary to bind the IPV6 address to some ports on the server and each client, and bind them to other ports. IPV4 address. Specifically, the Bind_sockets_V4 function can be used to bind the IPV4 address and port, and the Bind_sockets_V6 function can be used to bind the IPV6 address and port.
  • the format of the server’s IPV4 address is set.
  • the IPV4 address is set to 128 bits, the first 80 bits are set to 0, the middle 16 bits are set to ffff, and the last 32 bits are set to abcd, abcd is the original address of the IPV4 address.
  • abcd is the original address of the IPV4 address.
  • the IPV4 address after setting is::ffff:100.7.44.1.
  • FIG. 3 is a flow chart for obtaining access services according to an embodiment of the present invention.
  • S301 Obtain the access request sent by the client through the first IP address, and determine the device specified by the access request in the designated shared directory.
  • the method for obtaining the access request is not limited in this embodiment.
  • the operation of obtaining the access request sent by the client through the first IP address may be performed in real time, and repeated execution when it is not obtained.
  • a listening socket can be established, and each port can be monitored by using the listening socket, and the access request sent by the client through the first IP address can be obtained when the access request is monitored.
  • the port includes the port bound with the IPV4 address and the port bound with the IPV6 address.
  • the IP address protocol version bound to the port that listens to the access request is the same as the IP protocol version of the first IP address.
  • the designated shared directory is a shared directory with the mount format corresponding to the IP protocol version of the first IP address, and one or more devices are mounted in the designated shared directory, and in the designated shared directory Determine the device specified in the access request.
  • the device specified by the access request does not exist in the specified shared directory. Therefore, before the device specified by the access request is determined, it can be determined whether the device specified by the access request exists in the execution shared directory. If it exists, determine the device specified by the access request; if it does not exist, mount the device specified by the access request to the specified shared directory according to the target mount format, which corresponds to the IP protocol version of the first IP address , That is, when the first IP address is an IPV4 address, the target mounting format is the IPV4 format; when the first IP address is the IPV6 version, the target mounting format is the IPV6 version.
  • S302 Establish a first connection between the client and the designated shared directory, and use the first connection to provide an access service for the client.
  • a TCP socket of the target version can be created, and the TCP socket is used to connect the client and the designated shared directory, that is, the TCP socket is used as the first connection.
  • the target version corresponds to the IP protocol version of the first IP address, that is, when the first IP address is an IPV4 address, the target version should be the TCP4 version; when the first IP address is an IPV6 address, the target version should be the TCP6 version .
  • the TCP socket is used to provide access services for the client.
  • Figure 4 is a file lock failure recovery method provided by an embodiment of the present invention, including:
  • S401 When receiving the failure information of the NFS file lock of the target file, analyze the failure information to determine the type of the NFS file lock failure.
  • the target file is the file accessed by the client.
  • the client accesses the file, it can be opened in read mode or in write mode.
  • the server will receive the failure information of the NFS file lock of the target file, and the failure information may be a notify notification message.
  • the failure information of the NFS file lock of the target file is received, the failure information is analyzed to determine the type of the NFS file lock failure of the target file. This embodiment does not limit the specific determination method, and can refer to related technologies, which will not be repeated here.
  • the first type of failure is the failure caused by the server operation error, that is, the server operation error causes the NFS file lock of the target file to fail.
  • a notification message needs to be sent to the client so that the client can reapply for the authorized lock for the target file, that is, the NFS file lock of the target file.
  • the identifier field needs to be used to determine the identity of the applying client.
  • the applying client is a client that previously accessed the target file, it is allowed to continue to access the file.
  • the second type of failure is the failure caused by the connection terminal with the client, that is, the NFS file lock failure caused by the disconnection of the connection between the server and the client.
  • you can release the authorized lock that is, release the NFS file lock of the target file.
  • the NFS file lock is released, other operations can be performed, and the specific content is not limited in this embodiment.
  • the fault type can be determined when the NFS file lock fails, and corresponding measures can be taken to recover from the fault, so as to avoid the user-mode network file system from causing files due to the NFS file lock failure. Open issues such as conflicts.
  • the following describes the user-mode network file system dual-stack access device provided by the embodiment of the present invention.
  • the user-mode network file system dual-stack access device described below and the above-described user-mode network file system dual-stack access method can be referred to each other.
  • FIG. 5 is a schematic structural diagram of a dual-stack access device for a user-mode network file system according to an embodiment of the present invention, including:
  • the first connection module 510 is configured to establish a first connection with the client by using the first IP address of the client, and use the designated shared directory to provide access services for the client through the first connection; wherein the designated shared directory is the mount format and the first connection A shared directory corresponding to the IP protocol version of the IP address;
  • the obtaining module 520 is configured to determine the second IP address of the client through the identifier field corresponding to the client when the first connection is disconnected; wherein the IP protocol version of the first IP address and the second IP address are different;
  • the second connection module 530 is configured to use the second IP address to establish a second connection between the designated shared directory and the client.
  • it also includes:
  • the fault type determination module is used to analyze the fault information when receiving the fault information of the NFS file lock of the target file to determine the type of the NFS file lock fault; where the target file is the file accessed by the client;
  • the first recovery module is used to send notification information to the client when the NFS file lock failure is the first type of failure; where the first type of failure is a failure caused by a server operation error;
  • the second recovery module is used to release the NFS file lock when the NFS file lock failure is the second type of failure; where the second type of failure is the failure caused by the interruption of the connection with the client.
  • it also includes:
  • the serial ID acquisition module is used to acquire the client serial ID of the client when the first NFS request sent by the client is received;
  • the identifier field generating module is used to generate the identifier id in the identifier field using the client serial ID, and use the identifier id, the first IP address and the second IP address to form the identifier field.
  • the first connection module 510 includes:
  • the determining unit is used to obtain the access request sent by the client through the first IP address, and determine the device specified by the access request in the designated shared directory;
  • the service unit is used to establish a first connection between the client and the designated shared directory, and use the first connection to provide access services for the client.
  • the determining unit includes:
  • the judging subunit is used to judge whether there is a device in the specified shared directory
  • the mounting subunit is used to mount the device in the designated shared directory according to the target mounting format if the device does not exist in the designated shared directory; wherein, the target mounting format corresponds to the IP protocol version of the first IP address;
  • the determining subunit is used to determine the device specified by the access request if there is a device in the specified shared directory.
  • the determining unit includes:
  • the monitoring subunit is used to establish a monitoring socket, use the monitoring socket to monitor each port, and obtain the access request sent by the client through the first IP address when the access request is monitored.
  • the service unit includes:
  • the socket creation subunit is used to create the target version of the TCP socket, use the TCP socket to connect the client and specify the shared directory; the target version corresponds to the IP protocol version of the first IP address;
  • the service subunit is used to provide access services for the client by using the TCP socket.
  • it also includes:
  • the configuration module is used to add IPV6 configuration information to the configuration file and load the TI-RPC library.
  • it also includes:
  • the address setting module is used to set the IP address of each port by using the port setting function; among them, the IP address includes the IPV4 address and the IPV6 address;
  • the format modification module is used to set the format of the IPV4 address to ::ffff:a.b.c.d; where a.b.c.d is the original address of the IPV4 address.
  • it also includes:
  • the dual-stack switch setting module is used to set and turn on the dual-stack access switch.
  • it also includes:
  • the request response module is used to respond to the IP address check request with the IPV4 address and the IPV6 address when the IP address check request is received.
  • the following describes the user-mode network file system dual-stack access device provided by the embodiment of the present invention.
  • the user-mode network file system dual-stack access device described below and the above-described user-mode network file system dual-stack access method can be referred to each other.
  • FIG. 6 is a schematic structural diagram of a dual-stack access device for a user-mode network file system according to an embodiment of the present invention.
  • the dual-stack access device for a user-mode network file system includes a memory and a processor, wherein:
  • the memory 610 is used to store computer programs
  • the processor 620 is configured to execute a computer program to implement the aforementioned dual-stack access method for a user-mode network file system.
  • the computer-readable storage medium provided by the embodiment of the present invention will be introduced below.
  • the computer-readable storage medium described below and the user-mode network file system dual-stack access method described above can be referenced correspondingly.
  • the present invention also provides a computer-readable storage medium on which a computer program is stored.
  • the computer program is executed by a processor, the steps of the above-mentioned dual-stack access method for a user-mode network file system are realized.
  • the computer-readable storage medium may include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk, etc., which can store program codes Medium.
  • the steps of the method or algorithm described in combination with the embodiments disclosed in this document can be directly implemented by hardware, a software module executed by a processor, or a combination of the two.
  • the software module can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or all areas in the technical field. Any other known storage media.

Abstract

A dual-stack access method for a user-mode network file system. The method comprises: using a first IP address of a client to establish a first connection with the client, and using a specified shared directory to provide an access service for the client by means of the first connection; when the first connection is broken, determining a second IP address of the client by means of an identifier field corresponding to the client; and using the second IP address to establish a second connection between the specified shared directory and the client. According to the method, a client is allowed to be connected to a server by means of a first IP address and a second IP address, and IP protocol version numbers of the two IP addresses are different. Therefore, when a first connection is interrupted, the second IP address of the client can be determined by using an identifier field, and a connection is re-established by using the second IP address. Further provided are a dual-stack access apparatus and device for a user-mode network file system, and a computer-readable storage medium, and same also have the beneficial effects.

Description

一种用户态网络文件系统双栈访问方法、装置及设备Double stack access method, device and equipment for user mode network file system
本申请要求于2019年11月07日提交中国专利局、申请号为201911083371.X、发明名称为“一种用户态网络文件系统双栈访问方法、装置及设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application requires the priority of a Chinese patent application filed with the Chinese Patent Office, the application number is 201911083371.X, and the invention title is "A method, device and equipment for dual-stack access to a user-mode network file system" on November 7, 2019. The entire content is incorporated into this application by reference.
技术领域Technical field
本发明涉及文件系统技术领域,特别涉及一种用户态网络文件系统双栈访问方法、用户态网络文件系统双栈访问装置、用户态网络文件系统双栈访问设备及计算机可读存储介质。The invention relates to the technical field of file systems, in particular to a user-mode network file system dual-stack access method, a user-mode network file system dual-stack access device, a user-mode network file system dual-stack access device and a computer-readable storage medium.
背景技术Background technique
NFS(Network File System)即内核态网络文件系统,是FreeBSD支持的文件系统中的一种,它允许网络中的计算机之间通过TCP/IP网络共享资源。在NFS被应用时,本地挂载了NFS的客户端应用可以透明地读写位于远端NFS服务器上的文件,就像访问本地文件一样。NFS-Ganesha是用户态网络文件系统,属于开源项目,在系统服务故障场景下,相比于内核态网络文件系统具有更好管理性和可维护性,并且用户态NFS-Ganesha易于实施和维护,因此,大数据海量分布式对象存储NFS-Ganesha应用前景很大。但是,现有用户态网络文件系统中的服务器仅允许一种IP地址访问,服务器与一个客户端之间仅有一条网络连接,即仅允许IPV4地址访问或仅允许IPV6地址访问,当服务器失去与客户端的网络连接时,需要重启服务器才能恢复网络连接,恢复网络连接的操作复杂,成本较高。因此,现有用户态网络文件系统存在网络连接故障后恢复困难的问题。NFS (Network File System) is the kernel network file system, which is one of the file systems supported by FreeBSD. It allows computers on the network to share resources through the TCP/IP network. When NFS is used, the local NFS-mounted client application can transparently read and write files on the remote NFS server, just like accessing local files. NFS-Ganesha is a user-mode network file system, which is an open source project. In the case of system service failure, it has better management and maintainability than the kernel-mode network file system, and user-mode NFS-Ganesha is easy to implement and maintain. Therefore, NFS-Ganesha, a large-scale distributed object storage for big data, has great application prospects. However, the server in the existing user-mode network file system allows only one IP address to access, and there is only one network connection between the server and a client, that is, only IPV4 address access or only IPV6 address access is allowed. When the client's network is connected, the server needs to be restarted to restore the network connection. The operation of restoring the network connection is complicated and costly. Therefore, the existing user-mode network file system has a problem that it is difficult to recover after a network connection failure.
因此,如何解决现有用户态网络文件系统存在网络连接故障后恢复困难的问题,是本领域技术人员需要解决的技术问题。Therefore, how to solve the problem that the existing user-mode network file system is difficult to recover after a network connection failure is a technical problem that needs to be solved by those skilled in the art.
发明内容Summary of the invention
有鉴于此,本发明的目的在于提供一种用户态网络文件系统双栈访问 方法、用户态网络文件系统双栈访问装置、用户态网络文件系统双栈访问设备及计算机可读存储介质,解决了现有用户态网络文件系统存在的网络连接故障后恢复困难的问题。In view of this, the purpose of the present invention is to provide a user-mode network file system dual-stack access method, a user-mode network file system dual-stack access device, a user-mode network file system dual-stack access device, and a computer-readable storage medium, which solves the problem The existing user-mode network file system has the problem that it is difficult to recover after a network connection failure.
为解决上述技术问题,本发明提供了一种用户态网络文件系统双栈访问方法,包括:To solve the above technical problems, the present invention provides a dual-stack access method for a user-mode network file system, including:
利用客户端的第一IP地址与所述客户端建立第一连接,并利用指定共享目录通过所述第一连接为所述客户端提供访问服务;其中,所述指定共享目录为挂载格式与所述第一IP地址的IP协议版本对应的共享目录;The first IP address of the client is used to establish a first connection with the client, and a designated shared directory is used to provide access services for the client through the first connection; wherein, the designated shared directory is in a mounting format and The shared directory corresponding to the IP protocol version of the first IP address;
当所述第一连接断开时,通过所述客户端对应的标识符字段确定所述客户端的第二IP地址;其中,所述第一IP地址与所述第二IP地址的IP协议版本不同;When the first connection is disconnected, the second IP address of the client is determined by the identifier field corresponding to the client; wherein the IP protocol version of the first IP address and the second IP address are different ;
利用所述第二IP地址建立所述指定共享目录与所述客户端之间的第二连接。Using the second IP address to establish a second connection between the designated shared directory and the client.
可选的,还包括:Optionally, it also includes:
当接收到目标文件的NFS文件锁的故障信息时,解析所述故障信息,确定NFS文件锁故障的类型;其中,所述目标文件为所述客户端访问的文件;When receiving the failure information of the NFS file lock of the target file, analyze the failure information to determine the type of the NFS file lock failure; wherein, the target file is a file accessed by the client;
当所述NFS文件锁故障为第一类故障时,向所述客户端发送通知信息;其中,所述第一类故障为服务器运行错误导致的故障;When the NFS file lock failure is a first type of failure, sending notification information to the client; wherein, the first type of failure is a failure caused by a server operation error;
当所述NFS文件锁故障为第二类故障时,释放所述NFS文件锁;其中,所述第二类故障为与所述客户端之间的连接中断导致的故障。When the NFS file lock failure is a second type of failure, the NFS file lock is released; wherein the second type of failure is a failure caused by the interruption of the connection with the client.
可选的,还包括:Optionally, it also includes:
当接收到所述客户端发送的首次NFS请求时,获取所述客户端的客户端序列ID;When receiving the first NFS request sent by the client, acquiring the client serial ID of the client;
利用所述客户端序列ID生成所述标识符字段中的标识符id,并利用所述标识符id、所述第一IP地址和所述第二IP地址组成所述标识符字段。Use the client serial ID to generate the identifier id in the identifier field, and use the identifier id, the first IP address, and the second IP address to form the identifier field.
可选的,所述利用客户端的第一IP地址与所述客户端建立第一连接,并利用指定共享目录通过所述第一连接为所述客户端提供访问服务,包括:Optionally, said using the first IP address of the client to establish a first connection with the client, and using a designated shared directory to provide access services for the client through the first connection includes:
获取所述客户端通过所述第一IP地址发送的访问请求,并在所述指定 共享目录中确定所述访问请求指定的设备;Acquiring the access request sent by the client through the first IP address, and determining the device specified by the access request in the designated shared directory;
建立所述客户端与所述指定共享目录之间的所述第一连接,利用所述第一连接为所述客户端提供所述访问服务。The first connection between the client and the designated shared directory is established, and the first connection is used to provide the access service for the client.
可选的,所述在所述指定共享目录中确定所述访问请求指定的设备,包括:Optionally, the determining the device specified by the access request in the specified shared directory includes:
判断所述指定共享目录中是否存在所述设备;Determine whether the device exists in the designated shared directory;
若否,则按照目标挂载格式将所述设备挂载到所述指定共享目录中;其中,所述目标挂载格式与所述第一IP地址的所述IP协议版本相对应;If not, mount the device to the designated shared directory according to the target mount format; wherein, the target mount format corresponds to the IP protocol version of the first IP address;
若是,则确定所述访问请求指定的所述设备。If yes, determine the device specified by the access request.
可选的,所述获取所述客户端通过所述第一IP地址发送的访问请求,包括:Optionally, the obtaining the access request sent by the client through the first IP address includes:
建立监听套接字,利用所述监听套接字监听各个端口,并在监听到所述访问请求时获取所述客户端通过所述第一IP地址发送的所述访问请求。Establish a listening socket, use the listening socket to monitor each port, and obtain the access request sent by the client through the first IP address when the access request is monitored.
可选的,所述建立所述客户端与所述指定共享目录之间的所述第一连接,利用所述第一连接为所述客户端提供所述访问服务,包括:Optionally, the establishing the first connection between the client and the designated shared directory, and using the first connection to provide the access service for the client includes:
创建目标版本的TCP套接字,利用所述TCP套接字连接所述客户端和所述指定共享目录;所述目标版本与所述第一IP地址的所述IP协议版本相对应;Creating a TCP socket of a target version, and using the TCP socket to connect the client and the designated shared directory; the target version corresponds to the IP protocol version of the first IP address;
利用所述TCP套接字为所述客户端提供访问服务。The TCP socket is used to provide access services for the client.
可选的,在所述利用客户端的第一IP地址与所述客户端建立第一连接之前,还包括:Optionally, before the establishing a first connection with the client by using the first IP address of the client, the method further includes:
在配置文件中增加IPV6配置信息,并加载TI-RPC库。Add IPV6 configuration information to the configuration file and load the TI-RPC library.
可选的,在所述配置文件中增加IPV6配置信息之后,还包括:Optionally, after adding IPV6 configuration information to the configuration file, it further includes:
利用端口设置函数对各个端口的IP地址进行设置;其中,所述IP地址包括IPV4地址和IPV6地址;Use the port setting function to set the IP address of each port; wherein, the IP address includes an IPV4 address and an IPV6 address;
将所述IPV4地址的格式设置为::ffff:a.b.c.d;其中,所述a.b.c.d为所述IPV4地址的原地址。The format of the IPV4 address is set to::ffff:a.b.c.d; where a.b.c.d is the original address of the IPV4 address.
可选的,在所述利用客户端的第一IP地址与所述客户端建立第一连接之前,还包括:Optionally, before the establishing a first connection with the client by using the first IP address of the client, the method further includes:
设置并开启双栈访问开关。Set and turn on the dual stack access switch.
可选的,还包括:Optionally, it also includes:
当接收到IP地址查看请求时,利用所述IPV4地址和所述IPV6地址响应所述IP地址查看请求。When an IP address check request is received, the IPV4 address and the IPV6 address are used to respond to the IP address check request.
本发明还提供了一种用户态网络文件系统双栈访问装置,包括:The present invention also provides a dual-stack access device for a user-mode network file system, including:
第一连接模块,用于利用客户端的第一IP地址与所述客户端建立第一连接,并利用指定共享目录通过所述第一连接为所述客户端提供访问服务;其中,所述指定共享目录为挂载格式与所述第一IP地址的IP协议版本对应的共享目录;The first connection module is configured to establish a first connection with the client by using the client's first IP address, and use a designated shared directory to provide access services for the client through the first connection; wherein, the designated share The directory is a shared directory whose mounting format corresponds to the IP protocol version of the first IP address;
获取模块,用于当所述第一连接断开时,通过所述客户端对应的标识符字段确定所述客户端的第二IP地址;其中,所述第一IP地址与所述第二IP地址的IP协议版本不同;The obtaining module is configured to determine the second IP address of the client through the identifier field corresponding to the client when the first connection is disconnected; wherein, the first IP address and the second IP address The version of the IP protocol is different;
第二连接模块,用于利用所述第二IP地址建立所述指定共享目录与所述客户端之间的第二连接。The second connection module is configured to use the second IP address to establish a second connection between the designated shared directory and the client.
本发明还提供了一种用户态网络文件系统双栈访问设备,包括存储器和处理器,其中:The present invention also provides a dual-stack access device for a user-mode network file system, including a memory and a processor, wherein:
所述存储器,用于保存计算机程序;The memory is used to store computer programs;
所述处理器,用于执行所述计算机程序,以实现上述的用户态网络文件系统双栈访问方法。The processor is configured to execute the computer program to implement the above-mentioned dual-stack access method of the user mode network file system.
本发明还提供了一种计算机可读存储介质,用于保存计算机程序,其中,所述计算机程序被处理器执行时实现上述的用户态网络文件系统双栈访问方法。The present invention also provides a computer-readable storage medium for storing a computer program, wherein the computer program is executed by a processor to implement the above-mentioned user-mode network file system dual-stack access method.
本发明提供的一种用户态网络文件系统双栈访问方法,利用客户端的第一IP地址与客户端建立第一连接,并利用指定共享目录通过第一连接为客户端提供访问服务;其中,指定共享目录为挂载格式与第一IP地址的IP协议版本对应的共享目录。当第一连接断开时,通过客户端对应的标识符字段确定客户端的第二IP地址;其中,第一IP地址与第二IP地址的IP协议版本不同;利用第二IP地址建立指定共享目录与客户端之间的第二连接。The present invention provides a user-mode network file system dual-stack access method, which uses the first IP address of the client to establish a first connection with the client, and uses a designated shared directory to provide access services for the client through the first connection; The shared directory is a shared directory whose mounting format corresponds to the IP protocol version of the first IP address. When the first connection is disconnected, the second IP address of the client is determined by the identifier field corresponding to the client; wherein the IP protocol version of the first IP address and the second IP address are different; the second IP address is used to establish the designated shared directory The second connection with the client.
可见,该方法允许客户端以第一IP地址和第二IP地址与服务器相连,且两个IP地址的IP协议版本号不同。因此客户端可以先采用第一IP地址与服务器建立第一连接,并通过第一连接获取访问服务。当服务器与客户端通过第一IP地址建立的第一连接中断时,可以利用标识符字段确定客户端的第二IP地址,并利用第二IP地址重新建立服务器与客户端之间的网络连接,解决了现有用户态网络文件系统存在网络连接故障后恢复困难的问题。It can be seen that this method allows the client to connect to the server with the first IP address and the second IP address, and the IP protocol version numbers of the two IP addresses are different. Therefore, the client can first establish a first connection with the server using the first IP address, and obtain access services through the first connection. When the first connection established between the server and the client through the first IP address is interrupted, the identifier field can be used to determine the second IP address of the client, and the second IP address can be used to re-establish the network connection between the server and the client. The existing user-mode network file system has the problem that it is difficult to recover after a network connection failure.
此外,本发明还提供了一种用户态网络文件系统双栈访问装置、用户态网络文件系统双栈访问设备及计算机可读存储介质,同样具有上述有益效果。In addition, the present invention also provides a user-mode network file system dual-stack access device, a user-mode network file system dual-stack access device, and a computer-readable storage medium, which also have the above-mentioned beneficial effects.
附图说明Description of the drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to explain the embodiments of the present invention or the technical solutions in the prior art more clearly, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only It is an embodiment of the present invention. For those of ordinary skill in the art, without creative work, other drawings can be obtained according to the provided drawings.
图1为本发明实施例提供的一种用户态网络文件系统双栈访问方法流程图;FIG. 1 is a flowchart of a dual-stack access method for a user-mode network file system according to an embodiment of the present invention;
图2为本发明实施例提供的一种用户态网络文件系统双栈设置方法流程图;2 is a flowchart of a dual-stack setting method for a user-mode network file system according to an embodiment of the present invention;
图3为本发明实施例提供的一种访问服务获取流程图;FIG. 3 is a flowchart of obtaining an access service according to an embodiment of the present invention;
图4为本发明实施例提供的一种文件锁故障恢复方法;FIG. 4 is a method for recovering from a file lock failure according to an embodiment of the present invention;
图5为本发明实施例提供的一种用户态网络文件系统双栈访问装置的结构示意图;5 is a schematic structural diagram of a dual-stack access device for a user-mode network file system according to an embodiment of the present invention;
图6为本发明实施例提供的一种用户态网络文件系统双栈访问设备的结构示意图。FIG. 6 is a schematic structural diagram of a dual-stack access device for a user-mode network file system according to an embodiment of the present invention.
具体实施方式Detailed ways
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。In order to make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments It is only a part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of the present invention.
请参考图1,图1为本发明实施例提供的一种用户态网络文件系统双栈访问方法流程图。该方法包括:Please refer to FIG. 1, which is a flowchart of a dual-stack access method for a user-mode network file system according to an embodiment of the present invention. The method includes:
S101:利用客户端的第一IP地址与客户端建立第一连接,并利用指定共享目录通过第一连接为客户端提供访问服务。S101: Use the first IP address of the client to establish a first connection with the client, and use a designated shared directory to provide an access service for the client through the first connection.
在用户态网络文件系统中,由服务器为客户端提供访问服务,因此本方法可以由服务器执行,在本发明实施例中,客户端与服务器均为Linux系统平台,具体的,客户端与服务器的系统类型可以为CentOS Linux release7.2.1511。需要说明的是,本发明实施例中的客户端为挂载了双栈访问服务的客户端,本发明实施例中的服务器为挂载了双栈访问服务的服务器。双栈访问即为支持IPV4和IPV6两种协议进行访问,因此本发明实施例中的客户端可以利用IPV4地址或IPV6地址与服务器进行连接并获取访问服务,本发明实施例中的服务器可以利用IPV4地址或IPV6地址与客户端建立连接并为客户端提供访问服务。In the user-mode network file system, the server provides access services for the client. Therefore, the method can be executed by the server. In the embodiment of the present invention, the client and the server are both Linux system platforms. The system type can be CentOS Linux release 7.2.1511. It should be noted that the client in the embodiment of the present invention is a client with the dual-stack access service mounted, and the server in the embodiment of the present invention is a server with the dual-stack access service mounted. Dual-stack access means to support both IPV4 and IPV6 protocols for access. Therefore, the client in the embodiment of the present invention can use the IPV4 address or the IPV6 address to connect to the server and obtain access services. The server in the embodiment of the present invention can use IPV4 The address or IPV6 address establishes a connection with the client and provides access services for the client.
服务器利用客户端的第一IP地址与客户端建立第一连接,具体的连接方法和过程本实施例并不限定,例如可以监听客户端的连接端口,当监听到客户端通过绑定有第一IP地址的端口发送的连接请求时,则利用客户端的第一IP地址与客户端建立连接;或者可以接收客户端发送的指定第一IP地址的连接请求,在接收到连接请求后,利用连接请求中的第一IP地址与客户端建立连接。第一IP地址可以为IPV4地址或IPV6地址,其具体内容本实施例不做限定,例如当第一IP地址为IPV4地址时,第一IP地址可以为100.7.44.1;或者当第一IP地址为IPV6地址时,第一IP地址可以为fe80::20c:29ff::fe26:5f62。The server uses the client's first IP address to establish a first connection with the client. The specific connection method and process are not limited in this embodiment. For example, it can monitor the connection port of the client. When it is monitored that the client is bound to the first IP address When the connection request is sent by the port, the first IP address of the client is used to establish a connection with the client; or the connection request sent by the client specifying the first IP address can be received. After receiving the connection request, use the The first IP address establishes a connection with the client. The first IP address can be an IPV4 address or an IPV6 address. The specific content is not limited in this embodiment. For example, when the first IP address is an IPV4 address, the first IP address can be 100.7.44.1; or when the first IP address is In the case of an IPV6 address, the first IP address can be fe80::20c:29ff::fe26:5f62.
当服务器利用第一IP地址与客户端建立第一连接后,可以利用指定共享目录通过第一连接为客户端提供访问服务。需要说明的是,指定共享目 录为挂载格式与第一IP地址的IP协议版本对应的共享目录,当第一IP地址为IPV4地址时,指定共享目录即为以IPV4格式挂载的共享目录;当第一IP地址为IPV6地址是,指定共享目录即为以IPV6格式挂载的共享目录。指定共享目录中挂载有一个或多个设备,设备用于存储文件,并为客户端提供服务。将指定共享目录通过第一连接与客户端连接起来,就可以利用指定共享目录通过第一连接为客户端提供访问服务。访问服务的类型可以有多种,客户端可以根据自身需要以及用户对客户端发出的指令获取相应的访问服务,本实施例对此不做限定。After the server establishes the first connection with the client by using the first IP address, it can use the designated shared directory to provide access services for the client through the first connection. It should be noted that the designated shared directory is a shared directory whose mounting format corresponds to the IP protocol version of the first IP address. When the first IP address is an IPV4 address, the designated shared directory is a shared directory mounted in the IPV4 format; When the first IP address is an IPV6 address, the designated shared directory is the shared directory mounted in the IPV6 format. One or more devices are mounted in the specified shared directory, and the devices are used to store files and provide services for clients. By connecting the designated shared directory with the client through the first connection, the designated shared directory can be used to provide access services for the client through the first connection. There may be multiple types of access services, and the client can obtain corresponding access services according to its own needs and the instructions issued by the user to the client, which is not limited in this embodiment.
S102:当第一连接断开时,通过客户端对应的标识符字段确定客户端的第二IP地址。S102: When the first connection is disconnected, determine the second IP address of the client through the identifier field corresponding to the client.
在本发明实施例中,对于引起第一连接断开的原因不做限定,任何情况或故障引起的第一连接断开都可以执行本步骤,例如当服务器因故障或其他原因从双栈模式切换到了单栈模式时,例如当第一连接为IPV4连接,而服务器从双栈模式切换到了IPV6单栈模式;或者当客户端因故障或其他原因从双栈模式切换到了单栈模式,例如当第一连接为IPV6连接,而客户端从双栈模式切换到了IPV4单栈模式;或者可以为网络故障引起的第一连接断开。In the embodiment of the present invention, the reason for the disconnection of the first connection is not limited. This step can be performed when the first connection is disconnected due to any situation or failure, for example, when the server switches from dual stack mode due to failure or other reasons When it comes to single-stack mode, for example, when the first connection is an IPV4 connection, and the server switches from dual-stack mode to IPV6 single-stack mode; or when the client switches from dual-stack mode to single-stack mode due to a failure or other reasons, for example, when the first connection is One connection is an IPV6 connection, and the client switches from the dual-stack mode to the IPV4 single-stack mode; or it may be the first connection disconnection caused by a network failure.
需要说明的是,第一IP地址与第二IP地址的IP协议版本不同。当第一连接断开时,可以通过客户端对应的标识符字段确定客户端的第二IP地址。标识符字段在服务器本地存储,用于对各个客户端及其网络地址进行管理和标识。标识符字段可以包括客户端id以及对应的第一IP地址和第二IP地址,或者可以仅包括相互对应的第一IP地址和第二IP地址。由于用户态网络文件系统的协议版本有多种,因此标识符字段在不同的版本中可以不同,例如在NFSv3版本协议中,可以利用caller_name字段作为标识符字段,每个客户端在caller_name字段中均保存有自己的第一IP地址和第二IP地址,以便在发生连接故障时与客户端重连;或者在NFSv4版本协议中,可以利用clientid字段作为标识符字段,利用clientid字段标记各个客户端及其对应的第一IP地址和第二IP地址,以便在发生连接故障时与客户端重连。It should be noted that the IP protocol versions of the first IP address and the second IP address are different. When the first connection is disconnected, the second IP address of the client can be determined through the identifier field corresponding to the client. The identifier field is stored locally on the server and is used to manage and identify each client and its network address. The identifier field may include the client id and the corresponding first and second IP addresses, or may only include the first and second IP addresses corresponding to each other. Since there are multiple protocol versions of the user mode network file system, the identifier field can be different in different versions. For example, in the NFSv3 version of the protocol, the caller_name field can be used as the identifier field, and each client has the same value in the caller_name field. Save your own first IP address and second IP address to reconnect with the client in the event of a connection failure; or in the NFSv4 version of the protocol, you can use the clientid field as an identifier field, and use the clientid field to mark each client and Its corresponding first IP address and second IP address, in order to reconnect with the client in the event of a connection failure.
标识符字段的构建过程可以根据实际情况进行选择和调整,例如可以在用户态网络文件系统中的客户端均挂载了双栈协议后,统计各个客户端的第一IP地址和第二IP地址并将第一IP地址和第二IP地址输入服务器,构建标识符字段;或者可以在用户态网络文件系统中的服务器和客户端均挂载了双栈协议之后,通过获取各个客户端发送NFS请求时使用的IP地址来统计各个客户端对应的第一IP地址和第二IP地址。本实施例中优选的,为了尽快完善标识符字段,当接收到客户端发送的首次NFS请求时,获取客户端的客户端序列id,利用客户端序列id生成标识符字段中的标识符id,并利用标识符id、第一IP地址和第二IP地址组成该客户端对应的标识符字段。首次NFS请求可以为任意请求,例如可以为标识请求,即进行标识符字段匹配的请求。服务器获取客户端的客户端id的方法本实施例也不做限定,客户端id可以为客户端在整个分布式网络文件系统中的排序id,也可以为客户端的MAC地址信息,标识符id的生成方法可以有多种,具体方法请参考相关技术,在此不再赘述。The construction process of the identifier field can be selected and adjusted according to the actual situation. For example, after the dual-stack protocol is mounted on the clients in the user-mode network file system, the first IP address and the second IP address of each client can be counted and combined. Enter the first IP address and the second IP address into the server to construct the identifier field; or after the dual-stack protocol is mounted on both the server and the client in the user-mode network file system, when each client sends an NFS request Use the IP address to count the first IP address and the second IP address corresponding to each client. Preferably, in this embodiment, in order to complete the identifier field as soon as possible, when the first NFS request sent by the client is received, the client sequence id of the client is obtained, and the client sequence id is used to generate the identifier id in the identifier field, and The identifier id, the first IP address, and the second IP address are used to form an identifier field corresponding to the client. The first NFS request can be any request, for example, it can be an identification request, that is, a request for matching an identifier field. The method for the server to obtain the client id of the client is not limited in this embodiment. The client id can be the sort id of the client in the entire distributed network file system, or it can be the MAC address information of the client and the generation of the identifier id. There can be multiple methods. For specific methods, please refer to related technologies, which will not be repeated here.
S103:利用第二IP地址建立指定共享目录与客户端之间的第二连接。S103: Establish a second connection between the designated shared directory and the client by using the second IP address.
当利用标识符字段确定客户端对应的第二IP地址时,可以利用第二IP地址与客户端重新建立连接,即利用第二IP地址建立指定共享目录与客户端之间的第二连接,在建立第二连接之后,服务器可以利用第二连接继续为客户端提供访问服务,或者可以执行其他操作,本实施例对此不做限定。When the identifier field is used to determine the second IP address corresponding to the client, the second IP address can be used to re-establish a connection with the client, that is, the second IP address is used to establish a second connection between the specified shared directory and the client. After the second connection is established, the server can use the second connection to continue to provide access services for the client, or can perform other operations, which is not limited in this embodiment.
需要说明的是,利用第二IP地址建立指定共享目录与客户端之间的第二连接的方法不做限定,例如服务器可以向第二IP地址发送连接请求,当客户端接收到连接请求时利用第二IP地址与服务器建立第二连接,服务器即可将指定共享目录与客户端通过第二连接相连;或者可以等待客户端利用第二IP地址发送的连接请求,当检测到连接请求的IP地址为第二IP地址时,建立指定共享目录与客户端之间的第二连接。It should be noted that the method of using the second IP address to establish a second connection between the specified shared directory and the client is not limited. For example, the server can send a connection request to the second IP address and use it when the client receives the connection request. The second IP address establishes a second connection with the server, and the server can connect the specified shared directory to the client through the second connection; or it can wait for the connection request sent by the client using the second IP address, when the IP address of the connection request is detected When it is the second IP address, a second connection between the designated shared directory and the client is established.
应用本发明实施例提供的用户态网络文件系统双栈访问方法,允许客户端利用第一IP地址和第二IP地址与服务器相连,且两个IP地址的IP协议版本号不同。因此客户端可以先采用第一IP地址与服务器建立第一连接,并通过第一连接获取访问服务。当服务器与客户端通过第一IP地址建 立的第一连接中断时,可以利用标识符字段确定客户端的第二IP地址,并利用第二IP地址重新建立服务器与客户端之间的网络连接,本方法无需重启服务器即可恢复服务器与客户端之间的网络连接问题,解决了现有用户态网络文件系统存在网络连接故障后恢复困难的问题。The application of the dual-stack access method for the user-mode network file system provided by the embodiment of the present invention allows the client to use the first IP address and the second IP address to connect to the server, and the IP protocol version numbers of the two IP addresses are different. Therefore, the client can first establish a first connection with the server using the first IP address, and obtain access services through the first connection. When the first connection established between the server and the client through the first IP address is interrupted, the identifier field can be used to determine the second IP address of the client, and the second IP address can be used to re-establish the network connection between the server and the client. The method can recover the network connection problem between the server and the client without restarting the server, and solves the problem that the existing user-mode network file system is difficult to recover after a network connection failure.
基于上述发明实施例,由于本发明实施例中的服务器与客户端均为支持双栈访问服务的设备,因此本发明实施例将说明一种具体的双栈设置方法,使客户端和服务器能够实现双栈访问服务,具体请参考图2,图2为本发明实施例提供的一种用户态网络文件系统双栈设置方法流程图,包括:Based on the above embodiments of the invention, since both the server and the client in the embodiment of the invention are devices that support dual-stack access services, the embodiment of the invention will explain a specific dual-stack setting method so that the client and the server can implement Dual-stack access service, please refer to FIG. 2 for details. FIG. 2 is a flowchart of a dual-stack setting method for a user-mode network file system according to an embodiment of the present invention, including:
S201:在配置文件中增加IPV6信息,并加载TI-RPC库。S201: Add IPV6 information to the configuration file, and load the TI-RPC library.
由于现有的用户态网络文件系统中的客户端大多以IPV4地址获取服务,服务器大多以IPV4地址提供服务,因此需要在服务器的配置文件中增加IPV6配置信息,使其支持IPV6协议。当然,同样需要在客户端的配置文件中怎家IPV6配置信息,使客户端支持IPV6协议。具体的,在配置环境中输入:Because most of the clients in the existing user-mode network file system obtain services with IPV4 addresses, and the servers mostly provide services with IPV4 addresses, it is necessary to add IPV6 configuration information to the server configuration file to enable it to support the IPV6 protocol. Of course, it is also necessary to configure the IPV6 configuration information in the client's configuration file to enable the client to support the IPV6 protocol. Specifically, enter in the configuration environment:
vim/etc/sysctl.confvim/etc/sysctl.conf
#net.ipv6.conf.all.disable_ipv6=1#net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.all.disable_ipv6=0net.ipv6.conf.all.disable_ipv6=0
net.ipv6.conf.default.disable_ipv6=0net.ipv6.conf.default.disable_ipv6=0
net.ipv6.conf.lo.disable_ipv6=0net.ipv6.conf.lo.disable_ipv6=0
其中,/etc/sysctl.conf即为配置文件。在输入上述内容后,需要执行sysctl–p指令,以便启用IPV6协议。由于服务器portmap守护程序不兼容IPV6,因此需要加载TI-RPC库,以便启用rpcbind服务。Among them, /etc/sysctl.conf is the configuration file. After entering the above content, you need to execute the sysctl-p command to enable the IPV6 protocol. Since the server portmap daemon is not compatible with IPV6, the TI-RPC library needs to be loaded to enable the rpcbind service.
S202:利用端口设置函数对各个端口的IP地址进行设置。S202: Use the port setting function to set the IP address of each port.
端口设置函数用于对端口对应的IP地址进行设置,由于服务器与客户端均支持双栈访问服务,因此需要对服务器和各个客户端上的部分端口绑定IPV6地址,在另外的端口上绑定IPV4地址。具体的,可以利用Bind_sockets_V4函数将IPV4地址和端口进行绑定,利用Bind_sockets_V6函数将IPV6地址和端口进行绑定。The port setting function is used to set the IP address corresponding to the port. Since both the server and the client support dual-stack access services, it is necessary to bind the IPV6 address to some ports on the server and each client, and bind them to other ports. IPV4 address. Specifically, the Bind_sockets_V4 function can be used to bind the IPV4 address and port, and the Bind_sockets_V6 function can be used to bind the IPV6 address and port.
S203:将IPV4地址的格式设置为::ffff:a.b.c.d。S203: Set the format of the IPV4 address to ::ffff:a.b.c.d.
为了使服务器和客户端在双栈模式中不发生故障,因此将服务器的IPV4地址的格式进行设置,将IPV4地址设置为128位,前80设置为0,中间16位设置为ffff,后32为a.b.c.d,a.b.c.d即为IPV4地址的原地址。例如当IPV4地址的原地址为100.7.44.1时,设置之后的IPV4地址即为::ffff:100.7.44.1。相应的,还需要对各个客户端的IPV4地址格式进行设置。In order to prevent the server and client from malfunctioning in the dual-stack mode, the format of the server’s IPV4 address is set. The IPV4 address is set to 128 bits, the first 80 bits are set to 0, the middle 16 bits are set to ffff, and the last 32 bits are set to abcd, abcd is the original address of the IPV4 address. For example, when the original IPV4 address is 100.7.44.1, the IPV4 address after setting is::ffff:100.7.44.1. Correspondingly, it is also necessary to set the IPV4 address format of each client.
S204:设置并开启双栈访问开关。S204: Set and turn on the dual stack access switch.
为了使服务器支持双栈访问,还需要设置双栈访问开关。具体的,在目标配置文件中增加IPV6开关字段即可成功设置双栈访问开关,例如在目标配置文件/etc/ganesha/ganesha.conf中增加v6disable=false/true字段,当v6disable=false时说明双栈访问访问开关打开。相应的,还需要对各个客户端设置并开启双栈访问开关。在配置结束后,可以在接收到IP地址查看请求时,利用IPV4地址和IPV6地址响应该IP地址查看请求。In order for the server to support dual-stack access, a dual-stack access switch needs to be set. Specifically, adding the IPV6 switch field in the target configuration file can successfully set the dual-stack access switch. For example, adding the v6disable=false/true field in the target configuration file /etc/ganesha/ganesha.conf. When v6disable=false, the dual-stack access switch can be successfully set. The stack access access switch is turned on. Correspondingly, it is also necessary to set and turn on the dual-stack access switch for each client. After the configuration is completed, when an IP address view request is received, the IPV4 address and IPV6 address can be used to respond to the IP address view request.
基于上述发明实施例,本发明实施例将具体说明客户端通过第一连接从服务器获取访问服务的过程,请参考图3,图3为本发明实施例提供的一种访问服务获取流程图,具体包括:Based on the above embodiments of the present invention, the embodiments of the present invention will specifically describe the process in which the client obtains access services from the server through the first connection. Please refer to FIG. 3, which is a flow chart for obtaining access services according to an embodiment of the present invention. include:
S301:获取客户端通过第一IP地址发送的访问请求,并在指定共享目录中确定访问请求指定的设备。S301: Obtain the access request sent by the client through the first IP address, and determine the device specified by the access request in the designated shared directory.
获取访问请求的方法本实施例不做限定,例如可以实时执行获取客户端通过第一IP地址发送的访问请求的操作,当未获取到时重复执行。优选的,可以建立监听套接字,利用监听套接字监听各个端口,并在监听到访问请求时获取客户端通过第一IP地址发送的访问请求。端口包括绑定了IPV4地址的端口和绑定了IPV6地址的端口,监听到访问请求的端口绑定的IP地址协议版本与第一IP地址的IP协议版本相同。The method for obtaining the access request is not limited in this embodiment. For example, the operation of obtaining the access request sent by the client through the first IP address may be performed in real time, and repeated execution when it is not obtained. Preferably, a listening socket can be established, and each port can be monitored by using the listening socket, and the access request sent by the client through the first IP address can be obtained when the access request is monitored. The port includes the port bound with the IPV4 address and the port bound with the IPV6 address. The IP address protocol version bound to the port that listens to the access request is the same as the IP protocol version of the first IP address.
在获取到访问请求后,确定指定共享目录,指定共享目录为挂载格式与第一IP地址的IP协议版本对应的共享目录,指定共享目录中挂载有一个或多个设备,在指定共享目录中确定访问请求指定的设备。After obtaining the access request, determine the designated shared directory, the designated shared directory is a shared directory with the mount format corresponding to the IP protocol version of the first IP address, and one or more devices are mounted in the designated shared directory, and in the designated shared directory Determine the device specified in the access request.
进一步,在一种可能的实施方式中,访问请求指定的设备并不存在于指定共享目录中。因此,在确定访问请求指定的设备之前,可以判断实行共享目录中是否存在访问请求指定的设备。如果存在,则确定访问请求指定的设备;如果不存在,则按照目标挂载格式将访问请求指定的设备挂载到指定共享目录中,目标挂载格式与第一IP地址的IP协议版本相对应,即当第一IP地址为IPV4地址时,目标挂载格式即为IPV4格式;当第一IP地址为IPV6版本时,目标挂载格式即为IPV6版本。Further, in a possible implementation manner, the device specified by the access request does not exist in the specified shared directory. Therefore, before the device specified by the access request is determined, it can be determined whether the device specified by the access request exists in the execution shared directory. If it exists, determine the device specified by the access request; if it does not exist, mount the device specified by the access request to the specified shared directory according to the target mount format, which corresponds to the IP protocol version of the first IP address , That is, when the first IP address is an IPV4 address, the target mounting format is the IPV4 format; when the first IP address is the IPV6 version, the target mounting format is the IPV6 version.
S302:建立客户端与指定共享目录之间的第一连接,利用第一连接为客户端提供访问服务。S302: Establish a first connection between the client and the designated shared directory, and use the first connection to provide an access service for the client.
具体的,可以创建目标版本的TCP套接字,利用TCP套接字连接客户端和指定共享目录,即利用TCP套接字充当第一连接。其中,目标版本与第一IP地址的IP协议版本相对应,即当第一IP地址为IPV4地址时,目标版本应为TCP4版本;当第一IP地址为IPV6地址时,目标版本应为TCP6版本。在创建TCP套接字后,利用TCP套接字为客户端提供访问服务。Specifically, a TCP socket of the target version can be created, and the TCP socket is used to connect the client and the designated shared directory, that is, the TCP socket is used as the first connection. Among them, the target version corresponds to the IP protocol version of the first IP address, that is, when the first IP address is an IPV4 address, the target version should be the TCP4 version; when the first IP address is an IPV6 address, the target version should be the TCP6 version . After the TCP socket is created, the TCP socket is used to provide access services for the client.
基于上述发明实施例,在一种可能的情况下,客户端在通过服务器访问某一文件时发生了文件锁故障,本发明实施例将说明一种文件锁故障的恢复方法,具体可以参考图4,图4为本发明实施例提供的一种文件锁故障恢复方法,包括:Based on the above embodiment of the invention, in a possible situation, a file lock failure occurs when the client accesses a file through the server. The embodiment of the invention will describe a method for recovering a file lock failure. For details, refer to Figure 4 , Figure 4 is a file lock failure recovery method provided by an embodiment of the present invention, including:
S401:当接收到目标文件的NFS文件锁的故障信息时,解析故障信息,确定NFS文件锁故障的类型。S401: When receiving the failure information of the NFS file lock of the target file, analyze the failure information to determine the type of the NFS file lock failure.
其中,目标文件为客户端访问的文件,客户端访问文件时可以以读模式打开,或者以写模式打开,无论客户端以任何模式访问目标文件,在目标文件的NFS文件锁发生故障时,服务器均会接收到目标文件的NFS文件锁的故障信息,该故障信息可以为notify通知消息。当接收到目标文件的NFS文件锁的故障信息时,对故障信息进行解析,确定目标文件的NFS文件锁故障的类型。本实施例并不限定具体的确定方法,可以参考相关技术,在此不再赘述。Among them, the target file is the file accessed by the client. When the client accesses the file, it can be opened in read mode or in write mode. No matter the client accesses the target file in any mode, when the NFS file lock of the target file fails, the server Both will receive the failure information of the NFS file lock of the target file, and the failure information may be a notify notification message. When the failure information of the NFS file lock of the target file is received, the failure information is analyzed to determine the type of the NFS file lock failure of the target file. This embodiment does not limit the specific determination method, and can refer to related technologies, which will not be repeated here.
S402:当NFS文件锁故障为第一类故障时,向客户端发送通知信息。S402: When the NFS file lock failure is the first type of failure, send notification information to the client.
需要说明的是,第一类故障即为服务器运行错误导致的故障,即服务器运行错误导致了目标文件的NFS文件锁发生故障。此时,需要向客户端发送通知信息,以便客户端重新申请针对目标文件的已授权的锁,即目标文件的NFS文件锁。具体的,在客户端重新申请已授权的锁时,需要利用标识符字段确定申请客户端的身份,当申请客户端为之前访问目标文件的客户端时,允许其继续访问文件。It should be noted that the first type of failure is the failure caused by the server operation error, that is, the server operation error causes the NFS file lock of the target file to fail. At this time, a notification message needs to be sent to the client so that the client can reapply for the authorized lock for the target file, that is, the NFS file lock of the target file. Specifically, when the client reapplies for an authorized lock, the identifier field needs to be used to determine the identity of the applying client. When the applying client is a client that previously accessed the target file, it is allowed to continue to access the file.
S403:当NFS文件锁故障为第二类故障时,释放NFS文件锁。S403: When the NFS file lock failure is the second type of failure, release the NFS file lock.
需要说明的是,第二类故障即为与客户端之间的连接终端导致的故障,即服务器与客户端之间的连接断开导致的NFS文件锁故障。此时,可以释放已授权的锁,即释放目标文件的NFS文件锁。在释放NFS文件锁之后,还可以执行其他操作,具体内容本实施例不做限定。It should be noted that the second type of failure is the failure caused by the connection terminal with the client, that is, the NFS file lock failure caused by the disconnection of the connection between the server and the client. At this time, you can release the authorized lock, that is, release the NFS file lock of the target file. After the NFS file lock is released, other operations can be performed, and the specific content is not limited in this embodiment.
应用本发明实施例提供的用户态网络文件系统双栈访问方法,可以在NFS文件锁发生故障时确定故障类型,并采取相应的手段恢复故障,避免用户态网络文件系统因NFS文件锁故障导致文件打开冲突等问题。By applying the dual-stack access method for a user-mode network file system provided by the embodiment of the present invention, the fault type can be determined when the NFS file lock fails, and corresponding measures can be taken to recover from the fault, so as to avoid the user-mode network file system from causing files due to the NFS file lock failure. Open issues such as conflicts.
下面对本发明实施例提供的用户态网络文件系统双栈访问装置进行介绍,下文描述的用户态网络文件系统双栈访问装置与上文描述的用户态网络文件系统双栈访问方法可相互对应参照。The following describes the user-mode network file system dual-stack access device provided by the embodiment of the present invention. The user-mode network file system dual-stack access device described below and the above-described user-mode network file system dual-stack access method can be referred to each other.
请参考图5,图5为本发明实施例提供的一种用户态网络文件系统双栈访问装置的结构示意图,包括:Please refer to FIG. 5, which is a schematic structural diagram of a dual-stack access device for a user-mode network file system according to an embodiment of the present invention, including:
第一连接模块510,用于利用客户端的第一IP地址与客户端建立第一连接,并利用指定共享目录通过第一连接为客户端提供访问服务;其中,指定共享目录为挂载格式与第一IP地址的IP协议版本对应的共享目录;The first connection module 510 is configured to establish a first connection with the client by using the first IP address of the client, and use the designated shared directory to provide access services for the client through the first connection; wherein the designated shared directory is the mount format and the first connection A shared directory corresponding to the IP protocol version of the IP address;
获取模块520,用于当第一连接断开时,通过客户端对应的标识符字段确定客户端的第二IP地址;其中,第一IP地址与第二IP地址的IP协议版本不同;The obtaining module 520 is configured to determine the second IP address of the client through the identifier field corresponding to the client when the first connection is disconnected; wherein the IP protocol version of the first IP address and the second IP address are different;
第二连接模块530,用于利用第二IP地址建立指定共享目录与客户端之间的第二连接。The second connection module 530 is configured to use the second IP address to establish a second connection between the designated shared directory and the client.
可选的,还包括:Optionally, it also includes:
故障类型确定模块,用于当接收到目标文件的NFS文件锁的故障信息时,解析故障信息,确定NFS文件锁故障的类型;其中,目标文件为客户端访问的文件;The fault type determination module is used to analyze the fault information when receiving the fault information of the NFS file lock of the target file to determine the type of the NFS file lock fault; where the target file is the file accessed by the client;
第一恢复模块,用于当NFS文件锁故障为第一类故障时,向客户端发送通知信息;其中,第一类故障为服务器运行错误导致的故障;The first recovery module is used to send notification information to the client when the NFS file lock failure is the first type of failure; where the first type of failure is a failure caused by a server operation error;
第二恢复模块,用于当NFS文件锁故障为第二类故障时,释放NFS文件锁;其中,第二类故障为与客户端之间的连接中断导致的故障。The second recovery module is used to release the NFS file lock when the NFS file lock failure is the second type of failure; where the second type of failure is the failure caused by the interruption of the connection with the client.
可选的,还包括:Optionally, it also includes:
序列ID获取模块,用于当接收到客户端发送的首次NFS请求时,获取客户端的客户端序列ID;The serial ID acquisition module is used to acquire the client serial ID of the client when the first NFS request sent by the client is received;
标识符字段生成模块,用于利用客户端序列ID生成标识符字段中的标识符id,并利用标识符id、第一IP地址和第二IP地址组成标识符字段。The identifier field generating module is used to generate the identifier id in the identifier field using the client serial ID, and use the identifier id, the first IP address and the second IP address to form the identifier field.
可选的,第一连接模块510,包括:Optionally, the first connection module 510 includes:
确定单元,用于获取客户端通过第一IP地址发送的访问请求,并在指定共享目录中确定访问请求指定的设备;The determining unit is used to obtain the access request sent by the client through the first IP address, and determine the device specified by the access request in the designated shared directory;
服务单元,用于建立客户端与指定共享目录之间的第一连接,利用第一连接为客户端提供访问服务。The service unit is used to establish a first connection between the client and the designated shared directory, and use the first connection to provide access services for the client.
可选的,确定单元,包括:Optionally, the determining unit includes:
判断子单元,用于判断指定共享目录中是否存在设备;The judging subunit is used to judge whether there is a device in the specified shared directory;
挂载子单元,用于若指定共享目录中不存在设备,则按照目标挂载格式将设备挂载到指定共享目录中;其中,目标挂载格式与第一IP地址的IP协议版本相对应;The mounting subunit is used to mount the device in the designated shared directory according to the target mounting format if the device does not exist in the designated shared directory; wherein, the target mounting format corresponds to the IP protocol version of the first IP address;
确定子单元,用于若指定共享目录中存在设备,则确定访问请求指定的设备。The determining subunit is used to determine the device specified by the access request if there is a device in the specified shared directory.
可选的,确定单元,包括:Optionally, the determining unit includes:
监听子单元,用于建立监听套接字,利用监听套接字监听各个端口,并在监听到访问请求时获取客户端通过第一IP地址发送的访问请求。The monitoring subunit is used to establish a monitoring socket, use the monitoring socket to monitor each port, and obtain the access request sent by the client through the first IP address when the access request is monitored.
可选的,服务单元,包括:Optionally, the service unit includes:
套接字创建子单元,用于创建目标版本的TCP套接字,利用TCP套接字连接客户端和指定共享目录;目标版本与第一IP地址的IP协议版本相对应;The socket creation subunit is used to create the target version of the TCP socket, use the TCP socket to connect the client and specify the shared directory; the target version corresponds to the IP protocol version of the first IP address;
服务子单元,用于利用TCP套接字为客户端提供访问服务。The service subunit is used to provide access services for the client by using the TCP socket.
可选的,还包括:Optionally, it also includes:
配置模块,用于在配置文件中增加IPV6配置信息,并加载TI-RPC库。The configuration module is used to add IPV6 configuration information to the configuration file and load the TI-RPC library.
可选的,还包括:Optionally, it also includes:
地址设置模块,用于利用端口设置函数对各个端口的IP地址进行设置;其中,IP地址包括IPV4地址和IPV6地址;The address setting module is used to set the IP address of each port by using the port setting function; among them, the IP address includes the IPV4 address and the IPV6 address;
格式修改模块,用于将IPV4地址的格式设置为::ffff:a.b.c.d;其中,a.b.c.d为IPV4地址的原地址。The format modification module is used to set the format of the IPV4 address to ::ffff:a.b.c.d; where a.b.c.d is the original address of the IPV4 address.
可选的,还包括:Optionally, it also includes:
双栈开关设置模块,用于设置并开启双栈访问开关。The dual-stack switch setting module is used to set and turn on the dual-stack access switch.
可选的,还包括:Optionally, it also includes:
请求响应模块,用于当接收到IP地址查看请求时,利用IPV4地址和IPV6地址响应IP地址查看请求。The request response module is used to respond to the IP address check request with the IPV4 address and the IPV6 address when the IP address check request is received.
下面对本发明实施例提供的用户态网络文件系统双栈访问设备进行介绍,下文描述的用户态网络文件系统双栈访问设备与上文描述的用户态网络文件系统双栈访问方法可相互对应参照。The following describes the user-mode network file system dual-stack access device provided by the embodiment of the present invention. The user-mode network file system dual-stack access device described below and the above-described user-mode network file system dual-stack access method can be referred to each other.
请参考图6,图6为本发明实施例提供的一种用户态网络文件系统双栈访问设备的结构示意图,该用户态网络文件系统双栈访问设备包括存储器、处理器,其中:Please refer to FIG. 6, which is a schematic structural diagram of a dual-stack access device for a user-mode network file system according to an embodiment of the present invention. The dual-stack access device for a user-mode network file system includes a memory and a processor, wherein:
存储器610,用于保存计算机程序;The memory 610 is used to store computer programs;
处理器620,用于执行计算机程序,以实现上述的用户态网络文件系统双栈访问方法。The processor 620 is configured to execute a computer program to implement the aforementioned dual-stack access method for a user-mode network file system.
下面对本发明实施例提供的计算机可读存储介质进行介绍,下文描述的计算机可读存储介质与上文描述的用户态网络文件系统双栈访问方法可 相互对应参照。The computer-readable storage medium provided by the embodiment of the present invention will be introduced below. The computer-readable storage medium described below and the user-mode network file system dual-stack access method described above can be referenced correspondingly.
本发明还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现上述的用户态网络文件系统双栈访问方法的步骤。The present invention also provides a computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the steps of the above-mentioned dual-stack access method for a user-mode network file system are realized.
该计算机可读存储介质可以包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The computer-readable storage medium may include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk, etc., which can store program codes Medium.
本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the description of the method part.
专业人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件的方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应该认为超出本发明的范围。Professionals may further realize that the units and algorithm steps of the examples described in the embodiments disclosed in this article can be implemented by electronic hardware, computer software, or a combination of the two, in order to clearly illustrate the possibilities of hardware and software. Interchangeability, in the above description, the composition and steps of each example have been generally described in accordance with the function. Whether these functions are implemented in hardware or software depends on the specific application and design constraint conditions of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered as going beyond the scope of the present invention.
结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of the method or algorithm described in combination with the embodiments disclosed in this document can be directly implemented by hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, or all areas in the technical field. Any other known storage media.
最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系属于仅仅用来将一个实体或者操作与另一个实体或者操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语“包括”、“包含”或者其他任何变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素, 而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。Finally, it should be noted that in this article, relationships such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply these entities. Or there is any such actual relationship or sequence between operations. Moreover, the terms "include", "include" or any other variants are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes those that are not explicitly listed. Other elements, or also include elements inherent to this process, method, article, or equipment.
以上对本发明所提供的一种用户态网络文件系统双栈访问方法、用户态网络文件系统双栈访问装置、用户态网络文件系统双栈访问设备及计算机可读存储介质进行了详细介绍,本文中应用了具体个例对本发明的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本发明的方法及其核心思想;同时,对于本领域的一般技术人员,依据本发明的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本发明的限制。The above provides a detailed introduction to a user-mode network file system dual-stack access method, a user-mode network file system dual-stack access device, a user-mode network file system dual-stack access device, and a computer-readable storage medium provided by the present invention. Specific examples are used to illustrate the principle and implementation of the present invention. The description of the above examples is only used to help understand the method and core idea of the present invention; at the same time, for those of ordinary skill in the art, according to the idea of the present invention There will be changes in the specific implementation and the scope of application. In summary, the content of this specification should not be construed as a limitation to the present invention.

Claims (14)

  1. 一种用户态网络文件系统双栈访问方法,其特征在于,包括:A dual-stack access method for a user-mode network file system is characterized in that it includes:
    利用客户端的第一IP地址与所述客户端建立第一连接,并利用指定共享目录通过所述第一连接为所述客户端提供访问服务;其中,所述指定共享目录为挂载格式与所述第一IP地址的IP协议版本对应的共享目录;The first IP address of the client is used to establish a first connection with the client, and a designated shared directory is used to provide access services for the client through the first connection; wherein, the designated shared directory is in a mounting format and The shared directory corresponding to the IP protocol version of the first IP address;
    当所述第一连接断开时,通过所述客户端对应的标识符字段确定所述客户端的第二IP地址;其中,所述第一IP地址与所述第二IP地址的IP协议版本不同;When the first connection is disconnected, the second IP address of the client is determined by the identifier field corresponding to the client; wherein the IP protocol version of the first IP address and the second IP address are different ;
    利用所述第二IP地址建立所述指定共享目录与所述客户端之间的第二连接。Using the second IP address to establish a second connection between the designated shared directory and the client.
  2. 根据权利要求1所述的用户态网络文件系统双栈访问方法,其特征在于,还包括:The dual-stack access method for a user-mode network file system according to claim 1, further comprising:
    当接收到目标文件的NFS文件锁的故障信息时,解析所述故障信息,确定NFS文件锁故障的类型;其中,所述目标文件为所述客户端访问的文件;When receiving the failure information of the NFS file lock of the target file, analyze the failure information to determine the type of the NFS file lock failure; wherein, the target file is a file accessed by the client;
    当所述NFS文件锁故障为第一类故障时,向所述客户端发送通知信息;其中,所述第一类故障为服务器运行错误导致的故障;When the NFS file lock failure is a first type of failure, sending notification information to the client; wherein, the first type of failure is a failure caused by a server operation error;
    当所述NFS文件锁故障为第二类故障时,释放所述NFS文件锁;其中,所述第二类故障为与所述客户端之间的连接中断导致的故障。When the NFS file lock failure is a second type of failure, the NFS file lock is released; wherein the second type of failure is a failure caused by the interruption of the connection with the client.
  3. 根据权利要求1所述的用户态网络文件系统双栈访问方法,其特征在于,在所述利用客户端的第一IP地址与所述客户端建立第一连接之前,还包括:The dual-stack access method for a user-mode network file system according to claim 1, wherein before the first connection is established with the client by using the first IP address of the client, the method further comprises:
    当接收到所述客户端发送的首次NFS请求时,获取所述客户端的客户端序列ID;When receiving the first NFS request sent by the client, acquiring the client serial ID of the client;
    利用所述客户端序列ID生成所述标识符字段中的标识符id,并利用所述标识符id、所述第一IP地址和所述第二IP地址组成所述标识符字段。Use the client serial ID to generate the identifier id in the identifier field, and use the identifier id, the first IP address, and the second IP address to form the identifier field.
  4. 根据权利要求1所述的用户态网络文件系统双栈访问方法,其特征在于,所述利用客户端的第一IP地址与所述客户端建立第一连接,并利用指定共享目录通过所述第一连接为所述客户端提供访问服务,包括:The user-mode network file system dual-stack access method according to claim 1, wherein the first IP address of the client is used to establish a first connection with the client, and a designated shared directory is used to pass the first connection with the client. The connection provides access services for the client, including:
    获取所述客户端通过所述第一IP地址发送的访问请求,并在所述指定共享目录中确定所述访问请求指定的设备;Acquiring the access request sent by the client through the first IP address, and determining the device specified by the access request in the designated shared directory;
    建立所述客户端与所述指定共享目录之间的所述第一连接,利用所述第一连接为所述客户端提供所述访问服务。The first connection between the client and the designated shared directory is established, and the first connection is used to provide the access service for the client.
  5. 根据权利要求4所述的用户态网络文件系统双栈访问方法,其特征在于,所述在所述指定共享目录中确定所述访问请求指定的设备,包括:The dual-stack access method for a user-mode network file system according to claim 4, wherein the determining the device specified by the access request in the specified shared directory comprises:
    判断所述指定共享目录中是否存在所述设备;Determine whether the device exists in the designated shared directory;
    若否,则按照目标挂载格式将所述设备挂载到所述指定共享目录中;其中,所述目标挂载格式与所述第一IP地址的所述IP协议版本相对应;If not, mount the device to the designated shared directory according to the target mount format; wherein, the target mount format corresponds to the IP protocol version of the first IP address;
    若是,则确定所述访问请求指定的所述设备。If yes, determine the device specified by the access request.
  6. 根据权利要求5所述的用户态网络文件系统双栈访问方法,其特征在于,所述获取所述客户端通过所述第一IP地址发送的访问请求,包括:The dual-stack access method for a user-mode network file system according to claim 5, wherein said obtaining an access request sent by said client through said first IP address comprises:
    建立监听套接字,利用所述监听套接字监听各个端口,并在监听到所述访问请求时获取所述客户端通过所述第一IP地址发送的所述访问请求。Establish a listening socket, use the listening socket to monitor each port, and obtain the access request sent by the client through the first IP address when the access request is monitored.
  7. 根据权利要求6所述的用户态网络文件系统双栈访问方法,其特征在于,所述建立所述客户端与所述指定共享目录之间的所述第一连接,利用所述第一连接为所述客户端提供所述访问服务,包括:The user-mode network file system dual-stack access method according to claim 6, wherein the establishing the first connection between the client and the designated shared directory is using the first connection as The client providing the access service includes:
    创建目标版本的TCP套接字,利用所述TCP套接字连接所述客户端和所述指定共享目录;所述目标版本与所述第一IP地址的所述IP协议版本相对应;Creating a TCP socket of a target version, and using the TCP socket to connect the client and the designated shared directory; the target version corresponds to the IP protocol version of the first IP address;
    利用所述TCP套接字为所述客户端提供访问服务。The TCP socket is used to provide access services for the client.
  8. 根据权利要求1所述的用户态网络文件系统双栈访问方法,其特征在于,在所述利用客户端的第一IP地址与所述客户端建立第一连接之前,还包括:The dual-stack access method for a user-mode network file system according to claim 1, wherein before the first connection is established with the client by using the first IP address of the client, the method further comprises:
    在配置文件中增加IPV6配置信息,并加载TI-RPC库。Add IPV6 configuration information to the configuration file and load the TI-RPC library.
  9. 根据权利要求8所述的用户态网络文件系统双栈访问方法,其特征在于,在所述配置文件中增加IPV6配置信息之后,还包括:The dual-stack access method for a user-mode network file system according to claim 8, wherein after adding IPV6 configuration information to the configuration file, the method further comprises:
    利用端口设置函数对各个端口的IP地址进行设置;其中,所述IP地址包括IPV4地址和IPV6地址;Use the port setting function to set the IP address of each port; wherein, the IP address includes an IPV4 address and an IPV6 address;
    将所述IPV4地址的格式设置为::ffff:a.b.c.d;其中,所述a.b.c.d为所述IPV4地址的原地址。The format of the IPV4 address is set to::ffff:a.b.c.d; where a.b.c.d is the original address of the IPV4 address.
  10. 根据权利要求9所述的用户态网络文件系统双栈访问方法,其特征在于,在所述利用客户端的第一IP地址与所述客户端建立第一连接之前,还包括:The dual-stack access method for a user-mode network file system according to claim 9, characterized in that, before the first IP address of the client is used to establish a first connection with the client, the method further comprises:
    设置并开启双栈访问开关。Set and turn on the dual stack access switch.
  11. 根据权利要求10所述的用户态网络文件系统双栈访问方法,其特征在于,还包括:The dual-stack access method for a user-mode network file system according to claim 10, further comprising:
    当接收到IP地址查看请求时,利用所述IPV4地址和所述IPV6地址响应所述IP地址查看请求。When an IP address check request is received, the IPV4 address and the IPV6 address are used to respond to the IP address check request.
  12. 一种用户态网络文件系统双栈访问装置,其特征在于,包括:A dual-stack access device for a user-mode network file system, which is characterized in that it comprises:
    第一连接模块,用于利用客户端的第一IP地址与所述客户端建立第一连接,并利用指定共享目录通过所述第一连接为所述客户端提供访问服务;其中,所述指定共享目录为挂载格式与所述第一IP地址的IP协议版本对应的共享目录;The first connection module is configured to establish a first connection with the client by using the client's first IP address, and use a designated shared directory to provide access services for the client through the first connection; wherein, the designated share The directory is a shared directory whose mounting format corresponds to the IP protocol version of the first IP address;
    获取模块,用于当所述第一连接断开时,通过所述客户端对应的标识符字段确定所述客户端的第二IP地址;其中,所述第一IP地址与所述第二IP地址的IP协议版本不同;The obtaining module is configured to determine the second IP address of the client through the identifier field corresponding to the client when the first connection is disconnected; wherein, the first IP address and the second IP address The version of the IP protocol is different;
    第二连接模块,用于利用所述第二IP地址建立所述指定共享目录与所述客户端之间的第二连接。The second connection module is configured to use the second IP address to establish a second connection between the designated shared directory and the client.
  13. 一种用户态网络文件系统双栈访问设备,其特征在于,包括存储器和处理器,其中:A dual-stack access device for a user-mode network file system, which is characterized by comprising a memory and a processor, wherein:
    所述存储器,用于保存计算机程序;The memory is used to store computer programs;
    所述处理器,用于执行所述计算机程序,以实现如权利要求1至11任一项所述的用户态网络文件系统双栈访问方法。The processor is configured to execute the computer program to implement the user-mode network file system dual-stack access method according to any one of claims 1 to 11.
  14. 一种计算机可读存储介质,其特征在于,用于保存计算机程序,其中,所述计算机程序被处理器执行时实现如权利要求1至11任一项所述的用户态网络文件系统双栈访问方法。A computer-readable storage medium, characterized in that it is used to store a computer program, wherein the computer program is executed by a processor to realize the user-mode network file system dual-stack access according to any one of claims 1 to 11 method.
PCT/CN2020/073116 2019-11-07 2020-01-20 Dual-stack access method, apparatus and device for user-mode network file system WO2021088254A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201911083371.XA CN111225020B (en) 2019-11-07 2019-11-07 User mode network file system dual-stack access method, device and equipment
CN201911083371.X 2019-11-07

Publications (1)

Publication Number Publication Date
WO2021088254A1 true WO2021088254A1 (en) 2021-05-14

Family

ID=70827606

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/073116 WO2021088254A1 (en) 2019-11-07 2020-01-20 Dual-stack access method, apparatus and device for user-mode network file system

Country Status (2)

Country Link
CN (1) CN111225020B (en)
WO (1) WO2021088254A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113505111A (en) * 2021-06-22 2021-10-15 新华三大数据技术有限公司 Shared directory mounting method and distributed network additional storage system
CN113612811A (en) * 2021-06-20 2021-11-05 济南浪潮数据技术有限公司 Method, system, equipment and medium for client mounting in multiple channels
CN113672451A (en) * 2021-07-21 2021-11-19 济南浪潮数据技术有限公司 BMC service detection method, device, equipment and readable storage medium
CN117033330A (en) * 2023-10-08 2023-11-10 南京翼辉信息技术有限公司 Multi-core file sharing system and control method thereof

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114885042A (en) * 2021-01-21 2022-08-09 北京金山云网络技术有限公司 Network data transmission method, client, server and system
CN113098972B (en) * 2021-04-12 2023-01-31 京东科技信息技术有限公司 Method and device for connecting with equipment, electronic equipment and storage medium
CN113709100B (en) * 2021-07-16 2022-12-27 苏州浪潮智能科技有限公司 Shared file access control method, device, equipment and readable storage medium
CN116450058B (en) * 2023-06-19 2023-09-19 浪潮电子信息产业股份有限公司 Data transfer method, device, heterogeneous platform, equipment and medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9632892B1 (en) * 2015-03-30 2017-04-25 EMC IP Holding Company LLC NFS cluster failover
CN109040207A (en) * 2018-07-20 2018-12-18 广东浪潮大数据研究有限公司 A kind of method, device and equipment accessing User space Network File System

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101692674B (en) * 2009-10-30 2012-10-17 杭州华三通信技术有限公司 Method and equipment for double stack access
CN101789981B (en) * 2010-03-18 2014-03-19 杭州华三通信技术有限公司 Method and equipment for dual-stack data transmission
CN103685281B (en) * 2013-12-18 2017-08-15 中国联合网络通信集团有限公司 The switching method and equipment of a kind of network address agreement
CN105790985B (en) * 2014-12-23 2020-06-16 中兴通讯股份有限公司 Data switching method, first device, second device and system
CN106777394B (en) * 2017-02-28 2020-09-18 苏州浪潮智能科技有限公司 Cluster file system
CN108833190A (en) * 2018-07-27 2018-11-16 郑州云海信息技术有限公司 A kind of NFS service fault alarm method, device and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9632892B1 (en) * 2015-03-30 2017-04-25 EMC IP Holding Company LLC NFS cluster failover
CN109040207A (en) * 2018-07-20 2018-12-18 广东浪潮大数据研究有限公司 A kind of method, device and equipment accessing User space Network File System

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113612811A (en) * 2021-06-20 2021-11-05 济南浪潮数据技术有限公司 Method, system, equipment and medium for client mounting in multiple channels
CN113505111A (en) * 2021-06-22 2021-10-15 新华三大数据技术有限公司 Shared directory mounting method and distributed network additional storage system
CN113505111B (en) * 2021-06-22 2024-03-12 新华三大数据技术有限公司 Shared directory mounting method and distributed network additional storage system
CN113672451A (en) * 2021-07-21 2021-11-19 济南浪潮数据技术有限公司 BMC service detection method, device, equipment and readable storage medium
CN113672451B (en) * 2021-07-21 2023-12-22 济南浪潮数据技术有限公司 BMC service detection method, device, equipment and readable storage medium
CN117033330A (en) * 2023-10-08 2023-11-10 南京翼辉信息技术有限公司 Multi-core file sharing system and control method thereof
CN117033330B (en) * 2023-10-08 2023-12-08 南京翼辉信息技术有限公司 Multi-core file sharing system and control method thereof

Also Published As

Publication number Publication date
CN111225020B (en) 2021-06-29
CN111225020A (en) 2020-06-02

Similar Documents

Publication Publication Date Title
WO2021088254A1 (en) Dual-stack access method, apparatus and device for user-mode network file system
EP2232828B1 (en) Failover in a host concurrently supporting multiple virtual ip addresses across multiple adapters
WO2019128734A1 (en) Method for internet of things device to access network, apparatus, and system
US8799718B2 (en) Failure system for domain name system client
CN106790758B (en) Method and device for accessing network object in NAT network
EP2727002A1 (en) Methods and apparatus for remotely updating executing processes
US20030033412A1 (en) Seamless fail-over support for virtual interface architecture (VIA) or the like
US10069941B2 (en) Scalable event-based notifications
CN107666493B (en) Database configuration method and equipment thereof
WO2021184587A1 (en) Prometheus-based private cloud monitoring method and apparatus, and computer device and storage medium
WO2007056336A1 (en) System and method for writing data to a directory
CN112202853B (en) Data synchronization method, system, computer device and storage medium
CN112671554A (en) Node fault processing method and related device
US8489727B2 (en) Active storage area network discovery system and method
CN112035062B (en) Migration method of local storage of cloud computing, computer equipment and storage medium
CN108352995B (en) SMB service fault processing method and storage device
US11153173B1 (en) Dynamically updating compute node location information in a distributed computing environment
CN115250206B (en) Shared risk warning method and electronic equipment
CN116781564A (en) Network detection method and system for container cloud platform
CN114301872B (en) Domain name based access method and device, electronic equipment and storage medium
US20080198740A1 (en) Service take-over system of multi-host system and method therefor
CN112583760A (en) Object storage access method, device, equipment and computer storage medium
JP2006190173A (en) Environment setting information management program and environment setting information management method
CN115374057A (en) Data snapshot method and related equipment
CN113612811B (en) Method, system, equipment and medium for client mounting in multiple channels

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20885285

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 20885285

Country of ref document: EP

Kind code of ref document: A1