Summary of the invention
In view of above-mentioned deficiencies of the prior art, the purpose of the present invention is to provide a kind of express delivery cabinet network availability monitoring with
The method and system of self-healing, it is intended to solve the problems, such as express delivery cabinet network operation low efficiency in the prior art.
Technical scheme is as follows:
A kind of method of express delivery cabinet network availability monitoring and self-healing, wherein including step:
The long interface channel of express delivery cabinet to the first service server is pre-established, and establishes express delivery cabinet to the second business and takes
The short interface channel of business device;It in express delivery cabinet operational process, detects whether long interface channel and short interface channel can be used, works as the two
When unavailable, then restart express delivery cabinet and attempt to restore network;
Routing device timing inquiry dns server then restarts routing device and attempts instauration net when packet loss reaches threshold value
Network.
The method of express delivery cabinet the network availability monitoring and self-healing, wherein further include step:
Whether express delivery cabinet is regularly sent TCP packet to routing device, is detected network and may be used by preset fixed IP and port
With, if unavailable, restart routing device attempt restore network.
The method of express delivery cabinet the network availability monitoring and self-healing, wherein further include step:
Express delivery cabinet timer access is deployed in public cloud/CDN static resource page, to detect express delivery cabinet network availability,
And record testing result.
The method of express delivery cabinet the network availability monitoring and self-healing, wherein routing device is examined using timing ICMP packet
Survey mechanism inquires dns server.
The method of express delivery cabinet the network availability monitoring and self-healing, wherein further include step:
The network information of first service server and the second service server record express delivery cabinet.
The method of described express delivery cabinet network availability monitoring and self-healing, wherein the network information includes:Express delivery cabinet is compiled
Number, whether last time line duration, current time online, network success rate.
The method of express delivery cabinet the network availability monitoring and self-healing, wherein further include step:
Express delivery cabinet records network not available time, IP address, connection type.
A kind of system of express delivery cabinet network availability monitoring and self-healing, wherein including:
First detection module, for pre-establishing the long interface channel of express delivery cabinet to the first service server, and foundation
Express delivery cabinet to the second service server short interface channel;In express delivery cabinet operational process, long interface channel and short connection are detected
Whether channel can be used, and when the two is unavailable, then restarts express delivery cabinet and attempts to restore network;
Second detection module when packet loss reaches threshold value, then restarts routing device for periodically inquiring dns server
It attempts to restore network.
The system of express delivery cabinet the network availability monitoring and self-healing, wherein further include:
Third detection module, for regularly sending TCP packet to routing device, detection by preset fixed IP and port
Whether network can be used, if unavailable, restart routing device and attempts to restore network.
The system of express delivery cabinet the network availability monitoring and self-healing, wherein further include:
4th detection module is deployed in public cloud/CDN static resource page for timer access, to detect express delivery cabinet
Network availability, and record testing result.
The system of express delivery cabinet the network availability monitoring and self-healing, wherein routing device is examined using timing ICMP packet
Survey mechanism inquires dns server.
The system of express delivery cabinet the network availability monitoring and self-healing, wherein the first service server and the second business
The network information of server record express delivery cabinet.
The system of described express delivery cabinet network availability monitoring and self-healing, wherein the network information includes:Express delivery cabinet is compiled
Number, whether last time line duration, current time online, network success rate.
The system of express delivery cabinet the network availability monitoring and self-healing, wherein when express delivery cabinet record network is not available
Between, IP address, connection type.
Beneficial effect:Through the invention, express delivery cabinet network failure can be quickly identified, and according to the type of network failure, it is right
Network failure is repaired, to make to restore express delivery cabinet network, realizes that self-healing function, the present invention substantially increase express delivery cabinet network
Maintenance efficiency has saved human and material resources.
Specific embodiment
The present invention provides the method and system of a kind of express delivery cabinet network availability monitoring and self-healing, to make mesh of the invention
, technical solution and effect it is clearer, clear, the present invention is described in more detail below.It should be appreciated that described herein
Specific embodiment be only used to explain the present invention, be not intended to limit the present invention.
Referring to Fig. 1, it is a kind of express delivery cabinet network availability monitoring of the present invention and the method preferred embodiment of self-healing
Flow chart, as shown in the figure comprising step:
S1, the long interface channel for pre-establishing express delivery cabinet to the first service server, and express delivery cabinet is established to the second industry
The short interface channel of business server;In express delivery cabinet operational process, detect whether long interface channel and short interface channel can be used, when
When the two is unavailable, then restarts express delivery cabinet and attempt to restore network;
It is extensive then to restart routing device trial when packet loss reaches threshold value for S2, routing device timing inquiry dns server
Multiple network.
The present invention for convenience of explanation, is added to step number S1 and S2, but the present invention is not to S1 and S2 before step
Execution sequence be defined, it can first carry out step S1, then execute step S2;Step S2 can also be first carried out, then is executed
Step S1;The two also may be performed simultaneously.
In the step S1, refer to as shown in Fig. 2, establishing long interface channel, from express delivery cabinet 100, (express delivery cabinet terminal is set
It is standby) to the first service server 300 (usually push server) TCP long connection service.Cluster switching machine specifically can be used
System.Identification whether available for long interface channel can be used and apply the heartbeat packet from encapsulation rather than the ack packet of TCP itself
Jump mechanism.
So-called TCP long connection, multiple data packets can be continuously transmitted in a TCP connection by referring to, in TCP connection retention period
Between, if sent without data packet, need to regularly send hair heartbeat packet to maintain this connection.Since the connection is to always exist
, if long disconnecting, illustrate that network is likely to occur abnormal conditions.
It establishes short interface channel to refer to, establishes the short interface channel of timing HTTP, at interval of a period of time, by express delivery cabinet 100
(express delivery cabinet terminal device) initiates heartbeat request, the heartbeat that can equally encapsulate certainly using application to the second service server 400
Packet sends a heartbeat packet to be identified, such as every 5s or 5min.
The short connection of HTTP is substantially the short connection of TCP.HTTP belongs to application layer protocol, is assisted in transport layer using TCP
View uses IP agreement in network layer.IP agreement mainly solve network routing and addressing issue, Transmission Control Protocol mainly solve how
Reliably transmit data packet on IP layers, make the receiving end on network receive transmitting terminal sending all packets, and sequence with
Issue sequence consensus.
If long interface channel and short interface channel are unavailable, restart express delivery cabinet 100 and attempt to restore network, i.e., it is extensive
Long interface channel or short interface channel are answered to available mode.
In the step S2, routing device 200 periodically inquires dns server 600, when packet loss reaches threshold value, then
Restart routing device 200 to attempt to restore network.
Specifically, routing device 200 uses timing ICMP packet testing mechanism, and ping inquires dns server 600.If
Ping packet loss reaches preset threshold value, illustrates that network is unavailable, needs to restart routing device 200.
ICMP is the contracting of " Internet Control Message Protocol " (Internet Control Message Protocol)
It writes, ICMP packet is also referred to as ICMP data packet.By ICMP packet testing mechanism, ping detection may be implemented, such as the ping of cmd is generated
ICMP data packet, and captured, thus the getatability of test network.When ping packet loss reaches preset threshold value, example
Such as reach 50% or more, then illustrates that network is unavailable.
Routing device 200 therein is mountable in express delivery cabinet 100, also may be mounted at outside express delivery cabinet 100, specifically can root
According to needing to be arranged.
Further, method of the invention further includes step:
Express delivery cabinet 100 regularly sends TCP packet to routing device 200, detecting network is by preset fixed IP and port
It is no available, if unavailable, restart routing device 200 and attempt to restore network.
Above-mentioned steps are to regularly send the ack packet of TCP itself by fixed IP and port, and detection local routing equipment is logical
Whether road can be used, if it is not then needing to restart routing device 200.
Further, method of the invention further includes step:
100 timer access of express delivery cabinet is deployed in the static resource page of public cloud/CDN (500), to detect express delivery cabinet 100
Network availability, and record testing result.
The full name of CDN is Content Delivery Network, i.e. content distributing network.Its basic ideas is as far as possible
The bottleneck and link for avoiding being possible to influencing data transmission bauds and stability on internet, make content transmission faster, it is more steady
It is fixed.By placing one on the existing Internet basic layer intelligent virtual net that node server is constituted everywhere in network
Network, CDN system can be in real time according to the connection of network flow and each node, load states and to the distance and response of user
The integrated informations such as time re-direct the request of user on the service node nearest from user.The purpose is to keep user nearest
Content needed for obtaining solves the crowded situation of Internet network, improves the response speed that user accesses website.CDN is building
Content distributing network on network, by the Edge Server for being deployed in various regions, by the load balancing of central platform, interior
Hold the functional modules such as distribution, scheduling, content needed for obtaining user nearby reduces network congestion, improves user's access response speed
Degree and hit rate.
In above-mentioned steps, needs to dispose the static resource page on public cloud/CDN (500) in advance, be used for express delivery cabinet
The access of 100 timing requests can assess detection express delivery cabinet network by third square channel (HTTP third square channel) side in this way
Availability, while recording testing result.Express delivery cabinet 100 can't determine whether to restart according to the testing result, only will test
As a result as reference, so that subsequent progress network detection and analysis or other purposes use, to carry out network to express delivery cabinet 100
It repairs.
Further, method of the invention further includes step:
The network information of first service server 300 and the second service server 400 record express delivery cabinet 100.
Preferably, the network information includes:Whether express delivery cabinet number, last time line duration, current time online, network
Success rate.The network success rate, which referred within the scope of the set time, actually receives that (i.e. server actually receives, such as the first industry
Be engaged in server 100, the second service server 200, public cloud etc.) heartbeat packet number divided by theoretic heartbeat packet number.
Further, express delivery cabinet 100 records network not available time, IP address, connection type.
The network information of the express delivery cabinet 100 of above-mentioned record and network unavailable time, IP address, the connection type of record
Etc. log information, can be used for network failure investigation analysis.
Long connection cluster is as shown in figure 3, access stratum server 700 can distribute practical first by cache server 800
300 address of service server, load pressure are smaller.First service server 300 is settable multiple, and supports quickly horizontal expand
Hold.The process of long connection mainly includes the following steps that:1, express delivery cabinet 100 and access stratum server 700 establish long interface channel, and
Inquire the first idle service server 300;2, access stratum server 700 is inquired by cache server 800 and distributes the free time
The first service server 300;3, access stratum server 700 issues the IP of the first idle service server 300 to express delivery cabinet
Address, and interrupt and connected with the long of express delivery cabinet 100;4, express delivery cabinet 100 and the first idle service server 300 establish long connect
It connects, and send/receive business datum.Cache server 800 therein is used to record the first business clothes in connected status
Business device 800.
The accession page url of heartbeat request time interval and third square channel is configurable, can pass through business layer specific
Configuration response bag timely update.
Power-off restarting mechanism can be used in the mode of restarting of express delivery cabinet and routing device, can also be by the way of soft reboot.
If using hard Restart mechanisms are powered off rather than soft reboot, the settable upper limit for restarting number daily, to avoid extreme network exception
The damage to express delivery cabinet and sound pick-up outfit is frequently restarted down, such as it is 20 times that setting express delivery cabinet restarts maximum number of times daily, setting
The maximum number of times of restarting daily of routing device is 30 times.
In addition timing Restart mechanisms can also be arranged in the present invention, i.e. setting is restarted in the set time, such as setting exists
Period in the late into the night is restarted, this is because the period is in business low peak period, can reduce the influence to user, in this way can be to avoid
System long-play causes the problems such as potential memory overflow, process are excessive, the distribution of network handle is excessive.This is because i.e.
Operate normally express delivery cabinet and routing device, but runing time is too long, still may cause problems, it is possible to actively into
Row is restarted, and the above problem is avoided.Such as daily morning 3 can be set in:00 restarts express delivery cabinet and routing device, is of course not solely limited to
Restart daily, can be specifically set and restart the period, such as per week or monthly the weight for carrying out express delivery cabinet and routing device on the 1st
It opens.
Method of the invention can quickly identify express delivery cabinet and routing device network failure, and have both network self-healing function.
The present invention also provides a kind of system preferred embodiments of express delivery cabinet network availability monitoring and self-healing comprising:
First detection module, for pre-establishing the long interface channel of express delivery cabinet to the first service server, and foundation
Express delivery cabinet to the second service server short interface channel;In express delivery cabinet operational process, long interface channel and short connection are detected
Whether channel can be used, and when the two is unavailable, then restarts express delivery cabinet and attempts to restore network;
Second detection module when packet loss reaches threshold value, then restarts routing device for periodically inquiring dns server
It attempts to restore network.
Further, system of the invention further includes:
Third detection module, for regularly sending TCP packet to routing device, detection by preset fixed IP and port
Whether network can be used, if unavailable, restart routing device and attempts to restore network.
Further, system of the invention further includes:
4th detection module is deployed in public cloud/CDN static resource page for timer access, to detect express delivery cabinet
Network availability, and record testing result.
Further, routing device inquires dns server using timing ICMP packet testing mechanism.If ping packet loss reaches
Preset threshold value, such as reach 50% or more, illustrate that network is unavailable, needs to restart routing device.Routing device therein can
It is mounted in express delivery cabinet, also may be mounted at outside express delivery cabinet, can specifically be set as needed.
Further, the network information of the first service server and the second service server record express delivery cabinet.
Preferably, the network information includes:Whether express delivery cabinet number, last time line duration, current time online, network
Success rate.The network success rate, which referred within the scope of the set time, actually receives that (i.e. server actually receives, such as the first industry
Be engaged in server, the second service server, public cloud etc.) heartbeat packet number divided by theoretic heartbeat packet number.
Further, express delivery cabinet record network not available time, IP address, connection type.The express delivery cabinet of above-mentioned record
The network information and the network unavailable time of record, IP address, connection type etc. log information can be used for network failure row
It checks the mark analysis.
It has been described in detail in the method for technical detail in front about above system module, so it will not be repeated.
In conclusion through the invention, can quickly identify express delivery cabinet network failure, and according to the type of network failure, it is right
Network failure is repaired, to make to restore express delivery cabinet network, realizes that self-healing function, the present invention substantially increase express delivery cabinet network
Maintenance efficiency has saved human and material resources.
It should be understood that the application of the present invention is not limited to the above for those of ordinary skills can
With improvement or transformation based on the above description, all these modifications and variations all should belong to the guarantor of appended claims of the present invention
Protect range.