CN106992890B - Multi-server switching method and system - Google Patents
Multi-server switching method and system Download PDFInfo
- Publication number
- CN106992890B CN106992890B CN201710255938.1A CN201710255938A CN106992890B CN 106992890 B CN106992890 B CN 106992890B CN 201710255938 A CN201710255938 A CN 201710255938A CN 106992890 B CN106992890 B CN 106992890B
- Authority
- CN
- China
- Prior art keywords
- server
- slave
- slave server
- original
- standby
- 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
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/06—Management of faults, events, alarms or notifications
- H04L41/0654—Management of faults, events, alarms or notifications using network fault recovery
- H04L41/0668—Management of faults, events, alarms or notifications using network fault recovery by dynamic selection of recovery network elements, e.g. replacement by the most appropriate element after failure
-
- G—PHYSICS
- G06—COMPUTING OR CALCULATING; COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/07—Responding to the occurrence of a fault, e.g. fault tolerance
- G06F11/16—Error detection or correction of the data by redundancy in hardware
- G06F11/20—Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements
- G06F11/202—Error detection or correction of the data by redundancy in hardware using active fault-masking, e.g. by switching out faulty elements or by switching in spare elements where processing functionality is redundant
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Hardware Redundancy (AREA)
- Telephonic Communication Services (AREA)
Abstract
The application discloses a multi-server switching method, which comprises the following steps: when the slave server group detects that the original master server is inactivated, all the slave servers in the slave server group mutually transmit time stamps; each slave server judges whether the priority of the slave server is the highest or not by using the received time stamp and judges whether the priority of the slave server is the highest or not according to the time recorded in the time stamp transmitted by the slave server, and if the priority of the slave server is the highest, the slave server is used as a standby master server. Therefore, according to the method and the system, under the condition that the original main server is inactivated, the slave servers mutually transmit the time stamps, each slave server judges whether the priority of the slave server is highest or not by utilizing the time recorded in the time stamp transmitted by the slave server according to the received time stamp, and if the priority of the slave server is highest, the slave server is used as a standby main server, so that the function of the slave server can be smoothly replaced by the original main server to continuously operate after the original main server is inactivated, and reliable data service is provided for a user. In addition, the application also correspondingly discloses a multi-server switching system.
Description
Technical Field
The invention relates to the field of multi-server hot standby, in particular to a multi-server switching method and a multi-server switching system.
Background
With the rapid development of the internet (mobile internet), users increasingly rely on data services provided by servers, the demand for availability of data is increased, and services (data) provided by the servers need to be accessed more anytime and anywhere; in order to avoid the failure of the server and the failure of the user to acquire the service, a multi-machine hot standby scheme is adopted, and when the main server is inactivated, the slave server should be switched to the main server to continue to provide the service for the user.
Disclosure of Invention
In view of the above, the present invention provides a method and a system for switching between multiple servers, so that a slave server can smoothly replace its function to continue operating after an original master server is deactivated. The specific scheme is as follows:
a multi-server switching method comprises the following steps:
when the slave server group detects that the original master server is inactivated, all the slave servers in the slave server group mutually transmit time stamps;
and each slave server judges whether the priority of the slave server is highest by using the received time stamp, and if so, the slave server is used as a standby master server.
Preferably, the process of detecting the inactivation of the original master server by the slave server group includes:
and if the slave server group fails to receive the operation signal sent by the original main server within a first threshold value, judging that the original main server is inactivated.
Preferably, each slave server receives a timestamp within a second threshold.
Preferably, the method further comprises the following steps:
if the timestamps transmitted by the plurality of slave servers are the same, the slave server can be selected as the standby master server according to the preset static allocation sequence.
Preferably, the method further comprises the following steps:
and when the standby main server detects that the original main server is recovered to be normal, sending the data during the inactivation period of the original main server to the original main server, and changing the standby main server into one slave server in the slave server group.
The invention also discloses a multi-server switching system, which comprises:
the sending module is used for sending a timestamp to each slave server in the slave server group when the slave server group detects that the original master server is inactivated;
and the judging module is used for judging whether the priority of each slave server is the highest by utilizing the received time stamp, and if so, the slave server is used as a standby main server.
Preferably, the sending module includes:
and the detection unit is used for judging that the original main server is inactivated if the slave server group fails to receive the operation signal sent by the original main server within a first threshold value.
Preferably, the judging module includes:
a timing unit for each slave server receiving a timestamp within a second threshold.
Preferably, the method further comprises the following steps:
and the selection module is used for selecting the slave server as the standby master server by utilizing a preset static allocation sequence when the timestamps sent by the plurality of slave servers are the same.
Preferably, the method further comprises the following steps:
the data sending module is used for sending the data in the inactivation period of the original main server to the original main server when the standby main server detects that the original main server is recovered to be normal;
a switching module for the standby master server to become one of the slave servers in the slave server group.
In the invention, the multi-server switching method comprises the following steps: when the slave server group detects that the original master server is inactivated, all the slave servers in the slave server group mutually transmit time stamps; each slave server judges whether the priority of the slave server is the highest or not by using the received time stamp and judges whether the priority of the slave server is the highest or not according to the time recorded in the time stamp transmitted by the slave server, and if the priority of the slave server is the highest, the slave server is used as a standby master server. Therefore, the invention can ensure that the functions of the slave servers can be smoothly replaced by the original master server to continuously operate after the original master server is inactivated, and provide reliable data service for users.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a schematic flow chart of a multi-server switching method according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a multi-server switching system according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention discloses a multi-server switching method, which is shown in figure 1 and comprises the following steps:
step S11: when the slave server group detects that the original master server is inactivated, the slave servers in the slave server group transmit time stamps to each other.
Specifically, during normal operation, the slave server group can receive the live signal sent by the original master server, and when the original master server is inactivated, the slave server group cannot receive the live signal sent by the original master server within the first threshold, the inactivation of the original master server can be known.
When the slave server group detects that the original master server is inactivated, each slave server in the slave server group transmits a time stamp to each slave server, and the time described in the time stamp may be the time when each slave server knows that the master server is inactivated, may be the time when each slave server transmits the time stamp, or may be a delay setting, which is not limited herein.
It can be understood that, because there are different delays in the communication between the servers, the slave servers may know that there is a difference in the time when the original master server is deactivated, and after each slave server knows that the original master server is deactivated, the response time may also be different due to the current operating state of the slave server, thereby affecting the sending time.
For example, there are 3 slave servers, which are respectively a first slave server, a second slave server and a third slave server, the first slave server knows that the time of the original master server is 8:30, the time of the transmission timestamp is 8:33, the second slave server knows that the time of the original master server is 8:31, the time of the transmission timestamp is 8:32, the third slave server knows that the time of the original master server is 8:33, and the time of the transmission timestamp is 8: 35; when the known time is taken as the right, the time in the time stamps of the first slave server, the second slave server and the third slave server is 8:30, 8:31 and 8:33 respectively; when the sending time is taken as the right, the time in the time stamps of the first slave server, the second slave server and the third slave server is 8:33, 8:32 and 8:35 respectively; when the delay is timing, the user sets the delay of the second slave server in advance, the time of the timestamp of the second slave server is delayed by 2 minutes, the second slave server takes the known time as punctuality, the time of the timestamp is 8:33, and the time of the timestamp is 8:34 when the sending time is punctuality.
Step S12: each slave server judges whether the priority of the slave server is the highest or not by using the received time stamp and judges whether the priority of the slave server is the highest or not according to the time recorded in the time stamp transmitted by the slave server, and if the priority of the slave server is the highest, the slave server is used as a standby master server.
Specifically, each slave server receives a timestamp transmitted from another slave server, compares the time described in each timestamp with the time in the timestamp transmitted by itself, determines whether the time described in the timestamp transmitted by itself is the earliest, and if so, can be switched to serve as a backup master server to execute the function of the backup master server. For example, there are 3 slave servers, namely a first slave server, a second slave server and a third slave server, and the time in the time stamps of the first slave server, the second slave server and the third slave server is 8:30, 8:31 and 8:33, respectively, the earliest priority of the time of the first slave server is the highest, so the first slave server serves as a standby master server.
Therefore, in the embodiment of the invention, under the condition that the original main server is inactivated, the slave servers mutually transmit the time stamps, each slave server judges whether the priority of the slave server is the highest according to the time recorded in the time stamp transmitted by the slave server by using the received time stamp, and if the priority of the slave server is the highest, the slave server is used as a standby main server, so that the function of the slave server can be smoothly replaced by the original main server to continuously operate after the original main server is inactivated, and reliable data service is provided for a user.
For example, the time in the timestamp of the first slave server may be the known time of the first slave server, and the time in the timestamp of the second slave server may be the time of the timestamp of the second slave server, which does not affect the selection of the slave server as the backup master server from the slave server group.
In practical applications, it is inevitable that the timestamps of the plurality of slave servers are the same, and therefore, when the timestamps transmitted by the plurality of slave servers are the same, the slave server can be selected as the standby master server by using a preset static allocation order.
Specifically, when the timestamps sent by the plurality of slave servers are the same, the slave servers in the slave server group judge the respective static allocation orders, and the slave server with the highest priority becomes the standby master server; the static allocation sequence can be preset by a user, and the sequence of switching each slave server to the original master server is specified, for example, 10 slave servers exist in the slave server group, the numbers from the first slave server to the tenth slave server are specified to be 1 to 10, switching is set according to the sequence from the small number to the large number, and if the original master server is inactivated, the first slave server with the number of 1 has the highest priority and is changed into the standby master server; after learning the inactivation of the original master server, the slave servers in the slave server group inquire the static allocation sequence of the slave servers, and when the slave servers confirm that the slave servers are the slave servers with the highest priority, the slave servers are switched to the standby master server.
Further, when the original master server is recovered to normal, the backup master server needs to be switched to the slave server again to recover the operation of the original master server, and the original master server continues the original operation.
Specifically, the standby main server sends all data during the operation period to the original main server, that is, all data before the original main server is recovered to be normal is sent to the original main server, so that the original main server can continue to process the data, the data is not lost or interrupted, the operation stability is ensured, and after the data is transmitted, the standby main server recovers the previous operation identity, becomes a slave server, and continues to work.
It should be noted that, some slave servers may have a relatively long time delay for sending a timestamp, or are already inactivated and cannot send a timestamp to other slave servers in time, so as to delay the time for switching the servers, for this reason, each slave server receives a timestamp within a preset time, and after the preset time is exceeded, the slave server will not wait for a timestamp sent by a subsequent slave server, and will not determine a timestamp received subsequently, for example, each slave server starts to time after confirming that the original master server is inactivated, and the preset time is 5 minutes, and the slave server compares the timestamp received within 5 minutes with the time recorded in its own timestamp, and the timestamp exceeding 5 minutes will not be compared any more, and does not wait for the timestamp sent by the slave server exceeding the time, so that the switching efficiency can be effectively improved.
The embodiment of the present invention also discloses a multi-server switching system correspondingly, as shown in fig. 2, the system includes:
a sending module 11, configured to send a timestamp to each slave server in the slave server group when the slave server group detects that the original master server is inactivated;
and the judging module 12 is used for judging whether the priority of each slave server is the highest by using the received time stamp, and if so, the slave server is used as a standby master server.
Therefore, in the embodiment of the invention, under the condition that the original main server is inactivated, the slave servers mutually transmit the time stamps, each slave server judges whether the priority of the slave server is the highest according to the time recorded in the time stamp transmitted by the slave server by using the received time stamp, and if the priority of the slave server is the highest, the slave server is used as a standby main server, so that the function of the slave server can be smoothly replaced by the original main server to continuously operate after the original main server is inactivated, and reliable data service is provided for a user.
Specifically, the sending module 11 may include a detecting unit; wherein,
and the detection unit is used for judging that the original main server is inactivated if the slave server group fails to receive the operation signal sent by the original main server within the first threshold value.
The judging module 12 may include a timing unit; wherein,
a timing unit for each slave server receiving a timestamp within a second threshold.
In the embodiment of the present invention, the device may further include a selection module, a data sending module 11, and a switching module; wherein,
and the selection module is used for selecting the slave server as the standby master server by utilizing a preset static allocation sequence when the timestamps sent by the plurality of slave servers are the same.
The data sending module 11 is configured to send data during the period of inactivation of the original main server to the original main server when the standby main server detects that the original main server is recovered to normal;
and the switching module is used for changing the standby main server into one slave server in the slave server group.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The method and system for switching among multiple servers provided by the invention are described in detail above, and a specific example is applied in the text to explain the principle and the implementation of the invention, and the description of the above embodiment is only used to help understanding the method and the core idea of the invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.
Claims (8)
1. A multi-server switching method, comprising:
when the slave server group detects that the original master server is inactivated, all the slave servers in the slave server group mutually transmit time stamps;
each slave server judges whether the priority of the slave server is the highest by using the received time stamp, and if so, the slave server is used as a standby main server;
wherein each slave server receives a timestamp within a second threshold.
2. The method according to claim 1, wherein the detecting, by the slave server group, the inactivation of the original master server comprises:
and if the slave server group fails to receive the operation signal sent by the original main server within a first threshold value, judging that the original main server is inactivated.
3. The multi-server switching method according to any one of claims 1 or 2, further comprising:
if the timestamps transmitted by the plurality of slave servers are the same, the slave server can be selected as the standby master server according to the preset static allocation sequence.
4. The multi-server switching method according to claim 1 or 2, further comprising:
and when the standby main server detects that the original main server is recovered to be normal, sending the data during the inactivation period of the original main server to the original main server, and changing the standby main server into one slave server in the slave server group.
5. A multi-server switching system, comprising:
the sending module is used for sending a timestamp to each slave server in the slave server group when the slave server group detects that the original master server is inactivated;
the judging module is used for judging whether the priority of each slave server is the highest by utilizing the received time stamp, and if so, the slave server is used as a standby main server;
wherein, the judging module comprises:
a timing unit for each slave server receiving a timestamp within a second threshold.
6. The multi-server switching system according to claim 5, wherein the sending module comprises:
and the detection unit is used for judging that the original main server is inactivated if the slave server group fails to receive the operation signal sent by the original main server within a first threshold value.
7. The multi-server switching system according to claim 5 or 6, further comprising:
and the selection module is used for selecting the slave server as the standby master server by utilizing a preset static allocation sequence when the timestamps sent by the plurality of slave servers are the same.
8. The multi-server switching system according to claim 5 or 6, further comprising:
the data sending module is used for sending the data in the inactivation period of the original main server to the original main server when the standby main server detects that the original main server is recovered to be normal;
a switching module for the standby master server to become one of the slave servers in the slave server group.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710255938.1A CN106992890B (en) | 2017-04-18 | 2017-04-18 | Multi-server switching method and system |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201710255938.1A CN106992890B (en) | 2017-04-18 | 2017-04-18 | Multi-server switching method and system |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| CN106992890A CN106992890A (en) | 2017-07-28 |
| CN106992890B true CN106992890B (en) | 2020-09-04 |
Family
ID=59415253
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201710255938.1A Active CN106992890B (en) | 2017-04-18 | 2017-04-18 | Multi-server switching method and system |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN106992890B (en) |
Families Citing this family (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN109344014B (en) * | 2018-09-26 | 2022-02-11 | 新华三大数据技术有限公司 | Main/standby switching method and device and communication equipment |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1607515A (en) * | 2003-08-29 | 2005-04-20 | 国际商业机器公司 | Apparatus and method to select a captain from a plurality of control nodes |
| CN101212341A (en) * | 2006-12-25 | 2008-07-02 | 中兴通讯股份有限公司 | A database system switching method |
| CN103067206A (en) * | 2012-12-28 | 2013-04-24 | 无锡博欧节能科技有限公司 | Internet of things across-machine room distributed type full automatic hot standby server switching system |
| CN104901882A (en) * | 2014-03-06 | 2015-09-09 | 中国移动通信集团广东有限公司 | Method and device for switching equipment, and server |
| CN105406980A (en) * | 2015-10-19 | 2016-03-16 | 浪潮(北京)电子信息产业有限公司 | Multi-node backup method and multi-node backup device |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US8886609B2 (en) * | 2010-12-17 | 2014-11-11 | Microsoft Corporation | Backup and restore of data from any cluster node |
-
2017
- 2017-04-18 CN CN201710255938.1A patent/CN106992890B/en active Active
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1607515A (en) * | 2003-08-29 | 2005-04-20 | 国际商业机器公司 | Apparatus and method to select a captain from a plurality of control nodes |
| CN101212341A (en) * | 2006-12-25 | 2008-07-02 | 中兴通讯股份有限公司 | A database system switching method |
| CN103067206A (en) * | 2012-12-28 | 2013-04-24 | 无锡博欧节能科技有限公司 | Internet of things across-machine room distributed type full automatic hot standby server switching system |
| CN104901882A (en) * | 2014-03-06 | 2015-09-09 | 中国移动通信集团广东有限公司 | Method and device for switching equipment, and server |
| CN105406980A (en) * | 2015-10-19 | 2016-03-16 | 浪潮(北京)电子信息产业有限公司 | Multi-node backup method and multi-node backup device |
Also Published As
| Publication number | Publication date |
|---|---|
| CN106992890A (en) | 2017-07-28 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US7804838B2 (en) | Time synchronizing device and process and associated products | |
| CN110601903B (en) | Data processing method and device based on message queue middleware | |
| WO2014166265A1 (en) | Method, terminal, cache server and system for updating webpage data | |
| US9596313B2 (en) | Method, terminal, cache server and system for updating webpage data | |
| CN106817387B (en) | Data synchronization method, device and system | |
| CN103457973A (en) | Image uploading method and system, image uploading client terminal and network server | |
| WO2016154513A1 (en) | Systems and methods for guaranteeing delivery of pushed data to remote clients | |
| CN107017958A (en) | A kind of method for synchronizing time and corresponding system based on NTP | |
| CN112948177A (en) | Disaster recovery backup method and device, electronic equipment and storage medium | |
| CN105959078B (en) | A kind of cluster method for synchronizing time, cluster and clock synchronization system | |
| CN111083049B (en) | User table item recovery method and device, electronic equipment and storage medium | |
| CN105933379B (en) | A kind of method for processing business, equipment and system | |
| CN109274763B (en) | Information synchronization method and dual-computer hot standby equipment | |
| CN106992890B (en) | Multi-server switching method and system | |
| US9706440B2 (en) | Mobile communication system, call processing node, and communication control method | |
| CN106992889B (en) | Multi-server switching method and system | |
| KR20160026138A (en) | Rapid sync method for cloud file system and cloud file system using the same | |
| CN113472469B (en) | Data synchronization method, device, equipment and storage medium | |
| CN116795588A (en) | A backup and recovery method, device, equipment and computer storage medium | |
| CN107104831B (en) | Multi-server switching method and system | |
| CN107104830B (en) | Multi-server switching method and system | |
| CN110581828B (en) | Time synchronization method and device for private network cluster terminal | |
| CN108737460B (en) | Connection processing method and client | |
| CN113163029B (en) | Network session account deployment method, device, terminal, server and storage medium | |
| CN105049264A (en) | Data processing method and server side |
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 |