CN105812169B - A kind of switch between master and slave machines method and device - Google Patents

A kind of switch between master and slave machines method and device Download PDF

Info

Publication number
CN105812169B
CN105812169B CN201410855295.0A CN201410855295A CN105812169B CN 105812169 B CN105812169 B CN 105812169B CN 201410855295 A CN201410855295 A CN 201410855295A CN 105812169 B CN105812169 B CN 105812169B
Authority
CN
China
Prior art keywords
host
standby
standby host
address
specification information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201410855295.0A
Other languages
Chinese (zh)
Other versions
CN105812169A (en
Inventor
胡瑞丰
谢军安
丁海洋
姜耀国
蒋飞虎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN201410855295.0A priority Critical patent/CN105812169B/en
Publication of CN105812169A publication Critical patent/CN105812169A/en
Application granted granted Critical
Publication of CN105812169B publication Critical patent/CN105812169B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)
  • Hardware Redundancy (AREA)

Abstract

The application provides a kind of switch between master and slave machines method and device, this method comprises: restoring standby host to normal operating conditions when receiving the notice of hostdown of monitor transmission;The Internet protocol IP address of host is distributed in release, and the IP address is distributed to the standby host;The standby host is notified to execute restoration methods, to configure and start the service being deployed on the standby host, the service is also disposed on the host.

Description

