CN107769996B - Method and device for detecting working state of server - Google Patents
Method and device for detecting working state of server Download PDFInfo
- Publication number
- CN107769996B CN107769996B CN201710999728.3A CN201710999728A CN107769996B CN 107769996 B CN107769996 B CN 107769996B CN 201710999728 A CN201710999728 A CN 201710999728A CN 107769996 B CN107769996 B CN 107769996B
- Authority
- CN
- China
- Prior art keywords
- nfs
- server
- state
- proxy host
- working state
- 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
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0805—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
- H04L43/0817—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking functioning
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/04—Network management architectures or arrangements
- H04L41/046—Network management architectures or arrangements comprising network management agents or mobile agents therefor
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/30—Decision processes by autonomous network management units using voting and bidding
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/08—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
- H04L43/0805—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
- H04L43/0811—Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability by checking connectivity
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L43/00—Arrangements for monitoring or testing data switching networks
- H04L43/12—Network monitoring probes
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/1097—Protocols 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]
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Environmental & Geological Engineering (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The application provides a method and a device for detecting the working state of a server, the method is applied to a proxy host of a Network File System (NFS), the NFS is provided with the server and a plurality of hosts, and the proxy host is selected for the plurality of hosts of the NFS based on a preset election principle, and the method comprises the following steps: executing a specified operation under a service directory of a service side of the NFS; the specified operation comprises any one of a write operation, a read operation and a modification operation; determining the working state of the NFS server according to the execution result after the designated operation is executed; setting the operation authority of the created local directory based on the determined working state of the NFS server; wherein the operation authority is used for controlling the operation of other hosts except the proxy host on the local directory. The method and the device are used for solving the problem that the detection performance of the host is reduced when multiple hosts access the server side simultaneously in the prior art.
Description
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method and an apparatus for detecting a working state of a server.
Background
A Network File System (NFS) generally includes a server and a plurality of hosts, each host accesses a resource stored in the server through a Transmission Control Protocol/Internet Protocol (TCP/IP) Network, and specifically, the host mounts an output directory of the server in a local directory so as to access the resource in the server based on the output directory.
At present, a conventional method for detecting whether a server can normally access is generally as follows: and the host writes the file into the server based on the output directory, if the file is successfully written, the server is considered to be normally accessible, otherwise, the server is considered to be incapable of normally accessing. However, when the method is used to detect the server, each host continuously writes files into the server, and when there are many hosts communicating with the server, the server cannot respond to each host in time due to the limitation of the processing capability of the server itself, so that the detection performance of the host is reduced, and the operation of the application in the host that needs to access the server is also affected.
Disclosure of Invention
In view of this, an object of the present application is to provide a method and an apparatus for detecting a working state of a server, which are used to solve the problem of reduced host detection performance caused when multiple hosts access the server simultaneously in the prior art.
In a first aspect, an embodiment of the present application provides a method for detecting a working state of a server, where the method is applied to a proxy host of a network file system NFS, where the NFS is provided with the server and multiple hosts, and the proxy host is selected for the multiple hosts of the NFS based on a preset election principle, and the method includes:
executing a specified operation under a service directory of a service side of the NFS; the specified operation comprises any one of a write operation, a read operation and a modification operation;
determining the working state of the NFS server according to the execution result after the designated operation is executed;
setting the operation authority of the created local directory based on the determined working state of the NFS server; wherein the operation authority is used for controlling the operation of other hosts except the proxy host on the local directory.
Optionally, the setting the operation authority of the created local directory based on the determined working state of the server of the NFS includes:
when the working state of the NFS server is abnormal, setting the operation authority of the local directory to be forbidden;
and when the working state of the NFS server is a normal state, setting the operation authority of the local directory to be allowed to operate.
In a second aspect, an embodiment of the present application provides a method for detecting a working state of a server, where the method is applied to other hosts except a proxy host in a network file system NFS, where the NFS is provided with the server and multiple hosts, and the proxy host is selected for the multiple hosts of the NFS based on a preset election principle, and the method includes:
executing a specified operation under a local directory of the proxy; the specified operation comprises any one of a write operation, a read operation and a modification operation;
and determining the working state of the NFS server according to the execution result after the specified operation is executed.
Optionally, the determining, according to an execution result after the specified operation is executed, a working state of the server of the NFS includes:
if the execution result is successful, determining that the working state of the NFS server is a normal state;
if the execution result is operation failure, detecting the network connection state between the home terminal and the proxy host; and after the network connection state between the local terminal and the proxy host is determined to be normal, determining that the working state of the service terminal of the NFS is an abnormal state.
Optionally, after detecting the network connection state between the home terminal and the proxy, the method further includes:
after determining that the network connection state between the home terminal and the proxy host is abnormal, detecting the network connection state between the home terminal and other hosts except the proxy host;
and if the network connection state between the local terminal and other hosts except the proxy host is normal, determining that the working state of the proxy host is an abnormal state.
In a third aspect, an embodiment of the present application provides a device for detecting a working state of a server, where the device is applied to a proxy host of a network file system NFS, where the NFS is provided with the server and multiple hosts, and the proxy host is selected for the multiple hosts of the NFS based on a preset election principle, and the device includes:
an operation execution module, configured to execute a specified operation in a service directory of the NFS server; the specified operation comprises any one of a write operation, a read operation and a modification operation;
a state determining module, configured to determine a working state of the NFS server according to an execution result obtained after the operation executing module executes the specified operation;
the setting module is used for setting the operation authority of the created local directory based on the work state of the NFS server determined by the state determining module; wherein the operation authority is used for controlling the operation of other hosts except the proxy host on the local directory.
Optionally, the setting module is specifically configured to:
when the working state of the NFS server determined by the state determining module is an abnormal state, setting the operation authority of the local directory to be prohibited;
and when the working state of the NFS server determined by the state determining module is a normal state, setting the operation authority of the local directory to be allowed to operate.
In a fourth aspect, an embodiment of the present application provides a device for detecting a working state of a server, where the device is applied to other hosts except a proxy host in a network file system NFS, where the NFS is provided with the server and multiple hosts, and the proxy host is selected for the multiple hosts of the NFS based on a preset election principle, and the device includes:
the operation execution module is used for executing specified operation under the local directory of the proxy host; the specified operation comprises any one of a write operation, a read operation and a modification operation;
and the state determining module is used for determining the working state of the NFS server according to the execution result of the operation executing module after the specified operation is executed.
Optionally, the state determination module is specifically configured to:
if the execution result of the operation execution module is successful, determining that the working state of the NFS server is a normal state;
if the execution result of the operation execution module is operation failure, detecting the network connection state between the home terminal and the proxy host; and after the network connection state between the local terminal and the proxy host is determined to be normal, determining that the working state of the service terminal of the NFS is an abnormal state.
Optionally, the state determination module is further configured to:
after determining that the network connection state between the home terminal and the proxy host is abnormal, detecting the network connection state between the home terminal and other hosts except the proxy host;
and if the network connection state between the local terminal and other hosts except the proxy host is normal, determining that the working state of the proxy host is an abnormal state.
The server detection method and device provided by the embodiment of the application implement the specified operation in the service directory of the server of the NFS through the proxy host, so as to implement the detection of the working state of the server, and further, the proxy host sets the operation authority of the created local directory, so that other hosts except the proxy host determine the working state of the server of the NFS through the specified operation executed in the local directory of the proxy host. The method and the device have the advantages that the working state of the server is detected through the elected proxy, the response speed of the NFS server is improved, and the detection efficiency of the proxy is correspondingly improved.
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
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 schematic structural diagram of a network file system according to an embodiment of the present application;
fig. 2 is a schematic flowchart illustrating a method for detecting a working state of a server according to an embodiment of the present application;
fig. 3 is a schematic flowchart of a method for detecting a working state of a server according to another embodiment of the present application;
fig. 4 is a schematic structural diagram of a server working state detection apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a server-side working state detection apparatus according to yet another embodiment of the present application;
fig. 6 is a schematic structural diagram of a computer device 600 according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a computing device 700 according to yet another 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 only a part of the embodiments of the present application, and not all the 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 of the present application without making any creative effort, shall fall within the protection scope of the present application.
As shown in fig. 1, a Network File System (NFS) according to an embodiment of the present invention is provided with a server 11 and a plurality of hosts 12, where each host 12 can access a resource in the server 11, the server 11 can provide one service directory or a plurality of service directories, and each host 12 can access a resource in one service directory of the server 11 or a plurality of service directories of the server 11, which may be determined according to actual conditions. When the server 11 provides a plurality of service directories, the resources stored in each service directory are different; the server 11 may be a server and the host 12 may be a computing device.
An embodiment of the present application provides a method for detecting a working state of a server, where as shown in fig. 2, the method is applied to a proxy host of a network file system NFS, where the NFS is provided with the server and a plurality of hosts, and the proxy host is selected for the plurality of hosts of the NFS based on a preset election principle. The method comprises the following steps:
s201, executing specified operation under the service directory of the NFS server; the specified operation comprises any one of a write operation, a read operation and a modification operation;
specifically, a server of the NFS may provide one service directory, or may provide multiple service directories, and if the server provides multiple service directories, different service directories store different resources; if the proxy host only accesses one output directory of the NFS server, the service directory is mounted in a local directory created by the proxy host to realize the access to the server resources; if the proxy host needs to access a plurality of service directories of the server of the NFS, the service directories of the server are respectively mounted in different local directories created by the proxy host, so that the access to the server resources is realized.
For example, when the server provides a service directory, the IP address of the server is 1.1.1.1, and the service directory output by the server is: 1.1.1.1: the local directory provided by the proxy host is/nfs, and the proxy host can mount the service directory by the following mounting commands: mount-t nfs 1.1.1.1:/nfsdisk/nfs; if the server of the NFS provides multiple service directories, the proxy creates more than two local directories correspondingly, and mounts each service directory in each local directory correspondingly, in the same manner as the above example, and the description is omitted.
The specified operation may be any one of write, read, modify, etc. operations provided by a service directory of a server of the NFS, as the case may be, in actual applications.
For example, in practical applications, the proxy may write a file into a service directory of a server of the NFS at a predetermined interval, and if the file can be successfully written into the service directory, the execution result is successful; if the file cannot be successfully written into the service directory, the execution result is an operation failure. The process of the proxy host performing the modify operation or the read operation is the same as the write operation, and is not described one by one. After the execution result is that the operation is successful, the proxy host can delete the file, so that the memory of the NFS server is prevented from being occupied; the file can be a file with any format and any name, for example, the file can be a file named by writing time; the predetermined time period may be 5 seconds, 1 minute, 5 minutes, etc.
S202, determining the working state of the NFS server according to the execution result after the designated operation is executed;
specifically, the execution result includes operation success and operation failure; the working state of the NFS service end comprises a normal state and an abnormal normal state; when the execution result is that the operation is successful, the working state of the NFS server is a normal state; and when the execution result is operation failure, the working state of the service end of the NFS is an abnormal state.
S203, setting the operation authority of the created local directory based on the determined working state of the NFS server; wherein the operation authority is used for controlling the operation of other hosts except the proxy host on the local directory.
Specifically, the proxy host may create a local directory according to a set creation principle, for example, a name of a service directory corresponding to a service end of the NFS is created to prevent the created local directory from being duplicated with existing directories in the proxy host, where if the service end of the NFS outputs a plurality of service directories, the proxy host creates a corresponding local directory corresponding to each service directory; the operation authority of the local directory may be implemented by setting whether the NFS service function of the local directory is available, the NFS service may provide access to a host other than the proxy host, and the NFS service function of setting the local directory is described in detail in the prior art, and will not be described herein too much.
In practical application, the local directory of the proxy host can be mounted in the local directories of other hosts, so that the other hosts can access the local directory of the proxy host. For example, if the proxy provides a local directory, the local directory of the proxy is: 1.1.0.1: the local/nfaway server, the local directory created by other host at the local end is/nfaway, and through the mount command: mount-t nfs 1.1.0.1: the/local/nfser/nftest will proxy host's local directory 1.1.0.1: mounting the/local/nfaway server into a local directory/nfaway created by each host; if the proxy provides a plurality of local directories, the local directories of the proxy are respectively: 1.1.0.1: percal/nfser 1, 1.1.0.1: the local/nfaway server2, the local directories created by other hosts at the local end are/nfaway test1 and/nfaway test2 respectively, and through the mount command: mount-t nfs 1.1.0.1: the/local/nfaway server 1/nfaway 1 maps the proxy's local directory 1.1.0.1: the/local/nfaway server1 is mounted into the local directory/nfaway 1 created by each host, with the mount command: mount-t nfs 1.1.0.1: the/local/nfaway server 2/nfaway 2 maps the proxy's local directory 1.1.0.1: the/local/nfaway server2 is mounted into a local directory/nfaway 2 created by each host.
Optionally, when step S203 is executed, the setting an operation authority of the created local directory based on the determined working state of the server of the NFS includes:
when the working state of the NFS server is abnormal, setting the operation authority of the local directory to be forbidden;
and when the working state of the NFS server is a normal state, setting the operation authority of the local directory to be allowed to operate.
In practical application, if the working state of the server of the NFS is a normal state, the service directory of the server is considered to be normally accessible, and at this time, the operation authority of the local directory of the proxy host is set to allow operation, that is, the NFS service function of the local directory of the proxy host is set to allow use, so that the operation result of other hosts after executing the specified operation in the local directory is an operation success, so that the other hosts determine that the working state of the server of the NFS is a normal state; if the working state of the server of the NFS is an abnormal state, it is considered that the service directory of the server cannot be normally accessed, and the server may be abnormal, at this time, the operation authority of the local directory of the proxy host is set to be prohibited, that is, the NFS service function of the local directory of the proxy host is set to be prohibited to be used, so that the operation result of other hosts after performing the specified operation in the local directory is an operation failure, so that the other hosts determine that the working state of the server of the NFS is an abnormal state, and the other hosts are prevented from continuously accessing the service directory of the server of the NFS.
Wherein, the election principle comprises any one of the following principles: network protocol (InternetProtocolIP) address is shortest, host name is shortest, host domain name is shortest, etc., and in practical application, it may be determined according to practical situation.
The method for detecting the working state of the server side provided by the embodiment of the application executes the designated operation in the service directory of the server side of the NFS through the proxy host, so as to realize the detection of the working state of the server side, and further, the proxy host determines the working state of the server side of the NFS through the execution of the designated operation in the local directory of the proxy host by setting the operation authority of the created local directory, so that the response speed of the server side of the NFS is improved, and the detection efficiency of the proxy host is correspondingly improved.
Another embodiment of the present application provides a method for detecting a working state of a server, where as shown in fig. 2, the method is applied to other hosts except a proxy host in a network file system NFS, where the NFS is provided with the server and a plurality of hosts, and the proxy host is selected for the plurality of hosts of the NFS based on a preset election principle, and the method includes the following steps:
s301, executing specified operation under the local directory of the proxy host; the specified operation comprises any one of a write operation, a read operation and a modification operation;
s302, determining the working state of the NFS server according to the execution result after the designated operation is executed.
Specifically, the designated operation is any one of write, read, modify, and the like that can be provided for the local directory of the proxy, as the case may be, in actual application
In practical application, other hosts except the proxy host can create a local directory corresponding to a service directory provided by a server, if the server provides one service directory, one local directory is created, and if the server provides a plurality of service directories, a plurality of local directories are correspondingly created; when the local directory is created, the local directory can be created according to a set creation principle, for example, the local directory of the corresponding proxy host is created to prevent the created local directory from being repeated with the existing directory in the host; when a server side of the NFS provides a plurality of service directories, a proxy host correspondingly creates a local directory corresponding to each service directory respectively, and other hosts correspondingly create corresponding local directories in the host corresponding to each local directory of the proxy host; and the other proxy hosts mount the local directory of the proxy host in the created local directory, so that the local directory of the proxy host can be accessed by other hosts except the proxy host.
For example, if the proxy provides a local directory, the local directory of the proxy is: 1.1.0.1: the local/nfaway server, the local directory created locally by other hosts is/nfaway, and through the mount command: mount-t nfs 1.1.0.1: the/local/nfser/nftest will proxy host's local directory 1.1.0.1: mounting the/local/nfaway server into a local directory/nfaway created by each host; if the proxy provides a plurality of local directories, the local directories of the proxy are respectively: 1.1.0.1: percal/nfser 1, 1.1.0.1: the local/nfaway server2, the local directories created by other hosts in each host are/nfaway test1,/nfaway test2, respectively, and through mount commands: mount-t nfs 1.1.0.1: the/local/nfaway server 1/nfaway 1 maps the proxy's local directory 1.1.0.1: the/local/nfaway server1 is mounted into the local directory/nfaway 1 created by each host, with the mount command: mount-t nfs 1.1.0.1: the/local/nfaway server 2/nfaway 2 maps the proxy's local directory 1.1.0.1: the/local/nfaway server2 is mounted into a local directory/nfaway 2 created by each host.
For each host except the proxy host, the host can write files into the local directory of the proxy host at intervals of a preset time, and if the files can be successfully written into the local directory of the proxy host, the execution result is successful; if the file cannot be successfully written into the local directory of the proxy, the execution result is operation failure. The host performs the modification operation or the read operation in the same way as the write operation, and the description thereof is omitted. After the host determines that the execution result is successful, the file can be deleted, so that the storage space in the proxy host is prevented from being occupied; the file can be a file with any format and any name, such as a file named by the write time; the predetermined time period may be 5 seconds, 1 minute, 5 minutes, etc.
Optionally, when step S302 is executed, the determining, according to the execution result after the specified operation is executed, the working state of the NFS server includes:
if the execution result is successful, determining that the working state of the NFS server is a normal state;
if the execution result is operation failure, detecting the network connection state between the home terminal and the proxy host; and after the network connection state between the local terminal and the proxy host is determined to be normal, determining that the working state of the service terminal of the NFS is an abnormal state.
Specifically, the network connection state between the home terminal and the proxy may be detected through an Internet Packet explorer (Packet Internet Groper, PING), or may be detected through a tcping tool, which is not limited in this application.
In practical application, after determining that the execution result is successful, other hosts except the proxy host consider that the home terminal can normally access the local directory of the proxy host, and further determine that the working state of the service terminal of the NFS is a normal state; if the execution result is operation failure, which may be caused by an abnormal service end of the NFS, or an abnormal proxy host, at this time, it may be detected through a ping command whether the network connection between the home end and the proxy host is normal, and if the network connection between the home end and the proxy host is normal, it indicates that the proxy host is not abnormal, and it is determined that the working state of the service end of the NFS is an abnormal state, that is, the service end of the NFS is abnormal.
Optionally, after detecting the network connection state between the home terminal and the proxy, the method further includes:
after determining that the network connection state between the home terminal and the proxy host is abnormal, detecting the network connection state between the home terminal and other hosts except the proxy host;
and if the network connection state between the local terminal and other hosts except the proxy host is normal, determining that the working state of the proxy host is an abnormal state.
In practical application, if the network between the local terminal and the proxy host is abnormal, the local terminal may be abnormal, or the proxy host may be abnormal, at this time, it may be detected through a ping command whether the network connection state between the local terminal and any other host except the proxy host is normal; if the network connection state between the local terminal and any other host except the proxy host is normal, the local terminal is considered not to be abnormal, and the proxy host is considered to be abnormal, namely, the working state of the proxy host is an abnormal state. Furthermore, a new agent host can be elected from other hosts except the agent host based on a preset election principle so as to ensure that the detection of the working state of the server can be continuously carried out and further improve the detection efficiency.
An embodiment of the present application provides a device for detecting a working state of a server, as shown in fig. 4, the device is applied to a proxy host of a network file system NFS, where the NFS is provided with the server and a plurality of hosts, and the proxy host is selected for the plurality of hosts of the NFS based on a preset election principle, and the device includes:
an operation execution module, configured to execute a specified operation in a service directory of the NFS server; the specified operation comprises any one of a write operation, a read operation and a modification operation;
a state determining module, configured to determine a working state of the NFS server according to an execution result obtained after the operation executing module executes the specified operation;
the setting module is used for setting the operation authority of the created local directory based on the work state of the NFS server determined by the state determining module; wherein the operation authority is used for controlling the operation of other hosts except the proxy host on the local directory.
Optionally, the setting module is specifically configured to:
when the working state of the NFS server determined by the state determining module is an abnormal state, setting the operation authority of the local directory to be prohibited;
and when the working state of the NFS server determined by the state determining module is a normal state, setting the operation authority of the local directory to be allowed to operate.
Another embodiment of the present application provides a device for detecting a working state of a server, as shown in fig. 5, where the device is applied to other hosts except a proxy host in a network file system NFS, where the NFS is provided with the server and a plurality of hosts, and the proxy host is selected for the plurality of hosts of the NFS based on a preset election principle, and the device includes:
the operation execution module is used for executing specified operation under the local directory of the proxy host; the specified operation comprises any one of a write operation, a read operation and a modification operation;
and the state determining module is used for determining the working state of the NFS server according to the execution result of the operation executing module after the specified operation is executed.
Optionally, the state determination module is specifically configured to:
if the execution result of the operation execution module is successful, determining that the working state of the NFS server is a normal state;
if the execution result of the operation execution module is operation failure, detecting the network connection state between the home terminal and the proxy host; and after the network connection state between the local terminal and the proxy host is determined to be normal, determining that the working state of the service terminal of the NFS is an abnormal state.
Optionally, the state determination module is further configured to:
after determining that the network connection state between the home terminal and the proxy host is abnormal, detecting the network connection state between the home terminal and other hosts except the proxy host;
and if the network connection state between the local terminal and other hosts except the proxy host is normal, determining that the working state of the proxy host is an abnormal state.
As shown in fig. 6, an embodiment of the present application provides a computer device 600, configured to execute the method for detecting the working status of the server in the proxy host applied to NFS in fig. 1, where the device includes a memory 601, a processor 602, and a computer program stored in the memory 601 and executable on the processor 602, where the processor 602 implements the steps of the method for detecting the working status of the server when executing the computer program.
Specifically, the memory 601 and the processor 602 can be general memories and general processors, which are not specifically limited herein, and when the processor 602 runs a computer program stored in the memory 601, the method for detecting the working state of the server can be executed, so as to solve the problem of reduced performance of host detection caused when multiple hosts access the server at the same time, the proxy host executes a specified operation in a service directory of the server of the NFS to detect the working state of the server, and further, the proxy host determines the working state of the server of the NFS by setting an operation authority of the created local directory, so that other hosts except the proxy host execute the specified operation in the local directory of the proxy host to determine the working state of the server of the NFS, thereby improving the response speed of the server of the NFS and correspondingly improving the detection efficiency of the proxy host.
Corresponding to the method for detecting the working state of the server in fig. 1, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method for detecting the working state of the server are performed.
Specifically, the storage medium can be a general storage medium, such as a removable disk, a hard disk, and the like, and when a computer program on the storage medium is executed, the method for detecting the working state of the server can be executed, so that the problem of reduced host detection performance caused when multiple hosts access the server simultaneously is solved.
As shown in fig. 7, another embodiment of the present application provides a computer device 700 for executing the method for detecting the working status of the server in fig. 2 applied to other hosts except the proxy host, the device including a memory 701, a processor 702, and a computer program stored in the memory 701 and executable on the processor 702, wherein the processor 702 implements the steps of the method for detecting the working status of the server when executing the computer program.
Specifically, the memory 701 and the processor 702 can be general memories and general processors, which are not specifically limited herein, and when the processor 702 runs a computer program stored in the memory 701, the method for detecting the working state of the server can be executed, so as to solve the problem of reduced host detection performance caused when multiple hosts access the server at the same time.
Corresponding to the method for detecting the working state of the server in fig. 2, an embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method for detecting the working state of the server are performed.
Specifically, the storage medium can be a general storage medium, such as a removable disk, a hard disk, and the like, and when a computer program on the storage medium is executed, the method for detecting the working state of the server can be executed, so that the problem of reduced host detection performance caused when multiple hosts access the server simultaneously is solved.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments provided in the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that 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 computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to 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.
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, and moreover, the terms "first", "second", "third", etc. are used merely to distinguish one description from another and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present application, and are used for illustrating the technical solutions of the present application, but not limiting the same, and the scope of the present application is not limited thereto, and although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope disclosed in the present application; such modifications, changes or substitutions do not depart from the spirit and scope of the present disclosure, which should be construed in light of the above teachings. Are intended to 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. A method for detecting the working state of a server is characterized in that the method is applied to a proxy host of a Network File System (NFS), the NFS is provided with the server and a plurality of hosts, and the proxy host is elected by the plurality of hosts of the NFS based on a preset election principle, and the method comprises the following steps:
executing a specified operation under a service directory of a service side of the NFS; the specified operation comprises any one of a write operation, a read operation and a modification operation;
determining the working state of the NFS server according to the execution result after the designated operation is executed;
setting the operation authority of the created local directory based on the determined working state of the NFS server; the operation authority is used for controlling the operation of other hosts except the proxy host on the local directory;
wherein the setting of the operation authority of the created local directory based on the determined working state of the server of the NFS includes:
when the working state of the NFS server is abnormal, setting the operation authority of the local directory to be forbidden;
and when the working state of the NFS server is a normal state, setting the operation authority of the local directory to be allowed to operate.
2. A method for detecting the working state of a server is characterized in that the method is applied to other hosts except a proxy host in a Network File System (NFS), the NFS is provided with the server and a plurality of hosts, and the proxy host is selected for the plurality of hosts of the NFS based on a preset election principle, and the method comprises the following steps:
executing a specified operation under a local directory of the proxy; the specified operation includes any one of a write operation, a read operation, and a modify operation, where the local directory is a local directory in the proxy host, where an operation authority is set by the proxy host according to a determined working state of the server of the NFS, the operation authority is used to control operations on the local directory by other hosts except the proxy host, and the working state of the server of the NFS is determined by an execution result after the proxy host executes the specified operation in the service directory of the server of the NFS and executes the specified operation;
and determining the working state of the NFS server according to the execution result after the specified operation is executed.
3. The method according to claim 2, wherein the determining the working state of the NFS server according to the execution result after the specified operation is executed comprises:
if the execution result is successful, determining that the working state of the NFS server is a normal state;
if the execution result is operation failure, detecting the network connection state between the home terminal and the proxy host; and after the network connection state between the local terminal and the proxy host is determined to be normal, determining that the working state of the service terminal of the NFS is an abnormal state.
4. The method of claim 3, wherein after detecting the network connection status between the home terminal and the proxy, further comprising:
after determining that the network connection state between the home terminal and the proxy host is abnormal, detecting the network connection state between the home terminal and other hosts except the proxy host;
and if the network connection state between the local terminal and other hosts except the proxy host is normal, determining that the working state of the proxy host is an abnormal state.
5. A device for detecting the working state of a server is applied to a proxy host of a Network File System (NFS), wherein the NFS is provided with the server and a plurality of hosts, and the proxy host is elected by the plurality of hosts of the NFS based on a preset election principle, and the device comprises:
an operation execution module, configured to execute a specified operation in a service directory of the NFS server; the specified operation comprises any one of a write operation, a read operation and a modification operation;
a state determining module, configured to determine a working state of the NFS server according to an execution result obtained after the operation executing module executes the specified operation;
the setting module is used for setting the operation authority of the created local directory based on the work state of the NFS server determined by the state determining module; the operation authority is used for controlling the operation of other hosts except the proxy host on the local directory;
wherein the setting module is further configured to:
when the working state of the NFS server determined by the state determining module is an abnormal state, setting the operation authority of the local directory to be prohibited;
and when the working state of the NFS server determined by the state determining module is a normal state, setting the operation authority of the local directory to be allowed to operate.
6. A service end working state detection device is characterized in that the device is applied to other hosts except a proxy host in a Network File System (NFS), the NFS is provided with a service end and a plurality of hosts, and the proxy host is selected for the plurality of hosts of the NFS based on a preset election principle, and the device comprises:
the operation execution module is used for executing specified operation under the local directory of the proxy host; the specified operation includes any one of a write operation, a read operation, and a modify operation, where the local directory is a local directory in the proxy host, where an operation authority is set by the proxy host according to a determined working state of the server of the NFS, the operation authority is used to control operations on the local directory by other hosts except the proxy host, and the working state of the server of the NFS is determined by an execution result after the proxy host executes the specified operation in the service directory of the server of the NFS and executes the specified operation;
and the state determining module is used for determining the working state of the NFS server according to the execution result of the operation executing module after the specified operation is executed.
7. The apparatus of claim 6, wherein the state determination module is specifically configured to:
if the execution result of the operation execution module is successful, determining that the working state of the NFS server is a normal state;
if the execution result of the operation execution module is operation failure, detecting the network connection state between the home terminal and the proxy host; and after the network connection state between the local terminal and the proxy host is determined to be normal, determining that the working state of the service terminal of the NFS is an abnormal state.
8. The apparatus of claim 7, wherein the state determination module is further to:
after determining that the network connection state between the home terminal and the proxy host is abnormal, detecting the network connection state between the home terminal and other hosts except the proxy host;
and if the network connection state between the local terminal and other hosts except the proxy host is normal, determining that the working state of the proxy host is an abnormal state.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710999728.3A CN107769996B (en) | 2017-10-24 | 2017-10-24 | Method and device for detecting working state of server |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710999728.3A CN107769996B (en) | 2017-10-24 | 2017-10-24 | Method and device for detecting working state of server |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107769996A CN107769996A (en) | 2018-03-06 |
CN107769996B true CN107769996B (en) | 2021-02-09 |
Family
ID=61269135
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710999728.3A Active CN107769996B (en) | 2017-10-24 | 2017-10-24 | Method and device for detecting working state of server |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107769996B (en) |
Family Cites Families (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101262479B (en) * | 2008-04-25 | 2012-03-21 | 成都市华为赛门铁克科技有限公司 | A network file share method, server and network file share system |
CN101699825B (en) * | 2009-10-28 | 2013-01-02 | 成都市华为赛门铁克科技有限公司 | Network file system access method, device and system |
US20110113134A1 (en) * | 2009-11-09 | 2011-05-12 | International Business Machines Corporation | Server Access Processing System |
CN101883028B (en) * | 2010-06-30 | 2015-06-24 | 中兴通讯股份有限公司 | Method and device for detecting network file system server |
CN102355596B (en) * | 2011-10-11 | 2013-08-28 | 浪潮电子信息产业股份有限公司 | Cache server deployment method suitable for video services |
CN104618191B (en) * | 2015-02-11 | 2018-05-11 | 新华三技术有限公司 | Communication fault detection method and device between a kind of host and naked memory block |
JP6601085B2 (en) * | 2015-09-15 | 2019-11-06 | 株式会社リコー | Data management system and data management method |
CN105871794A (en) * | 2015-11-13 | 2016-08-17 | 乐视云计算有限公司 | Distributed file system date storage method and system, client and server |
CN105653435A (en) * | 2015-12-28 | 2016-06-08 | 曙光信息产业(北京)有限公司 | Performance test method of NFS and performance test device of NFS |
CN106603325A (en) * | 2016-10-25 | 2017-04-26 | 上海斐讯数据通信技术有限公司 | Control method and system for mounting of network file server in client |
CN106357814B (en) * | 2016-10-27 | 2019-08-20 | 北京华为数字技术有限公司 | A kind of document handling method, agency service end and client |
CN106550037B (en) * | 2016-11-07 | 2019-09-24 | 天脉聚源(北京)传媒科技有限公司 | A kind of method and device of server data sharing |
CN107070972B (en) * | 2016-12-30 | 2020-02-07 | 中国银联股份有限公司 | Distributed file processing method and device |
-
2017
- 2017-10-24 CN CN201710999728.3A patent/CN107769996B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN107769996A (en) | 2018-03-06 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP6141189B2 (en) | Provides transparent failover in file systems | |
JP5986577B2 (en) | ALUA preference and state transition detection and processing by the host | |
JP5446167B2 (en) | Antivirus method, computer, and program | |
US8312231B1 (en) | Method and system for mounting logical unit numbers (LUNS) of snapshots | |
CN110929202B (en) | Page request failure processing method and device and computer equipment | |
CA2868247A1 (en) | Data sending method, data receiving method, and storage device | |
EP2801033B1 (en) | Accessing overlay media over a network connection | |
US10091077B1 (en) | Systems and methods for detecting transactional message sequences that are obscured in multicast communications | |
EP3229403B1 (en) | Samba configuration management method for network device and system | |
JP6301445B2 (en) | Providing local cache coherency in a shared storage environment | |
WO2017095820A1 (en) | Methods and devices for acquiring data using virtual machine and host machine | |
US20140082275A1 (en) | Server, host and method for reading base image through storage area network | |
CN113032099A (en) | Cloud computing node, file management method and device | |
CN109144776A (en) | Virtual machine image file processing method and processing device | |
CN112818307A (en) | User operation processing method, system, device and computer readable storage medium | |
CN107203451B (en) | Method and apparatus for handling failures in a storage system | |
CN103500108A (en) | System memory access method, node processor and multi-processor system | |
US10180914B2 (en) | Dynamic domain name service caching | |
US9130994B1 (en) | Techniques for avoiding dynamic domain name system (DNS) collisions | |
CN107769996B (en) | Method and device for detecting working state of server | |
CN113330426A (en) | Method, device and system for backing up data | |
CN115510016A (en) | Client response method, device and medium based on directory fragmentation | |
CN113626139B (en) | High-availability virtual machine storage method and device | |
CN109684029A (en) | Storage content access method, device, electronic equipment and computer storage medium | |
CN115098300A (en) | Database backup method, disaster recovery method, device and equipment |
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 |