CN108900647B - Address switching processing method and device - Google Patents

Address switching processing method and device Download PDF

Info

Publication number
CN108900647B
CN108900647B CN201811067913.XA CN201811067913A CN108900647B CN 108900647 B CN108900647 B CN 108900647B CN 201811067913 A CN201811067913 A CN 201811067913A CN 108900647 B CN108900647 B CN 108900647B
Authority
CN
China
Prior art keywords
nfs
address
server
client
virtual
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811067913.XA
Other languages
Chinese (zh)
Other versions
CN108900647A (en
Inventor
李明明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
New H3C Technologies Co Ltd Chengdu Branch
Original Assignee
New H3C Technologies Co Ltd Chengdu Branch
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 New H3C Technologies Co Ltd Chengdu Branch filed Critical New H3C Technologies Co Ltd Chengdu Branch
Priority to CN201811067913.XA priority Critical patent/CN108900647B/en
Publication of CN108900647A publication Critical patent/CN108900647A/en
Application granted granted Critical
Publication of CN108900647B publication Critical patent/CN108900647B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/06Management of faults, events, alarms or notifications
    • H04L41/0654Management of faults, events, alarms or notifications using network fault recovery
    • H04L41/0663Performing the actions predefined by failover planning, e.g. switching to standby network elements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/45Network directories; Name-to-address mapping
    • 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/148Migration or transfer of sessions

Landscapes

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

Abstract

The embodiment of the application provides an address switching processing method and device, and relates to the technical field of communication. The method comprises the following steps: before switching the NFS server, searching whether a virtual IP address with an IP address of the NFS client accessing the NFS server exists or not, wherein a port number is a target TCP connection of an NFS service port number; and deleting the target TCP connection recorded in the NFS server and the mapping relation between the virtual IP address and the actual IP address of the network card of the NFS server, so that the virtual IP address is switched to other NFS servers, and the other NFS servers provide NFS services for the NFS client. Through the above process, when the NFS server needs to be switched, the TCP connection in the NFS server can be deleted, so that when the NFS server is switched back again in a short time, the NFS client and the NFS server can quickly recreate a new TCP connection, and it is ensured that the NFS service provided by the NFS server is not interrupted.

Description

Address switching processing method and device
Technical Field
The present application relates to the field of communications technologies, and in particular, to an address switching processing method and apparatus.
Background
A Network File System (NFS) allows an NFS client to access resources on an NFS server through a Network. With the introduction of concepts of high concurrency, high availability and the like, the NFS client puts higher requirements on the stability of the NFS server. In order to ensure stability of the NFS service, a plurality of NFS servers may provide the NFS service for the NFS client together, and the NFS client may be connected to the NFS server through a virtual IP address, but specifically, which NFS server provides the service is transparent and agnostic to the NFS client. When the NFS server that is providing the service cannot provide the service normally, such as downtime, the virtual IP address is switched to the normal NFS server to continue providing the service for the NFS client, the ongoing NFS service of the NFS client is not affected, and the NFS client is hardly perceived in the whole process.
Referring to fig. 1, fig. 1 is a network diagram of an NFS client connected to an NFS server through a virtual IP address. If the NFS client is writing data to or reading data from the NFS server without interruption, the virtual IP address is initially mapped onto NFS server a, i.e., NFS server a provides NFS services for the NFS client. If the NFS server A has a problem, the virtual IP address is switched and mapped to the NFS server B, and the NFS server B provides NFS service for the NFS client. Because the NFS supports high availability, the NFS client is almost imperceptible in the process, and the ongoing read-write task of the NFS client is not influenced.
In the above scenario, the mapping relationship of the virtual IP address is switched from the NFS server a to the NFS server B, which does not affect the NFS client service. However, if the mapping relationship of the virtual IP address is switched from NFS server a to NFS server B, the mapping relationship of the virtual IP address is switched back to NFS server a by NFS server B in a very short time (for example, 30 s). In the above process, because the NFS client and the NFS server a do not normally close by waving hands four times of TCP connection, the previous TCP connection may remain in the NFS server a, and when the NFS client and the NFS server a are switched back to the NFS server a within a short time, the NFS client cannot quickly establish the TCP connection with the NFS server a due to the existence of the remaining TCP connection, and in this case, the read-write task that the NFS client is performing may be interrupted.
Disclosure of Invention
The embodiment of the application describes an address switching processing method and device, which are used for clearing TCP (transmission control protocol) connection in an NFS (network file system) server.
In a first aspect, an embodiment of the present application provides an address switching processing method, which is applied to an NFS server, and the method includes:
before switching the NFS server, searching whether a virtual IP address with an IP address of the NFS client accessing the NFS server exists or not, wherein a port number is a target TCP connection of an NFS service port number;
and if the target TCP connection exists, deleting the target TCP connection recorded in the NFS server and the mapping relation between the virtual IP address and the actual IP address of the NFS server network card so as to switch the virtual IP address to other NFS servers, and providing NFS services for the NFS client by the other NFS servers.
Optionally, in this embodiment, the method further includes: a step of deleting the state information of the NFS client, the step including:
detecting whether a structural body used for storing state information of an NFS client in the NFS server is used or not;
if not, the structure is deleted.
Optionally, in this embodiment, before performing the NFS server handover, the method further includes:
and detecting the network communication state or the NFS process state of the NFS server, and when detecting that the network communication state is the preset communication state or the NFS process state is the preset process state, executing a step of searching whether a target TCP connection with an IP address of the NFS client accessing the NFS server exists or not, wherein the port number is the NFS service port number.
Optionally, in this embodiment, the searching whether there is a target TCP connection with an IP address being a virtual IP address of the NFS client accessing the NFS server and a port number being a port number of the NFS service includes:
sending the virtual IP address to a kernel mode through an interactive interface of a user mode;
and in the kernel mode, searching whether a target TCP connection with an IP address as the virtual IP address and a port number as an NFS service port number exists.
Optionally, in this embodiment, when switching back to the NFS server, the method further includes:
and creating TCP connection with the NFS client, establishing a mapping relation between the virtual IP address and an actual IP address of the NFS server network card, and providing NFS service for the NFS client by the NFS server.
In a second aspect, an embodiment of the present application further provides an address switching processing apparatus, which is applied to a network file system NFS server, where the apparatus includes:
a searching module, configured to search, before performing the NFS server switching, whether a target TCP connection exists where an IP address is a virtual IP address where an NFS client accesses the NFS server, and a port number is an NFS service port number;
and the TCP connection deleting module is used for deleting the target TCP connection recorded in the NFS server and the mapping relation between the virtual IP address and the actual IP address of the network card of the NFS server if the target TCP connection exists, so that the virtual IP address is switched to other NFS servers, and the other NFS servers provide NFS services for the NFS client.
Optionally, in this embodiment, the apparatus further includes a state information deleting module configured to delete the state information of the NFS client, where the state information deleting module is specifically configured to:
detecting whether a structural body used for storing state information of an NFS client in the NFS server is used or not;
if not, the structure is deleted.
Optionally, in this embodiment, the apparatus further includes:
and the detection module is used for detecting the network communication state or the NFS process state of the NFS server, and when the network communication state or the NFS process state is detected to be the preset communication state or the preset process state, the search module performs search to determine whether the virtual IP address with the IP address of the NFS client accessing the NFS server exists, and the port number of the target TCP connection is the NFS service port number.
Optionally, in this embodiment, the search module is specifically configured to:
sending the virtual IP address to a kernel mode through an interactive interface of a user mode;
and in the kernel mode, searching whether a target TCP connection with an IP address as the virtual IP address and a port number as an NFS service port number exists.
Optionally, in this embodiment, the apparatus further includes a creating module, and when the NFS server is handed back to, the creating module is configured to:
and creating TCP connection with the NFS client, establishing a mapping relation between the virtual IP address and an actual IP address of the NFS server network card, and providing NFS service for the NFS client by the NFS server.
In a third aspect, an embodiment of the present application further provides an NFS server, where the NFS server includes a processor and a nonvolatile memory storing several computer instructions, and when the computer instructions are executed by the processor, the NFS server executes the address switching processing method according to the first aspect.
In a fourth aspect, an embodiment of the present application further provides a readable storage medium, where the readable storage medium includes a computer program, and the computer program controls, when running, the NFS server where the readable storage medium is located to execute the address switching processing method according to the first aspect.
Compared with the prior art, the method has the following beneficial effects:
the embodiment of the application provides an address switching processing method and device, before switching an NFS server, whether a virtual IP address with an IP address of an NFS client accessing the NFS server exists is searched, and a port number is a target TCP connection of an NFS service port number; and deleting the target TCP connection recorded in the NFS server and the mapping relation between the virtual IP address and the actual IP address of the network card of the NFS server, so that the virtual IP address is switched to other NFS servers, and the other NFS servers provide NFS services for the NFS client. Through the above process, when the NFS server needs to be switched (i.e., when the mapping relationship between the virtual IP address needs to be switched away from the NFS server), the TCP connection in the NFS server and the mapping relationship between the virtual IP address and the actual IP address of the network card of the NFS server are deleted, so that when the NFS server is switched back again in a short time, the NFS client and the NFS server can quickly recreate a new TCP connection, and it is ensured that the NFS service provided by the NFS server is not interrupted.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is a network diagram of an NFS client connected to an NFS server through a virtual IP address;
fig. 2 is a block diagram of the NFS server in fig. 1;
fig. 3 is a flowchart illustrating steps of an address switching processing method according to an embodiment of the present disclosure;
fig. 4 is a schematic diagram illustrating a relationship between an NFS client request seqid value and an NFS server cache seqid value according to an embodiment of the present application;
fig. 5 is a schematic diagram illustrating that a conflict occurs between a seqid value cached by the NFS server and a seqid value requested by a client according to an embodiment of the present application;
fig. 6 is a second flowchart illustrating steps of an address switching processing method according to an embodiment of the present application;
fig. 7 is a functional block diagram of an address switch processing apparatus according to an embodiment of the present application;
fig. 8 is a block diagram of another functional structure of an address switch processing apparatus according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations.
Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
In the description of the present application, it is further noted that, unless expressly stated or limited otherwise, the terms "disposed," "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meaning of the above terms in the present application can be understood in a specific case by those of ordinary skill in the art.
The TCP connection is full duplex, three-way handshake is required in the TCP connection establishment process, four-way waving is required for the TCP connection closing, and in the TCP connection closing process, each direction is required to be closed, one side which performs closing first performs active closing, and the other side performs passive closing.
Referring to fig. 1 again, the actual IP address of NFS server a is 172.16.66.55, the actual IP address of NFS server B is 172.16.66.56, the IP address of NFS client 1 is 172.16.66.136, and the IP address of NFS client 2 is 172.16.66.137. Assuming that the NFS client 1 establishes communication with the NFS server a through the virtual IP address 172.16.66.35, the NFS server a provides the NFS service for the NFS client 1, and when the NFS server a cannot provide the NFS service, the virtual IP address is migrated from the NFS server a to the NFS server B, which is only a simple process for changing the mapping address of the virtual IP address from the actual IP address (172.16.66.55) of the network card on the NFS server a to the actual IP address (172.16.66.56) of the network card on the NFS server B. For NFS server a, since the TCP connection established between it and NFS client 1 is not normally closed by four hands waving, server a still maintains the TCP connection established with NFS client 1. For server B, it will establish a new TCP connection with NFS client 1, since it has not previously established a TCP connection with NFS client 1.
If the virtual IP address drifts from the NFS server a to the NFS server B within a short time (e.g., 30s) and switches back to the NFS server a, it is found that the NFS client 1 cannot normally establish the TCP connection with the NFS server a at this time, and the TCP connection cannot be normally established until a long time elapses.
For a TCP connection, four tuples are required to represent the same connection, namely: src _ ip (source ip address), src _ port (source port number), dst _ ip (destination ip address), dst _ port (destination port number). As described above, when the virtual IP address drifts from the NFS server a to the NFS server B, the NFS server a does not close the TCP connection established between the NFS server a and the NFS client 1 through the virtual IP address, and when the virtual IP address is switched back to the NFS server a in a short time, because the NFS server a has the TCP connection established between the NFS client 1 and the NFS client 1 last time through the virtual IP address, the NFS client 1 will attempt to communicate with the NFS server a through the TCP connection, because the NFS server is fixed to monitor the NFS server port (for example, 2049 port) and there is a virtual IP address, that is, the quadruplet of the TCP connection established between the NFS client and the server a is fixed and already present, the NFS client cannot establish a new TCP connection with the NFS server a, and finally the NFS client 1 can establish a valid TCP connection with the NFS server a again until the virtual IP address is switched back to the NFS server a (the waiting time is the time when the TCP connection with the NFS client 1 has timed out of failure) Then, normal NFS traffic is performed, and long TCP breaks are unacceptable for NFS services.
Based on this, the applicant provides the following solutions for solving the above technical problems.
Referring to fig. 2, fig. 2 is a block diagram of an NFS server according to an embodiment of the present disclosure. The NFS server includes an address switching processing device 11, a memory 10, a processor 20, and a communication unit 30.
The elements of the memory 10, the processor 20 and the communication unit 30 are electrically connected to each other directly or indirectly to realize data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines.
The Memory 10 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like. The memory 10 is used for storing a program, and the processor 20 executes the program after receiving an execution instruction. The communication unit 30 is configured to establish a communication connection between the NFS server and another device (such as an NFS client) through a network, and is configured to receive and send data through the network.
The address switching processing device 11 includes at least one software functional module which can be stored in the memory 10 in the form of software or firmware (firmware) or is fixed in an Operating System (OS) of the NFS server. The processor 20 is used for executing executable modules stored in the memory 10, such as software functional modules and computer programs included in the address switching processing device 11. In this embodiment, the address switching processing device 11 provides a service for clearing TCP connections for the NFS server, and a specific address switching processing clearing method will be described in detail later.
It should be understood that the configuration shown in fig. 2 is merely illustrative, and the NFS server may include more or fewer components than shown, or have a different configuration than shown in fig. 2. The components shown in fig. 2 may be implemented in hardware, software, or a combination thereof.
Referring to fig. 3, fig. 3 is a flowchart of an address switching processing method applied to the NFS server in fig. 1 and 2 according to an embodiment of the present disclosure. The various steps involved in the process are set forth in greater detail below.
Step S310, detecting a network communication state or an NFS process state of the NFS server, and detecting whether the network communication state is a preset communication state or the NFS process state is a preset process state.
Specifically, the detected communication state of the NFS server may be compared with a preset communication state or the NFS process state may be compared with a preset process state, and when it is detected that the network communication state is the preset communication state or the NFS process state is the preset process state, it is determined that the NFS server needs to be switched. The preset network communication state may be a network communication failure (e.g., downtime), and the preset process state may be a process state exception (e.g., a process exception exit). The preset network communication state and the preset process state may be configured in the NFS server in advance.
Optionally, in this embodiment, the detection may be implemented by software (for example, a bootlegged software) running on the NFS server, and when it is determined that the NFS server needs to be switched, the virtual IP address is migrated from the NFS server that needs to be switched to another NFS server.
Before switching the NFS server, if it is determined that the NFS server needs to be switched, step S320 is executed, otherwise, the process is ended.
Step S320, find out whether there is a target TCP connection whose IP address is a virtual IP address of the NFS client accessing the NFS server and whose port number is an NFS service port number.
An nfsd process for controlling NFS services in the NFS server operates in a kernel mode, and a TCP connection recorded in the NFS server needs to be deleted by the nfsd process. The nfsd process provides an interactive interface with the user state (i.e., the proc file system) and interacts with the user state through the/proc/fs/nfsd/directory.
The kernel mode and the user mode are two authority levels divided by the CPU, and the division can limit the access capability between different programs, prevent the different programs from acquiring the memory data of other programs or acquiring the data of peripheral equipment and sending the data to the network. Specifically, the CPU in the kernel mode may access all data, including peripheral devices (e.g., hard disks and network cards); the access to the memory in the user mode is controlled by the authority and cannot access the peripheral equipment, the capacity of occupying the CPU is deprived, and the CPU resource can be acquired by other programs.
In this embodiment, a file is created in advance in the/proc/fs/nfsd/directory, and when a virtual IP address is input into the file through the user-mode interactive interface, the kernel mode reads the virtual IP address. And traversing all TCP connections recorded in the NFS server, and searching whether a target TCP connection with the IP address as the virtual IP address and the port number as the NFS service port number exists.
If the target TCP connection is found, step S330 is performed, otherwise, the process is ended.
Step S330, delete the mapping relationship between the target TCP connection and the virtual IP address recorded in the NFS server and the actual IP address of the NFS server network card.
If the target TCP connection is found, deleting the target TCP connection recorded in the NFS server, in this embodiment, the target TCP connection may be deleted in a manner that the target TCP connection is marked as invalid, and the target TCP connection is released through Remote Procedure Call (RPC).
And after the deletion of the target TCP connection is finished, deleting the mapping relation between the virtual IP address and the actual IP address of the network card of the NFS server so as to realize the switching of the virtual IP address to other NFS servers, and providing NFS services for the NFS client by the other NFS servers.
When switching back to the NFS server (i.e., the virtual IP address is migrated back to the NFS server), the method provided in the embodiment of the present application further includes:
and creating TCP connection with the NFS client, establishing a mapping relation between the virtual IP address and the actual IP address of the network card of the NFS server, and providing NFS service for the NFS client by the NFS server.
Because the TCP connection in the NFS server is deleted when the virtual IP address drifts away, when the virtual IP address drifts back to the NFS server, the NFS server directly creates a new TCP connection and establishes a mapping relation between the virtual IP address and the actual IP address of the network card of the NFS server.
In the foregoing process, before performing the NFS server switching, when it is determined that the NFS server needs to be switched (that is, when the mapping relationship of the virtual IP address needs to drift away from the NFS server), the TCP connection in the NFS server and the mapping relationship between the virtual IP address and the actual IP address of the network card of the NFS server are deleted, so that when the NFS server is switched back again in a short time, the NFS client and the NFS server can quickly recreate a new TCP connection, and it is ensured that the NFS service provided by the NFS server is not interrupted.
When the version of the NFS protocol is higher (version 4 and above), in order to improve stability and security of the NFS service, the higher version of the NFS protocol introduces more new features relative to the lower version of the NFS protocol (for example, version 3), wherein the largest change is that the higher version of the NFS protocol includes state information of the NFS client. The state information of the higher version NFS protocol is described below.
For the higher version of the NFS protocol, taking the version of NFS of version 4 as an example, there is a structure NFS _ client associated with a state. In the NFS server, one NFS client corresponds to one NFS _ client structure, and the cl _ client is used for uniquely marking the structure. The NFS client needs to request a clientid value from the NFS server, and the NFS server allocates a unique clientid value to the NFS client.
Referring to fig. 4, the NFS protocol is designed to guarantee eos (exact one transactions) and to make each status request carry a sequence number and cache the response of such request. In the same type of request, the sequence number unit is increased every time the NFS client requests. Normally, the sequence number cached by the NFS server is smaller than the NFS client request sequence number by 1, if the NFS server cache sequence number is equal to the NFS client request sequence number, the NFS server considers a repeat request, the NFS server returns locally cached information to the NFS client, and otherwise, the NFS server considers an error request.
In addition to the rank value for each request, the NFS client also has a lot of state information, for example, opening a file generates corresponding state information about the file on the NFS server. As described above, in the NFS server, one NFS client corresponds to one NFS4_ client structure, the state information of the NFS client is stored in the NFS server, the NFS client can find the NFS4_ client structure in the corresponding NFS server through the clientid, and the NFS server can find all the state information about the NFS client through the NFS4_ client, including the sequence identifier (sequence identifier, seq id) value of the corresponding operation (op) of the NFS client.
Referring to fig. 5, when an NFS client establishes a TCP connection with an NFS server a for the first time through a virtual IP address to perform NFS-related services, an NFS4_ client structure related to the NFS client is created, and all state information of the NFS client is stored. Similarly, the virtual IP address will drift to the NFS server B, which will also create an NFS4_ client structure for the NFS client. As mentioned above, the seqid value of the corresponding NFS server cache is normally 1 or equal to the NFS client request sequence number, since the seqid value corresponding to the corresponding op in the connection between the NFS client and the NFS server B via the virtual IP address has been incremented by a large amount (for example, it has been incremented to the op seqid-50). When the virtual IP address is switched back to the NFS server a, because the state information about the NFS client is cached on the NFS server a, the NFS server matches the seqid value of the corresponding op in the local cache with the seqid value requested by the NFS client, and because the seqid value requested by the NFS client is increased in the process of establishing connection with the server B, the problem that the seqid value locally cached on the NFS server a is not matched with the seqid value requested by the NFS client occurs, which may cause interruption of the NFS service being performed by the NFS client.
Referring to fig. 6, in order to solve the problem that the seqid value locally cached on the NFS server is not matched with the seqid value requested by the NFS client in the higher version NFS protocol, the TCP connection method according to this embodiment further includes:
step S340, delete the state information of the NFS client.
And in the process of deleting all TCP (transmission control protocol) connections connected with the virtual IP address in the NFS server after the virtual IP address drifts, removing the state information of the NFS client cached in the NFS server, namely removing the NFS4_ client structure corresponding to the NFS client in the NFS server. Because the NFS service is multi-threaded, it needs to consider whether the NFS4_ client structure to be cleared is used by other threads, and when the NFS4_ client structure is used by other threads, the NFS4_ client structure cannot be deleted. Therefore, a flag bit is added in the nfs4_ client structure, and if the nfs4_ client structure is used by 0 threads, the flag bit is set to 0, which indicates that the nfs4_ client structure can be deleted; if the nfs4_ client structure is used by at least 1 thread, then position 1 is marked. To prevent the nfs4_ client structure from being reused, the nfs4_ client structure can only be deleted if the flag is at position 0.
In this embodiment, whether the NFS4_ client structure is used by other threads is determined by the flag, and when the NFS4_ client structure is not used by other threads, the NFS4_ client structure is deleted, so as to delete the state information of the NFS client in the NFS server.
When switching back to the NFS server again (i.e. the virtual IP address drifts back to the NFS server), because the TCP connection in the NFS server and the state information of the NFS client in the NFS server are deleted when the virtual IP address drifts away, when the virtual IP address drifts back to the NFS server, the NFS server can directly create a new TCP connection and establish a mapping relationship between the virtual IP address and the actual IP address of the NFS server network card.
In the above process, in the process of cleaning the TCP connection, the state information of the NFS client on the NFS server is cleaned, so that the technical problem of service interruption of the NFS client due to a conflict between the seqid value cached in the NFS server and the seqid value requested by the NFS client when the NFS server uses a higher version (version 4 and above) NFS protocol and switches back to the NFS server in a short time can be prevented.
Referring to fig. 7, the embodiment of the present application further provides an address switching processing apparatus 11, and the specific functions of the functional modules of the address switching processing apparatus 11 have been described in the above method steps, and now a brief description is made on the functional modules of the address switching processing apparatus 11.
The address switching processing device 11 includes:
the searching module 111 is configured to search, before performing NFS server switching, whether a target TCP connection exists where an IP address is a virtual IP address where an NFS client accesses the NFS server, and a port number is an NFS service port number.
In this embodiment, the search module 111 is specifically configured to:
sending the virtual IP address to a kernel mode through an interactive interface of a user mode;
and in the kernel mode, searching whether a target TCP connection with an IP address as the virtual IP address and a port number as an NFS service port number exists.
The TCP connection deleting module 112 is configured to delete the target TCP connection and the mapping relationship between the virtual IP address and the actual IP address of the NFS server network card recorded in the NFS server if the target TCP connection exists, so that the virtual IP address is switched to another NFS server, and the other NFS server provides the NFS service for the NFS client.
The TCP connection deleting module 112 is specifically configured to:
and completing the deletion of the target TCP connection by releasing the target TCP connection.
Referring to fig. 8, in this embodiment, the apparatus may further include: a status information deleting module 113 configured to delete the status information of the NFS client;
the state information deleting module 113 is specifically configured to:
detecting whether a structural body used for storing state information of an NFS client in an NFS server is used or not;
if not, the structure is deleted.
Referring again to fig. 8, the apparatus may further include a detection module 114 and a creation module 115.
A detecting module 114, configured to detect a network communication state or an NFS process state of the NFS server, and when it is detected that the network communication state is a preset communication state or the NFS process state is a preset process state, the searching module 111 performs a search for whether a target TCP connection whose IP address is a virtual IP address where the NFS client accesses the NFS server and whose port number is an NFS service port number exists.
Upon re-switching back to the NFS server, the creation module 115 is configured to:
and creating TCP connection with the NFS client, establishing a mapping relation between the virtual IP address and the actual IP address of the network card of the NFS server, and providing NFS service for the NFS client by the NFS server.
If the above functions are implemented in the form of software functional modules and sold or used as a separate product, they may be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the present application, or portions thereof, which substantially or substantially contribute to the prior art, may be embodied in the form of a software product stored in a storage medium and including instructions for causing a corresponding apparatus to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
To sum up, the embodiments of the present application provide an address switching processing method and apparatus, where before switching an NFS server, whether an IP address exists as a virtual IP address where an NFS client accesses the NFS server is searched, and a port number is a target TCP connection of an NFS service port number; and deleting the target TCP connection recorded in the NFS server and the mapping relation between the virtual IP address and the actual IP address of the network card of the NFS server, so that the virtual IP address is switched to other NFS servers, and the other NFS servers provide NFS services for the NFS client. Through the above process, when the NFS server needs to be switched (i.e. when the mapping relationship of the virtual IP address needs to be switched away from the NFS server), the TCP connection in the NFS server can be deleted, so that when the NFS server is switched back to the NFS client in a short time, the NFS client and the NFS server can quickly recreate a new TCP connection, and the NFS service provided by the NFS server is ensured not to be interrupted.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (8)

1. An address switching processing method is applied to a Network File System (NFS) server, and comprises the following steps:
before switching the NFS server, searching whether a virtual IP address with an IP address of the NFS client accessing the NFS server exists or not, wherein a port number is a target TCP connection of an NFS service port number;
if the target TCP connection exists, deleting the target TCP connection recorded in the NFS server and the mapping relation between the virtual IP address and the actual IP address of the NFS server network card so as to switch the virtual IP address to other NFS servers, and providing NFS service for the NFS client by the other NFS servers;
wherein the method further comprises: a step of deleting the state information of the NFS client, the step including:
detecting whether a structural body used for storing state information of an NFS client in the NFS server is used or not;
if not, the structure is deleted.
2. The method of claim 1, wherein prior to the NFS server handoff, the method further comprises:
and detecting the network communication state or the NFS process state of the NFS server, and when detecting that the network communication state is the preset communication state or the NFS process state is the preset process state, executing a step of searching whether a target TCP connection with an IP address of the NFS client accessing the NFS server exists or not, wherein the port number is the NFS service port number.
3. The method of claim 1, wherein the finding whether a target TCP connection exists with an IP address that is a virtual IP address for an NFS client to access the NFS server and a port number that is an NFS service port number comprises:
sending the virtual IP address to a kernel mode through an interactive interface of a user mode;
and in the kernel mode, searching whether a target TCP connection with an IP address as the virtual IP address and a port number as an NFS service port number exists.
4. The method of claim 1, wherein upon re-switching back to the NFS server, the method further comprises:
and creating TCP connection with the NFS client, establishing a mapping relation between the virtual IP address and an actual IP address of the NFS server network card, and providing NFS service for the NFS client by the NFS server.
5. An address switching processing device, applied to a Network File System (NFS) server, the device comprising:
a searching module, configured to search, before performing the NFS server switching, whether a target TCP connection exists where an IP address is a virtual IP address where an NFS client accesses the NFS server, and a port number is an NFS service port number;
a TCP connection deleting module, configured to delete the target TCP connection and the mapping relationship between the virtual IP address and the actual IP address of the NFS server network card recorded in the NFS server if the target TCP connection exists, so that the virtual IP address is switched to another NFS server, and the other NFS server provides an NFS service for the NFS client;
the device further includes a state information deleting module configured to delete the state information of the NFS client, where the state information deleting module is specifically configured to:
detecting whether a structural body used for storing state information of an NFS client in the NFS server is used or not;
if not, the structure is deleted.
6. The apparatus of claim 5, wherein the apparatus further comprises:
and the detection module is used for detecting the network communication state or the NFS process state of the NFS server, and when the network communication state or the NFS process state is detected to be the preset communication state or the preset process state, the search module performs search to determine whether the virtual IP address with the IP address of the NFS client accessing the NFS server exists, and the port number of the target TCP connection is the NFS service port number.
7. The apparatus of claim 5, wherein the lookup module is specifically configured to:
sending the virtual IP address to a kernel mode through an interactive interface of a user mode;
and in the kernel mode, searching whether a target TCP connection with an IP address as the virtual IP address and a port number as an NFS service port number exists.
8. The apparatus of claim 7, further comprising a creation module, upon re-switching back to the NFS server, to:
and creating TCP connection with the NFS client, establishing a mapping relation between the virtual IP address and an actual IP address of the NFS server network card, and providing NFS service for the NFS client by the NFS server.
CN201811067913.XA 2018-09-13 2018-09-13 Address switching processing method and device Active CN108900647B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811067913.XA CN108900647B (en) 2018-09-13 2018-09-13 Address switching processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811067913.XA CN108900647B (en) 2018-09-13 2018-09-13 Address switching processing method and device

Publications (2)

Publication Number Publication Date
CN108900647A CN108900647A (en) 2018-11-27
CN108900647B true CN108900647B (en) 2021-07-06

Family

ID=64359929

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811067913.XA Active CN108900647B (en) 2018-09-13 2018-09-13 Address switching processing method and device

Country Status (1)

Country Link
CN (1) CN108900647B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116112500B (en) * 2023-02-08 2023-08-15 北京志凌海纳科技有限公司 NFS high availability system and method based on fault detection and routing strategy
CN116708283B (en) * 2023-08-08 2023-10-31 珠海派诺科技股份有限公司 Automatic network switching method and switching system

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102082733A (en) * 2011-02-25 2011-06-01 杭州华三通信技术有限公司 Portal system and access method thereof
CN105554150A (en) * 2015-12-29 2016-05-04 北京捷思锐科技股份有限公司 Network logging-in method and apparatus
US9391865B1 (en) * 2013-09-20 2016-07-12 Veritas Technologies Llc Systems and methods for facilitating fault-tolerant backup jobs
CN106982259A (en) * 2017-04-19 2017-07-25 聚好看科技股份有限公司 The failure solution of server cluster
CN107426021A (en) * 2017-07-19 2017-12-01 北京锐安科技有限公司 Construction method, device and the redundant system of redundant system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107454632B (en) * 2016-05-30 2020-04-24 中国移动通信有限公司研究院 Service processing method, base station and terminal in switching process

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102082733A (en) * 2011-02-25 2011-06-01 杭州华三通信技术有限公司 Portal system and access method thereof
US9391865B1 (en) * 2013-09-20 2016-07-12 Veritas Technologies Llc Systems and methods for facilitating fault-tolerant backup jobs
CN105554150A (en) * 2015-12-29 2016-05-04 北京捷思锐科技股份有限公司 Network logging-in method and apparatus
CN106982259A (en) * 2017-04-19 2017-07-25 聚好看科技股份有限公司 The failure solution of server cluster
CN107426021A (en) * 2017-07-19 2017-12-01 北京锐安科技有限公司 Construction method, device and the redundant system of redundant system

Also Published As

Publication number Publication date
CN108900647A (en) 2018-11-27

Similar Documents

Publication Publication Date Title
CN114341792B (en) Data partition switching between storage clusters
US11212374B2 (en) Managing network sockets
US11275599B1 (en) Hypervisor remote offload for VM data migration between storage devices
US9535759B2 (en) Work queue thread balancing
US11729218B2 (en) Implementing a service mesh in the hypervisor
US10365956B2 (en) Risk-appropriate validation for live operating system migration
US10860375B1 (en) Singleton coordination in an actor-based system
US11194682B2 (en) Connectivity-aware witness for active-active storage
CN108900647B (en) Address switching processing method and device
JP7064181B2 (en) Preventing long-term transaction execution from holding record locks
JP2018516001A (en) Communication apparatus, system, method, and program
US9575658B2 (en) Collaborative release of a virtual disk
US10530870B2 (en) Direct volume migration in a storage area network
US9201809B2 (en) Accidental shared volume erasure prevention
CN116760850B (en) Data processing method, device, equipment, medium and system
US20240241756A1 (en) Restart processing of an application manager component of a device
US20240256496A1 (en) Management of network file copy operations to a new data store
US11907161B2 (en) Upgrading the file system of objects in a distributed storage system
US20220365713A1 (en) Cross-stream transactions in a streaming data storage system
US20230028675A1 (en) Migration of network file copy operations between host computing devices
US9524190B1 (en) Systems and methods for caching data on virtualization servers
US11106645B1 (en) Multi point in time object store

Legal Events

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