A kind of switch between master and slave machines method and device
Technical field
This application involves field of communication technology more particularly to a kind of switch between master and slave machines method and devices.
Background technique
Two-node cluster hot backup refers to that the server based on activation (active)/spare (standby) mode is hot standby.In the same time It is interior, an only server operation.When which to run a server (active) break down can not start when, it is another Platform server (standby) can be activated, to guarantee that service restores normal use in a short time.
Therefore, it such as needs using two-node cluster hot backup, then just needing to create standby machine, in the prior art, creates standby machine Process it is as follows: creation one virtual machine, as needed by the virtual machine configuration at the host of business.Then clone's skill is utilized Clone's virtual machine of host described in art assignment, and by clone's virtual machine configuration at the backup virtual machine of host, i.e. standby host.When When host is in the state of activation of the business, standby host is in the stand-by state of the business.Wherein, the process of clone's virtual machine is generated Are as follows: the image file of the host is copied, and modifies the media access (English: Media Access of the image file Control, referred to as: MAC) address, generate the virtual machine of one with the host same configuration and environment.
Although solving the deployment issue of standby machine in the prior art, how standby machine is cut when without solving failure The problem of changing.
Summary of the invention
The embodiment of the present application provides a kind of switch between master and slave machines method and device, active and standby when for solving failure in the prior art The technical issues of how machine switches.
The application first aspect provides a kind of switch between master and slave machines method, comprising:
When receiving the notice of hostdown of monitor transmission, restore standby host to normal operating conditions;
The Internet protocol IP address of host is distributed in release, and the IP address is distributed to the standby host;
The standby host is notified to execute restoration methods, to configure and start the service being deployed on the standby host, the service Also it disposes on the host.
With reference to first aspect, in the first possible implementation of the first aspect, the logical of hostdown is being received Before knowing, the method also includes:
Receive the deployment request for the deployment two-node cluster hot backup that user equipment is sent;It include two-node cluster hot backup in the deployment request Template;The template include: the host specification information and the standby host specification information, the host and the standby host it Between backup relation, the restoration methods;
The host is created according to the specification information of the host;
The standby host is created according to the specification information of the standby host, and is IP address described in the host assignment;
Start the host and the standby host;
The restoration methods are stored on the standby host;
Hang up the standby host.
The possible implementation of with reference to first aspect the first, in second of possible implementation of first aspect In, when the backup relation is unidirectional backup relation of the host to the standby host, the template further includes switching method, The switching method is used to configure and start the service of deployment on the host, the method also includes:
The switching method is saved on the host.
Second of possible implementation of the possible implementation of with reference to first aspect the first or first aspect, In the third possible implementation of first aspect, the template further includes monitoring the host and institute for the monitor The method for monitoring state for stating the operating status of standby host, before hanging up the standby host, the method also includes:
The method for monitoring state is saved on the host and the standby host;
Start the method for monitoring state being saved on the host and the standby host.
With reference to first aspect or the first possible implementation of first aspect to first aspect the third is possible Any one in implementation is notifying the standby host to execute institute in a fourth possible implementation of the first aspect Restoration methods are stated, after configuring and start the service being deployed on the standby host, the method also includes:
Obtain the specification information of the host saved;
It is re-created and the identical current hosts of the host according to the specification information of the host.
In the 4th kind of possible implementation with reference to first aspect, in the 5th kind of possible implementation of first aspect In, re-created according to the specification information with after the identical current hosts of the host, the method also includes:
Determine that the backup relation is unidirectional backup relation of the host to the standby host;
The current hosts are notified to execute the switching method, to configure and start the institute being deployed on the current hosts State service;
The IP address of the standby host is distributed in release, and the IP address is distributed to the current hosts;
The standby host is hung up again;Or
Determine that the backup relation is that the host to the standby host and the standby host to the two-way backup of the host is closed System;
Using the standby host as new host, using the current hosts as new standby host;
Hang up the new standby host.
The application second aspect provides a kind of switch between master and slave machines device, comprising:
Receiving unit;
Processing unit restores standby when for receiving the notice for the hostdown that monitor is sent when the receiving unit Machine is to normal operating conditions;The Internet protocol IP address of host is distributed in release, and the IP address is distributed to the standby host; The standby host is notified to execute restoration methods, to configure and start the service being deployed on the standby host, the service is also deployed in On the host.
In conjunction with second aspect, in the first possible implementation of the second aspect, the receiving unit is also used to: Before the notice for receiving hostdown, the deployment request for the deployment two-node cluster hot backup that user equipment is sent is received;The deployment is asked It include the template of two-node cluster hot backup in asking;The template includes: the specification information of the host and specification information, the institute of the standby host State backup relation between host and the standby host, the restoration methods;
The processing unit is also used to: creating the host according to the specification information of the host;According to the standby host Specification information creates the standby host, and is IP address described in the host assignment;Start the host and the standby host;It will be described Restoration methods are stored on the standby host;Hang up the standby host.
In conjunction with the first possible implementation of second aspect, in second of possible implementation of second aspect In, the processing unit is also used to: described when the backup relation is unidirectional backup relation of the host to the standby host Template further includes switching method, and the switching method is used to configure and start the service of deployment on the host, by institute Switching method is stated to save on the host.
In conjunction with the first possible implementation of second aspect or second of possible implementation of second aspect, In the third possible implementation of second aspect, the processing unit is also used to: when the template further includes for described It, will before hanging up the standby host when monitor monitors the method for monitoring state of the operating status of the host and the standby host The method for monitoring state is saved on the host and the standby host;Start the institute being saved on the host and the standby host State method for monitoring state.
The third in conjunction with the possible implementation of the first of second aspect or second aspect to second aspect is possible Any one in implementation, in the fourth possible implementation of the second aspect, the processing unit is also used to: It notifies the standby host to execute the restoration methods, after configuring and start the service being deployed on the standby host, obtains and save The host specification information;It is re-created and the identical current master of the host according to the specification information of the host Machine.
In conjunction with the 4th kind of possible implementation of second aspect, in the 5th kind of possible implementation of second aspect In, the processing unit is also used to: being re-created and the identical current hosts of the host according to the specification information Later, determine that the backup relation is unidirectional backup relation of the host to the standby host;The current hosts are notified to execute The switching method, to configure and start the service being deployed on the current hosts;The standby host is distributed in release The IP address, and the IP address is distributed into the current hosts;The standby host is hung up again;Or
The processing unit is also used to: determining the backup relation for the host to the standby host and the standby host to institute State the two-way backup relation of host;Using the standby host as new host, using the current hosts as new standby host;Hang up institute State new standby host.
The application third aspect provides a kind of server, and operation has host and standby host on the server;The host and The standby host is virtual machine, and the server includes:
Monitor, for monitoring the operating status of the host;
Processor, for restoring the standby host to just when receiving the notice for the hostdown that the monitor is sent Normal working condition;The Internet protocol IP address of the host is distributed in release, and the IP address is distributed to the standby host;It is logical Know that the standby host executes restoration methods, to configure and start the service being deployed on the standby host, the service is also deployed in institute It states on host.
In conjunction with the third aspect, in the first possible implementation of the third aspect, the server further includes receiving Device, for before the processor receives the notice of hostdown, what reception user equipment was sent to dispose two-node cluster hot backup Deployment request;It include the template of two-node cluster hot backup in the deployment request;The template includes: specification information and the institute of the host State backup relation between the specification information, the host and the standby host of standby host, the restoration methods;
The processor is also used to: creating the host according to the specification information of the host;According to the rule of the standby host Standby host described in lattice information creating, and be IP address described in the host assignment;Start the host and the standby host;It will be described extensive Compound method is stored on the standby host;Hang up the standby host.
In conjunction with the first possible implementation of the third aspect, in second of possible implementation of the third aspect In, the processor is also used to: when the backup relation is unidirectional backup relation of the host to the standby host, the mould Plate further includes switching method, and the switching method is used to configure and start the service of deployment on the host, will be described Switching method saves on the host.
In conjunction with the first possible implementation of the third aspect or second of possible implementation of the third aspect, In the third possible implementation of the third aspect, the processor is also used to: when the template further includes for the prison When the method for monitoring state for the operating status that control device monitors the host and the standby host, before hanging up the standby host, by institute Method for monitoring state is stated to be saved on the host and the standby host;Starting is saved in described on the host and the standby host Method for monitoring state.
The third in conjunction with the possible implementation of the first of the third aspect or the third aspect to the third aspect is possible Any one in implementation, in the fourth possible implementation of the third aspect, the processor is also used to: logical Know that the standby host executes the restoration methods and obtains preservation after configuring and start the service being deployed on the standby host The specification information of the host;It is re-created and the identical current master of the host according to the specification information of the host Machine.
In conjunction with the 4th kind of possible implementation of the third aspect, in the 5th kind of possible implementation of the third aspect In, the processor is also used to: according to the specification information re-create with the identical current hosts of the host it Afterwards, determine that the backup relation is unidirectional backup relation of the host to the standby host;The current hosts are notified to execute institute Switching method is stated, to configure and start the service being deployed on the current hosts;The institute of the standby host is distributed in release IP address is stated, and the IP address is distributed into the current hosts;The standby host is hung up again;Or
The processor is also used to: determining that the backup relation is the host to the standby host and the standby host to described The two-way backup relation of host;Using the standby host as new host, using the current hosts as new standby host;Described in hang-up New standby host.
One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:
In the embodiment of the present application, when receiving the notice of hostdown of monitor transmission, restore standby host to normal work Make state;The IP address of host is distributed in release, and the IP address is distributed to the standby host;Then the standby host is notified to hold Row restoration methods, to configure and start the service on the standby host.Therefore, it can be realized by the method for the embodiment of the present application The purpose of standby host is switched to when hostdown.Wherein, the configuration and starting of switching and service of the switching including IP.
Detailed description of the invention
Fig. 1 is a kind of flow chart of switch between master and slave machines method provided by the embodiments of the present application;
Fig. 2 is the interaction schematic diagram of a kind of standby machine creation and switching provided by the embodiments of the present application;
Fig. 3 is the functional block diagram of the switch between master and slave machines device provided in the embodiment of the present application;
Fig. 4 is the structural block diagram of the server provided in the embodiment of the present application.
Specific embodiment
The embodiment of the present application provides a kind of switch between master and slave machines method and device, active and standby when solving failure in the prior art The technical issues of how machine switches.
The terms "and/or", only a kind of incidence relation for describing affiliated partner, indicates that there may be three kinds of passes System, for example, A and/or B, can indicate: individualism A exists simultaneously A and B, these three situations of individualism B.
To keep the purposes, technical schemes and advantages of the embodiment of the present application clearer, below in conjunction with the embodiment of the present application In attached drawing, technical solutions in the embodiments of the present application is explicitly described, it is clear that described embodiment is the application A part of the embodiment, instead of all the embodiments.Based on the embodiment in the application, those of ordinary skill in the art are not having Every other embodiment obtained under the premise of creative work is made, shall fall in the protection scope of this application.
It is a kind of flow chart of switch between master and slave machines method provided by the embodiments of the present application, the party referring first to shown in Fig. 1 Method includes the following contents:
Step 101: when receiving the notice of hostdown of monitor transmission, restoring (resume) standby host to normal work Make state;
Step 102: Internet protocol (English: Internet Protocol, abbreviation: IP) address of host is distributed in release, And the IP address is distributed into the standby host;
Step 103: notifying the standby host to execute restoration methods, to configure and start the service being deployed on the standby host. Wherein, the service is also disposed on the host.
Wherein, in a step 101, standby host is for example, restored to normal operating conditions from hang-up (suspend) state.
Next step 102 is executed, i.e. the IP address of host is distributed in release, and the IP address is distributed to described standby Machine.Specifically, external equipment or service can access the service being deployed on the standby host by the IP address.
Specifically, during practice, the IP address of host is distributed in release, can be release the IP address and The binding relationship of the host.And the IP address is distributed into the standby host, can be the IP address is tied to it is described Standby host.
After the IP address is distributed to the standby host, step 103 is next executed, that is, the standby host is notified to execute Restoration methods, to configure and start the service being deployed on the standby host.Specifically, restoration methods can be stored in described On standby host, when the standby host receives the notice for executing the restoration methods, begin to execute the restoration methods.By holding The row restoration methods complete the service that configuration and starting are deployed on the standby host.Wherein, described to be deployed on the standby host Service it is identical as the service on the host of deployment.In other words, the standby host substitution host operation is deployed in described Service on host, to guarantee externally to provide the continuity of service.
It can be seen that can realize cutting between standby machine easily and fast by the standby machine in the embodiment of the present application It changes.
A kind of possible application scenarios of aforementioned switch between master and slave machines method are as follows: the host and the standby host is according to backgrounds The creation of method described in technology.Specifically, a virtual machine is first created as the host, recycles clone technology Clone's virtual machine of the virtual machine is replicated, and modifies the configuration of clone's virtual machine, makes the standby host.In the situation Under, host is identical with the specification of standby host.
The alternatively possible application scenarios of aforementioned switch between master and slave machines method are as follows: the host and the standby host be according to What the template for the two-node cluster hot backup that family equipment is sent was established, specifically, before receiving the notice of hostdown, this method is also It include: the deployment request for receiving the deployment two-node cluster hot backup that user equipment is sent;It include the mould of two-node cluster hot backup in the deployment request Plate;The template includes: the specification information and the specification information of the standby host of the host, between the host and the standby host Backup relation, the restoration methods;The host is created according to the specification information of the host;According to the specification of the standby host Standby host described in information creating, and be IP address described in the host assignment;Start the host and the standby host;By the recovery Method is stored on the standby host;Hang up the standby host.Further, monitor is also informed to be monitored the host.
Wherein, the equipment that user equipment can be user side is also possible to the management system of higher.
Wherein, the backup relation can be the two-way standby of the host to the standby host and the standby host to the host Part relationship.Specifically, described in the host to the standby host and the standby host to the expression of the two-way backup relation of the host Standby host is the guest machine of the host, and the host is also possible to the guest machine of the standby host.
The backup relation is also possible to the unidirectional backup relation of the host to the standby host, i.e., the described standby host is as institute The guest machine of host is stated, and the host cannot function as the guest machine of the standby host.
Specifically, the specification information of the specification information of the host and the standby host for example, central processing unit (English Text: Central Processing Unit, referred to as: CPU) quantity, the size of memory, the size of disk, operation system information With the software information installed on host and standby host.Certainly, in practice, the specification information can also include in other Hold, all embodiments of the application are not construed as limiting.
It can thus be seen that because in the embodiment of the present application, the specification of the specification information of the host and the standby host Information describes in a template, and the host and the standby host is respectively created according to specification information, thus the host and The specification of the standby host can be not exactly the same, it is possible to meet the scene of the host and standby host that need two kinds of different sizes.
Specifically, start the host and the standby host, can be logical to the virtual machine of the host and the standby host Electricity, until load operating system finishes, at this time because being host assignment IP address, the host, which is in, works normally shape State.And the standby host is in normal operating condition.
In practice, it can also first start the host and the standby host to normal operating condition, be again then institute Host assignment IP address is stated, then the host is at normal operating conditions after distributing IP address.
Wherein, the restoration methods are stored on the standby host, in order to be able to carry out the recovery in step 103 Method, to configure and start the service being deployed on the standby host.
After having saved the restoration methods, the standby host is hung up.In other words, so that the standby host is in spare (standby) state.The only described host externally provides service.Under suspended state, the standby host in a dormant state, is not accounted for With computing resource, but can be with quick start.
In the present embodiment, backup relation be two-way backup relation, institute in order to the standby host break down when, switching To the current hosts of reconstruction, the restoration methods can also be stored on the current hosts.
Optionally, if the backup relation is unidirectional backup relation of the host to the standby host, i.e., the described standby host As the guest machine of the host, and the host cannot function as the guest machine of the standby host, then further including switching in template Method, the switching method are used to configure and start the service of deployment on the host.Therefore, described in the aforementioned starting After host, also the switching method is saved on the host.
Certainly, in practice, if the backup relation is two-way backup relation, template also may include described cuts Change method.
In a further embodiment, the template further includes monitoring the host and the standby host for the monitor Operating status method for monitoring state, before hanging up the standby host, the method also includes: by the method for monitoring state It is saved on the host and the standby host;Start the method for monitoring state being saved on the host and the standby host.
Specifically, it is needed when perhaps the standby host externally provides service in the host to the host or described Standby host is monitored whether break down.As such, it can be that providing method for monitoring state in a template by user.In deployment two-shipper When hot standby, method for monitoring state is just saved in the host and the standby host respectively, and starts the method for monitoring state.? When the host or the standby host operate normally, monitor can know the host or institute by the method for monitoring state State the state of standby host.
For example, method for monitoring state is run on the host, the service state on host described in periodic detection, such as Service operation is normal, then sends heartbeat message to monitor.When service occurs abnormal, stop sending heartbeat message, either When the hardware failure of host, monitor can not also receive heartbeat message.
Certainly, when not having definition status monitor mode in template, monitor can be using other modes to the host Or the standby host is monitored.For example, it such as monitors described in the physical state of the host or the standby host, routine test Whether the address of host or the standby host may have access to host described in either routine test or whether the port of the standby host is connected to Deng.
It should be noted that preferably, when monitor detects the hostdown, in addition to sending the hostdown Notice, hair stops monitoring the Host Status.It can so repeat to send the notice to avoid monitoring module, and then cause to walk Rapid 101 re-execute.
Getting above-mentioned described information from the template, or and after getting other desired information, The template can be saved, in order to subsequent use.It is also possible to extracting these information into independent preservation.
Continue the scene established with the template that the host and the standby host are the two-node cluster hot backup sent according to user equipment Illustrate the subsequent step that switch between master and slave machines method may include.
A kind of possible method are as follows: after step 103, obtain the specification information of the host of preservation;According to described Specification information re-creates and the identical current hosts of the host.In other words, a host is re-created, because attaching most importance to When new creation based on the specification information that uses of specification information or when previous creation, so being equivalent to after creation and having one A and identical current hosts of the host.In the present embodiment, current hosts and the host are completed identical specifically Refer to: specification is identical, and if it is unidirectional backup relation, saves identical switching method and the identical service of deployment.
According to the difference of the backup relation, the processing mode after reconstruction host can have following two.
The first, determines that the backup relation is unidirectional backup relation according to the backup relation in the template;It is logical Know that the current hosts execute the switching method, to configure and start the service being deployed on the current hosts;It releases The IP address for distributing to the standby host is put, and the IP address is distributed into the current hosts;Hang up the standby host.It changes Yan Zhi, in the present embodiment, after rebuilding host, or the host by rebuilding provides service Lai external, and the standby host continues It hangs up and is used as guest machine.
Then the step of monitoring the current hosts can be jumped to, step 101 is then repeated to step: hanging up again The standby host.
Second, determine that the backup relation is the two-way backup relation, that is to say, that host and standby host can be mutual As guest machine.Therefore, using the standby host as new host, using the current hosts as new standby host;It hangs up described new Standby host.Then the step of monitoring the new host can be jumped to, then repeats step 101 to step: described in hang-up New standby host.
For convenience of the implementation process of the method understood in the embodiment of the present application, will say for a specific example below It is bright.
When user needs to dispose two-node cluster hot backup, the deployment request of deployment two-node cluster hot backup can be sent to cloud platform, in institute Stating in deployment request includes the template.The template includes: the specification information of host and specification information, the host of standby host Backup relation, the restoration methods between the standby host;The backup relation is the host to the standby host and described Standby host to the host two-way backup relation or be the unidirectional backup relation.Further, as previously mentioned, the template is also wrapped Include the switching method and/or the method for monitoring state.
In this example, it is assumed that using topology and O&M the specification (English: Topology and of cloud application Orchestration Specification for Cloud Applications, referred to as: TOSCA) specification is described to describe Template.Certainly, in other embodiments, the template can also be described using other specifications.
Shown in TOSCA template such as code (1).
Please also refer to shown in Fig. 2, Fig. 2 is that the interaction of a kind of standby machine creation and switching provided by the embodiments of the present application is shown It is intended to.As shown in Fig. 2, when the template is sent to the arranging service engine of openstack cloud environment by user equipment (Orchestrator calls engine in the following text).It is corresponding, engine execute step 201: receive user equipment send such as code (1) institute The template of description.Wherein, the template is for example included in aforementioned deployment request.
Next it executes step 202: by parsing the template, obtaining host (masterserver) and standby host (slaveserver) backup relation, restoration methods (failover), switching method between specification information, host and standby host (switchback) and method for monitoring state (status).In code (1), the specification information of host be (8CPU, 16G memory, 160G disk), the information (framework of operating system, type, version) of operating system (os).The specification information of standby host be (4CPU, 8G memory, 80G disk), operation system information (framework of operating system, type, version).The host it can be seen from code (1) Operation system information it is identical with the operation system information of standby host, but the specification of CPU, memory and disk is different.
It is indicated in the present embodiment by the backup relation (backupby) in code (1) as the unidirectional standby of host to standby host Part relationship.
Describe how that the tomcat that configuration is deployed on standby host is serviced simultaneously in the code segment of restoration methods (failover) Start tomcat service.Such as the Connection Pool Setting for servicing tomcat on standby host is 500.
The code segment of switching method (switchback) describes how that the tomcat that configuration is deployed on host is serviced simultaneously Start tomcat service.Such as the Connection Pool Setting for servicing tomcat on host is 1200.
The code segment of condition monitoring mode (status) describes how to be monitored tomcat service.Such as: every 2 seconds are even 8080 ports an of the machine are connect, as can connection, then send heartbeat message to monitored address.
Step 203: engine saves the template, so as to subsequent use.Wherein, the template can be saved to tables of data In, table structure is as shown in Table 1:
Id created_at updated_at template files
Number Creation time Renewal time Template type Template file content
1 2014-09-10 2014-09-10 TOSCA Service1.tempalte
Table one
Next execute step 204: engine creates according to the specification information of host and starts host.After the completion of creation, The mark of host can be obtained.Host identification is used for unique identification host.As an example it is assumed that host identification is 0531ab6366f 04636b64762c4f002cb96。
Step 205: engine creates standby host according to the specification information of standby host.After the completion of creation, the mark of standby host can be obtained. Standby host identifies unique identification standby host.Step 205 and step 204 do not limit sequencing.
Step 206: engine is host assignment IP address.Specifically, Openstack is placed on the IP resource externally serviced In one pond, these IP can distribute to different virtual machines according to demand, so being known as (floating) IP that floats.Engine from Apply for that an IP address is tied to host in the Floating IP address resource pool of openstack.Assuming that the address applied is 10.0.0.2. Wherein, can be before starting host for the step of host assignment IP address, it can also be after starting host.Similar, step Rapid 206 can be before step 205, can also be after step 205.
Step 207: switching method and method for monitoring state are stored on host by engine, and starting state monitoring method; Restoration methods and method for monitoring state are stored on standby host simultaneously starting state monitoring method by engine.Method for monitoring state is for example protected Save as file :/opt/stack/os-recovery-method/status.Restoration methods for example save as file :/opt/ stack/os-recovery-method/failover.Switching method for example saves as file :/opt/stack/os- recovery-method/switchback。
Step 208: engine hangs up (suspend) standby host and notifies monitor that (ceilometer belongs to openstack's Monitoring module) start monitoring host computer operating status.
Step 209: the operating status of monitor monitoring host computer.Specifically, monitor can be positioned by unified resource Symbol (English: Uniform Resoure Locator, referred to as: URL): http://metadataserveraddress/ Masterserverid/heartbeat carrys out the heartbeat of monitoring host computer.Wherein metadataserver is the member in openstack Data server, for indicating the address of host.Masterserverid is host identification above-mentioned.Heartbeat is to fix Section, expression is heartbeat message, to distinguish other data exchanged between metadataserver and host.In the present embodiment In, address is for example are as follows: http: // 169.254.169.254/0531ab6366f04636b64762c4f002cb96/ heartbeat).Under normal circumstances, which is accessed once for every 2 seconds.If detecting that the address is more than 2 seconds without interviewed It asks, then illustrates operational state of mainframe exception, jump to step 209.
Step 210: monitor stops the operating status of monitoring host computer, and the notice of hostdown or exception is sent to engine.
Step 211: engine restores (resume) standby host, and discharges the Floating IP address (10.0.0.2) for distributing to host, then Floating IP address (10.0.0.2) is tied to standby host.
Step 212: engine notifies standby host to execute restoration methods, that is, the opt/stack/os-recovery- saved Method/failover script.Restoration methods are executed by standby host, configure and start the tomcat service being deployed on standby host.
Step 213: engine queries aforementioned data table obtains the template of preservation.
Step 214: engine obtains the specification information of host, and re-create host by parsing the template.
Step 215: engine obtains backup relation by parsing the template.Wherein, in the present embodiment unidirectionally to back up Relationship.Therefore step 216 is next executed.
Step 216: the host that engine notice re-creates executes switching method, is re-created with configuring and starting to be deployed in Host on tomcat service.
Step 217: engine discharges the Floating IP address (10.0.0.2) for distributing to standby host, then by the Floating IP address (10.0.0.2) It is tied to the host re-created.Next step 208 is repeated to step 217.
Host is being disposed and when standby host first it can be seen from above description, can dispose the host of different size and standby Machine, it is possible to meet the demand to the standby machine of different size.In addition, master will can be distributed to originally in hostdown The IP address of machine is reallocated to standby host, and standby host is able to carry out restoration methods, to configure and start the clothes being deployed on standby host Switch between master and slave machines are carried out automatically when being engaged in, therefore solving the problems, such as to break down.
Based on the same inventive concept, refering to what is shown in Fig. 3, being a kind of switch between master and slave machines device provided by the embodiments of the present application Functional block diagram, for realizing Fig. 1 of the present invention and switch between master and slave machines method shown in Fig. 2, term involved in this embodiment Meaning please refers to content described in previous embodiment.The switch between master and slave machines device includes: receiving unit 301;Processing unit 302, when the notice of the hostdown for receiving monitor transmission when receiving unit 301, restore standby host to working normally shape State;The Internet protocol IP address of host is distributed in release, and IP address is distributed to standby host;Standby host is notified to execute restoration methods, To configure and start the service being deployed on standby host, service is also deployed on host.
Further, receiving unit 301 is also used to: before receiving the notice of hostdown, being received user equipment and is sent Deployment two-node cluster hot backup deployment request;It include the template of two-node cluster hot backup in deployment request;Template includes: the specification information of host Backup relation, restoration methods between the specification information of standby host, host and standby host;
Processing unit 302 is also used to: creating host according to the specification information of host;It is created according to the specification information of standby host standby Machine, and be host assignment IP address;Start host and standby host;Restoration methods are stored on standby host;Hang up standby host.
Further, processing unit 302 is also used to: when backup relation is unidirectional backup relation of the host to standby host, template It further include switching method, switching method is stored in host for configuring and starting the service being deployed on host by switching method On.
Optionally, processing unit 302 is also used to: when template further includes the operation shape for monitor monitoring host computer and standby host When the method for monitoring state of state, before hanging up standby host, method for monitoring state is saved on host and standby host;Starting is saved in Method for monitoring state on host and standby host.
Optionally, processing unit 302 is also used to: notice standby host execute restoration methods, with configure and start be deployed in it is standby After service on machine, the specification information of the host of preservation is obtained;It is re-created according to the specification information of host complete with host Identical current hosts.
Further, processing unit 302 is also used to: being re-created and the identical current master of host according to specification information After machine, determine that backup relation is unidirectional backup relation of the host to standby host;Current hosts are notified to execute switching method, with configuration And start the service being deployed on current hosts;The IP address of standby host is distributed in release, and IP address is distributed to current hosts; Standby host is hung up again;Or
Processing unit 302 is also used to: determining backup relation for host to standby host and standby host to the two-way backup relation of host; Using standby host as new host, using current hosts as new standby host;Hang up new standby host.
The device for example corresponds to the engine in previous embodiment.
Various change mode in switch between master and slave machines method and specific example in earlier figures 1 and Fig. 2 embodiment is equally suitable For the switch between master and slave machines device of the present embodiment, pass through the aforementioned detailed description to switch between master and slave machines method, those skilled in the art Member is clear that the implementation method of switch between master and slave machines device in the present embodiment, so in order to illustrate the succinct of book, herein No longer it is described in detail.
Based on the same inventive concept, refering to what is shown in Fig. 4, being a kind of structural frames of server provided by the embodiments of the present application Figure, for realizing Fig. 1 of the present invention and standby machine method shown in Fig. 2, the meaning of term involved in this embodiment is please referred to Content described in previous embodiment.As shown in figure 4, the server include processor 401, transmitter 402, receiver 403, Memory 404 and monitor 405.Processor 401 specifically can be general central processing unit (CPU), can be specific application Integrated circuit (English: Application Specific Integrated Circuit, referred to as: ASIC), can be one or Multiple integrated circuits executed for controlling program.The quantity of memory 404 can be one or more.Memory 404 can be with Including read-only memory (English: Read Only Memory, abbreviation: ROM), random access memory (English: Random Access Memory, referred to as: RAM) and magnetic disk storage.These memories, receiver 403 and transmitter 402 by bus with Processor 401 is connected.Receiver 403 and transmitter 402 are used to carry out network communication with external equipment, specifically can by with The too networks such as net, wireless access network, WLAN are communicated with external equipment.Receiver 403 and transmitter 402 can be Two physically independent elements, are also possible to the same element physically.
It can store instruction in memory 404, processor 401 can execute the instruction stored in memory 404.
Specifically, in one embodiment, operation has host and standby host on server.The host and the standby host are void Quasi- machine.
Monitor 405 is used to monitor the use state of the host.
Processor 401 is also used to restore standby host to normal when receiving the notice of hostdown of the transmission of monitor 405 Working condition;The Internet protocol IP address of host is distributed in release, and IP address is distributed to standby host;Notice standby host executes recovery Method, to configure and start the service being deployed on standby host, which is also deployed on host.
Optionally, receiver 403 is used for before processor 401 receives the notice of hostdown, receives user equipment The deployment request of the deployment two-node cluster hot backup of transmission;It include the template of two-node cluster hot backup in deployment request;Template includes: the specification of host Backup relation, restoration methods between the specification information of information and standby host, host and standby host;Processor 401 is also used to: according to master The specification information of machine creates host;Standby host is created according to the specification information of standby host, and is host assignment IP address;Start host and Standby host;Restoration methods are stored on standby host;Hang up standby host.
Optionally, processor 401 is also used to: when backup relation is unidirectional backup relation of the host to standby host, template is also Including switching method, switching method is stored on host by switching method for configuring and starting the service being deployed on host.
Optionally, processor 401 is also used to: when template further includes the operation for monitor 405 monitoring host computer and standby host When the method for monitoring state of state, before hanging up standby host, method for monitoring state is saved on host and standby host;Starting saves Method for monitoring state on to host and standby host.
Optionally, processor 401 is also used to: being executed restoration methods in notice standby host, is deployed in standby host to configure and start On service after, obtain the specification information of the host of preservation;It is re-created and the complete phase of host according to the specification information of host Same current hosts.
Further, processor 401 is also used to: being re-created and the identical current hosts of host according to specification information Later, determine that backup relation is unidirectional backup relation of the host to standby host;Current hosts are notified to execute switching method, to configure simultaneously Start the service being deployed on current hosts;The IP address of standby host is distributed in release, and IP address is distributed to current hosts;Again Secondary hang-up standby host.
Or processor 401 is also used to: determining that backup relation is that host to standby host and standby host to the two-way backup of host is closed System;Using standby host as new host, using current hosts as new standby host;Hang up new standby host.
The server is, for example, Cloud Server, and may be physically an equipment, is also possible to multiple equipment composition Server zone.
Various change mode in switch between master and slave machines method and specific example in earlier figures 1 and Fig. 2 embodiment is equally suitable For the server of the present embodiment, by the aforementioned detailed description to switch between master and slave machines method, those skilled in the art can be clear The implementation method for knowing server in the present embodiment of Chu, so this will not be detailed here in order to illustrate the succinct of book.
The one or more technical solutions provided in application embodiment, have at least the following technical effects or advantages:
In the embodiment of the present application, when receiving the notice of hostdown of monitor transmission, restore standby host to normal work Make state;The IP address of host is distributed in release, and the IP address is distributed to the standby host;Then the standby host is notified to hold Row restoration methods, to configure and start the service on the standby host.Therefore, it can be realized by the method for the embodiment of the present application The purpose of standby host is switched to when hostdown.Wherein, the configuration and starting of switching and service of the switching including IP.
It should be understood by those skilled in the art that, embodiments herein can provide as method, system or computer program Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the application Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the application, which can be used in one or more, The shape for the computer program product implemented in usable storage medium (including but not limited to magnetic disk storage and optical memory etc.) Formula.
The application is referring to method, the process of equipment (system) and computer program product according to the embodiment of the present application Figure and/or block diagram describe.It should be understood that every one stream in flowchart and/or the block diagram can be realized by computer program instructions The combination of process and/or box in journey and/or box and flowchart and/or the block diagram.It can provide these computer programs Instruct the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to produce A raw machine, so that being generated by the instruction that computer or the processor of other programmable data processing devices execute for real The device for the function of being specified in present one or more flows of the flowchart and/or one or more blocks of the block diagram.
These computer program instructions, which may also be stored in, is able to guide computer or other programmable data processing devices with spy Determine in the computer-readable memory that mode works, so that it includes referring to that instruction stored in the computer readable memory, which generates, Enable the manufacture of device, the command device realize in one box of one or more flows of the flowchart and/or block diagram or The function of being specified in multiple boxes.
These computer program instructions also can be loaded onto a computer or other programmable data processing device, so that counting Series of operation steps are executed on calculation machine or other programmable devices to generate computer implemented processing, thus in computer or The instruction executed on other programmable devices is provided for realizing in one or more flows of the flowchart and/or block diagram one The step of function of being specified in a box or multiple boxes.
Obviously, those skilled in the art can carry out various modification and variations without departing from the essence of the application to the application Mind and range.In this way, if these modifications and variations of the application belong to the range of the claim of this application and its equivalent technologies Within, then the application is also intended to include these modifications and variations.

Claims (8)

1. a kind of switch between master and slave machines method characterized by comprising
When receiving the notice of hostdown of monitor transmission, restore standby host to normal operating conditions;
The Internet protocol IP address of host is distributed in release, and the IP address is distributed to the standby host;
The standby host is notified to execute restoration methods, it is described to service also portion to configure and start the service being deployed on the standby host Administration is on the host;
Obtain the specification information of the host saved;
It is re-created and the identical current hosts of the host according to the specification information of the host;
Determine that backup relation is unidirectional backup relation of the host to the standby host;The current hosts are notified to execute switching side Method, to configure and start the service being deployed on the current hosts;The IP address of the standby host is distributed in release, And the IP address is distributed into the current hosts;The standby host is hung up again;Or
Determine the backup relation for the host to the standby host and the standby host to the two-way backup relation of the host;It will The standby host is as new host, using the current hosts as new standby host;Hang up the new standby host.
2. the method as described in claim 1, which is characterized in that before receiving the notice of hostdown, the method is also Include:
Receive the deployment request for the deployment two-node cluster hot backup that user equipment is sent;It include the mould of two-node cluster hot backup in the deployment request Plate;The template includes: the specification information and the specification information of the standby host of the host, between the host and the standby host Backup relation, the restoration methods;
The host is created according to the specification information of the host;
The standby host is created according to the specification information of the standby host, and is IP address described in the host assignment;
Start the host and the standby host;
The restoration methods are stored on the standby host;
Hang up the standby host.
3. method according to claim 2, which is characterized in that when the backup relation is list of the host to the standby host When to backup relation, the template further includes switching method, and the switching method is deployed in the host for configuring and starting On the service, the method also includes:
The switching method is saved on the host.
4. method as claimed in claim 2 or claim 3, which is characterized in that the template further includes monitoring institute for the monitor The method for monitoring state for stating the operating status of host and the standby host, before hanging up the standby host, the method also includes:
The method for monitoring state is saved on the host and the standby host;
Start the method for monitoring state being saved on the host and the standby host.
5. a kind of switch between master and slave machines device characterized by comprising
Receiving unit;
Processing unit restores standby host extremely when for receiving the notice for the hostdown that monitor is sent when the receiving unit Normal operating conditions;The Internet protocol IP address of host is distributed in release, and the IP address is distributed to the standby host;Notice The standby host executes restoration methods, and to configure and start the service being deployed on the standby host, the service is also deployed in described On host;
The processing unit is also used to: notifying the standby host to execute the restoration methods, with configure and start be deployed in it is described After service on standby host, the specification information of the host of preservation is obtained;It is re-created according to the specification information of the host With the identical current hosts of the host;
The processing unit is also used to: being re-created and the identical current hosts of the host according to the specification information Later, determine that backup relation is unidirectional backup relation of the host to the standby host;The current hosts are notified to execute switching Method, to configure and start the service being deployed on the current hosts;Release is with distributing to the IP of the standby host Location, and the IP address is distributed into the current hosts;The standby host is hung up again;Or
The processing unit is also used to: determining that the backup relation is the host to the standby host and the standby host to the master The two-way backup relation of machine;Using the standby host as new host, using the current hosts as new standby host;It hangs up described new Standby host.
6. device as claimed in claim 5, which is characterized in that the receiving unit is also used to: receiving hostdown Before notice, the deployment request for the deployment two-node cluster hot backup that user equipment is sent is received;It include two-node cluster hot backup in the deployment request Template;The template includes: the specification information of the host and specification information, the host and the standby host of the standby host Between backup relation, the restoration methods;
The processing unit is also used to: creating the host according to the specification information of the host;According to the specification of the standby host Standby host described in information creating, and be IP address described in the host assignment;Start the host and the standby host;By the recovery Method is stored on the standby host;Hang up the standby host.
7. device as claimed in claim 6, which is characterized in that the processing unit is also used to: when the backup relation is institute When stating unidirectional backup relation of the host to the standby host, the template further includes switching method, and the switching method is for configuring And start the service of deployment on the host, the switching method is saved on the host.
8. device as claimed in claims 6 or 7, which is characterized in that the processing unit is also used to: when the template further includes When monitoring the method for monitoring state of the operating status of the host and the standby host for the monitor, the standby host is being hung up Before, the method for monitoring state is saved on the host and the standby host;Starting is saved in the host and described standby The method for monitoring state on machine.
CN201410855295.0A 2014-12-31 2014-12-31 A kind of switch between master and slave machines method and device Active CN105812169B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410855295.0A CN105812169B (en) 2014-12-31 2014-12-31 A kind of switch between master and slave machines method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410855295.0A CN105812169B (en) 2014-12-31 2014-12-31 A kind of switch between master and slave machines method and device

Publications (2)

Publication Number Publication Date
CN105812169A CN105812169A (en) 2016-07-27
CN105812169B true CN105812169B (en) 2019-08-20

Family

ID=56465225

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410855295.0A Active CN105812169B (en) 2014-12-31 2014-12-31 A kind of switch between master and slave machines method and device

Country Status (1)

Country Link
CN (1) CN105812169B (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106972960A (en) * 2017-03-17 2017-07-21 杭州全视软件有限公司 A kind of adaptation networking detector, the method for controller
CN108390781A (en) * 2018-02-12 2018-08-10 王磊 A kind of method and system of the automatic Hot Spare of host
CN108304281A (en) * 2018-02-28 2018-07-20 南京铱迅信息技术股份有限公司 A kind of method that virtual machine is backed up in realtime
CN108958946A (en) * 2018-08-02 2018-12-07 中国建设银行股份有限公司 Virtualization resource pond switching method, device and electronic equipment
CN109164787A (en) * 2018-08-31 2019-01-08 杭州和利时自动化有限公司 A kind of analog signals acquisition device
CN109032765A (en) * 2018-09-05 2018-12-18 郑州云海信息技术有限公司 A kind of virtual machine two-node cluster hot backup dispositions method, device and equipment
CN110979404B (en) * 2019-12-19 2021-11-12 交控科技股份有限公司 Dual-machine hot standby system and method of automatic train supervision system
CN111404760B (en) * 2020-06-03 2020-09-18 广东睿江云计算股份有限公司 Method for modifying configuration of cloud host online

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1706160A (en) * 2003-01-13 2005-12-07 思科技术公司 Method and system for optimized switchover of redundant forwarding engines
CN101056445A (en) * 2006-04-11 2007-10-17 大唐移动通信设备有限公司 Backup and recovery method for NBAP resource of NodeB
CN101227319A (en) * 2007-01-15 2008-07-23 日立通讯技术株式会社 Redundancy switching method
CN103944698A (en) * 2014-04-10 2014-07-23 四川华雁信息产业股份有限公司 Hot standby method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1706160A (en) * 2003-01-13 2005-12-07 思科技术公司 Method and system for optimized switchover of redundant forwarding engines
CN101056445A (en) * 2006-04-11 2007-10-17 大唐移动通信设备有限公司 Backup and recovery method for NBAP resource of NodeB
CN101227319A (en) * 2007-01-15 2008-07-23 日立通讯技术株式会社 Redundancy switching method
CN103944698A (en) * 2014-04-10 2014-07-23 四川华雁信息产业股份有限公司 Hot standby method

Also Published As

Publication number Publication date
CN105812169A (en) 2016-07-27

Similar Documents

Publication Publication Date Title
CN105812169B (en) A kind of switch between master and slave machines method and device
US10776215B2 (en) Snapshot generating method, system, and apparatus
US11895016B2 (en) Methods and apparatus to configure and manage network resources for use in network-based computing
US10609159B2 (en) Providing higher workload resiliency in clustered systems based on health heuristics
US9600380B2 (en) Failure recovery system and method of creating the failure recovery system
CN103595801B (en) Cloud computing system and real-time monitoring method for virtual machine in cloud computing system
CN108270726B (en) Application instance deployment method and device
EP2800303A1 (en) Switch method, device and system for virtual application dual machine in cloud environment
WO2017092017A1 (en) Method, apparatus and system for migrating virtual machine backup information
WO2016165304A1 (en) Method for managing instance node and management device
US20150309901A1 (en) Emulating a stretched storage device using a shared storage device
US10817323B2 (en) Systems and methods for organizing on-demand migration from private cluster to public cloud
CN102355369A (en) Virtual clustered system as well as processing method and processing device thereof
EP3550436A1 (en) Method and apparatus for detecting and recovering fault of virtual machine
CN113032085A (en) Management method, device, server, management system and medium of cloud operating system
CN106612312A (en) Virtualized data center scheduling system and method
US9442811B2 (en) Emulating a stretched storage device using a shared replicated storage device
CN104468521A (en) Online migration method, device and system
CN104239120A (en) State information synchronization method, state information synchronization device and state information synchronization system for virtual machine
CN103634128A (en) A configuration method of a virtual machine placing strategy and an apparatus
US10417101B2 (en) Fault monitoring device, virtual network system, and fault monitoring method
US8661089B2 (en) VIOS cluster alert framework
JP2013117889A (en) Wide area dispersion constitution alteration system
CN103902401A (en) Virtual machine fault tolerance method and device based on monitoring
JP5601428B1 (en) Virtualization system, control method, and control program

Legal Events

Date Code Title Description
C06 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
TR01 Transfer of patent right

Effective date of registration: 20200211

Address after: 518129 Bantian HUAWEI headquarters office building, Longgang District, Guangdong, Shenzhen

Patentee after: HUAWEI TECHNOLOGIES Co.,Ltd.

Address before: 210012 HUAWEI Nanjing base, 101 software Avenue, Yuhuatai District, Jiangsu, Nanjing

Patentee before: Huawei Technologies Co.,Ltd.

TR01 Transfer of patent right