CN103747044B - Service locking method and system - Google Patents
Service locking method and system Download PDFInfo
- Publication number
- CN103747044B CN103747044B CN201310722587.2A CN201310722587A CN103747044B CN 103747044 B CN103747044 B CN 103747044B CN 201310722587 A CN201310722587 A CN 201310722587A CN 103747044 B CN103747044 B CN 103747044B
- Authority
- CN
- China
- Prior art keywords
- service
- znode
- server
- cloud platform
- zookeeper
- 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
Abstract
The invention discloses a service locking method and a system, and relates to the field of cloud platform service technology. the method comprises the following steps: S1: each server of a cloud platform is connected with a zookeeper service, and establishment of a temporary object znode in the zookeeper service is tried, wherein the value of znode is ip address of a corresponding server; S2: externally-supplied service is started on the server with successfully-established znode, and a mapping between the value of the successfully-established znode and a domain name corresponding to the service is established; and S3: when the service stops, the znode corresponding to the service dies out, and the step S1 is returned. With cooperation of each step, all servers in the cloud platform can be locked, and robustness of the cloud platform is raised effectively.
Description
Technical field
The present invention relates to cloud platform service technology field, more particularly to a kind of service lock method and system.
Background technology
Cloud computing has been considered as the IT tides of third time since PC and the Internet, it will change people obtain, process and
Protect stored mode.Cloud computing using high speed internet transmittability, by the processing procedure of data from personal computer or
Server is transferred to large-scale cloud computing center, and computing capability, storage capacity is provided the user in the way of servicing, user
Computing capability can be used as using public utilities such as electric power, tap waters, and charging is carried out by usage amount.
Due to locking to the service on this TV station server in cloud platform of the prior art, so can not limit
The startup serviced on other servers, during the server fail for providing service when certain, other servers cannot connect
Continue offer service for the server, cause access service inconvenient, and the vigorousness of cloud platform is inadequate.
The content of the invention
(One)The technical problem to be solved
The technical problem to be solved in the present invention is:How the vigorousness of cloud platform is greatly improved.
(Two)Technical scheme
To solve above-mentioned technical problem, the invention provides a kind of service lock method, the method comprising the steps of:
S1:Every server of cloud platform goes to connect zookeeper services, and attempts in zookeeper services
The value of one temporary object znode of middle establishment, the znode is the ip addresses of corresponding server;
S2:Start on the server for successfully create znode and service service is externally provided, and successfully create described
The value of znode domain name corresponding with the service service sets up mapping;
S3:After the service service cuts off, znode corresponding with the service service withers away, return to step
S1。
Wherein, also include before step S1:
S0:N platforms are selected to start zookeeper services in the M platform servers of the cloud platform, M is not less than N, the M
The integer not less than 1 is with N.
Wherein, the N is the odd number closest to M.
The invention also discloses a kind of service lock system, the system includes:
Temporary object creation module, every server for cloud platform goes to connect zookeeper services, and attempts
A temporary object znode is created in the zookeeper services, the value of the znode is the ip addresses of corresponding server;
Module is set up in mapping, externally provide service service for starting on the server for successfully create znode, and
The value for successfully creating znode domain name corresponding with the service service is set up into mapping;
Object extinction module, for after the service service cuts off, znode corresponding with the service service
Wither away.
Wherein, the system also includes:
Service starting module, for selecting N platforms to start zookeeper services in the M platform servers of the cloud platform,
M is not less than N, and the M and N is the integer not less than 1.
Wherein, the N is the odd number closest to M.
(Three)Beneficial effect
The present invention is by the cooperation between each step so that the Servers-all in cloud platform can be locked, effectively
Improve the vigorousness of cloud platform.
The present invention also using the fault-tolerant ability that zookeeper is good, makes cloud platform there has also been fault-tolerant ability
The present invention is also using the characteristic of zookeeper temporary objects, it is ensured that the reliability and promptness of unblock.
Description of the drawings
Fig. 1 is the FB(flow block) of the service lock method of one embodiment of the present invention;
Fig. 2 is the structured flowchart of the service lock system of one embodiment of the present invention.
Specific embodiment
With reference to the accompanying drawings and examples, the specific embodiment of the present invention is described in further detail.Hereinafter implement
Example is not limited to the scope of the present invention for illustrating the present invention.
Fig. 1 is the FB(flow block) of the service lock method of one embodiment of the present invention;With reference to Fig. 1, methods described includes
Following steps:
S1:Every server of cloud platform goes to connect zookeeper services, and attempts in zookeeper services
One temporary object znode of middle establishment(Such as/dns/service_A/IN/A/managed), the value of the znode is correspondence clothes
The ip addresses of business device;
In this step, different services has different znode, and the name of service is exactly the domain name for accessing, and identical takes
Business, this znode is identical, and only one of which can be created successfully, equivalent to lock, due to being required to start service, so
Only one server can successfully create the znode of this service, and this process is robbed in a distributed system equivalent to server
The process of lock.
S2:Start on the server for successfully create znode and service service is externally provided, and successfully create described
The value of znode domain name corresponding with the service service sets up mapping(When computer outside cloud platform accesses the domain name,
The value of znode is then directly resolved to, and because the value of znode is the ip addresses of corresponding server, so can directly access into
Work(creates the server of znode, because oneself registration when this domain name is service startup, service extinction time together disappears, so
The correctness of parsing domain name is ensure that, not there is a problem of synchronous dns servers);
S3:When the service service cuts off(The problems such as server fail, can cause service service to cut off)
Afterwards, znode corresponding with the service service withers away(The function that zookeeper temporary objects are realized, does not have equivalent to lock
Have, without having to worry about unblock problem), return to step S1 continues realization and robs lock flow process, continue to start service on other servers
service。
To ensure that server can smoothly connect zookeeper services, it is preferable that also include before step S1:
S0:N platforms are selected to start zookeeper services in the M platform servers of the cloud platform, M is not less than N, the M
The integer not less than 1 is with N.
To ensure fault-tolerant ability, it is preferable that the N is the odd number closest to M, why so selection be with
The fault tolerant mechanism of zookeeper is corresponding, i.e., have zookeeper services more than half normal in cloud platform on server,
Such as zookeeper just can normally provide service, there is 3 startup of server zookeeper services in cluster, and one services out
Existing problem, zookeeper services can be used normally;When there is 5 servers, 2 go wrong, and zookeeper is serviced just
Often.So such selection, can make having [(N+1)/ 2-1] when going wrong, zookeeper is still normally provided for service
Service, also just said [(N+1)/ 2-1] fault-tolerant ability.
The invention also discloses a kind of service lock system, with reference to Fig. 2, the system includes:
Temporary object creation module, every server for cloud platform goes to connect zookeeper services, and attempts
A temporary object znode is created in the zookeeper services, the value of the znode is the ip addresses of corresponding server;
Module is set up in mapping, externally provide service service for starting on the server for successfully create znode, and
The value for successfully creating znode domain name corresponding with the service service is set up into mapping;
Object extinction module, for after the service service cuts off, znode corresponding with the service service
Wither away.
Preferably, the system also includes:
Service starting module, for selecting N platforms to start zookeeper services in the M platform servers of the cloud platform,
M is not less than N, and the M and N is the integer not less than 1.
Preferably, the N is the odd number closest to M.
Embodiment of above is merely to illustrate the present invention, and not limitation of the present invention, about the common of technical field
Technical staff, without departing from the spirit and scope of the present invention, can also make a variety of changes and modification, therefore all
The technical scheme of equivalent falls within scope of the invention, and the scope of patent protection of the present invention should be defined by the claims.
Claims (6)
1. a kind of service lock method, it is characterised in that the method comprising the steps of:
S1:Every server of cloud platform goes to connect zookeeper services, and attempts being created in zookeeper services
A temporary object znode is built, the value of the znode is the ip addresses of corresponding server;
S2:Start on the server for successfully create znode and service service is externally provided, and znode is successfully created by described
Corresponding with the service service domain name of value set up mapping;
S3:After the service service cuts off, znode corresponding with the service service withers away, return to step S1.
2. the method for claim 1, it is characterised in that also include before step S1:
S0:N platforms are selected to start zookeeper services in the M platform servers of the cloud platform, M is not less than N, the M and N
It is the integer not less than 1.
3. method as claimed in claim 2, it is characterised in that the N is the odd number closest to M.
4. a kind of service lock system, it is characterised in that the system includes:
Temporary object creation module, every server for cloud platform goes to connect zookeeper services, and attempts described
A temporary object znode is created in zookeeper services, the value of the znode is the ip addresses of corresponding server;
Module is set up in mapping, externally provide service service for starting on the server for successfully create znode, and by institute
State the value domain name foundation mapping corresponding with the service service for successfully creating znode;
Object extinction module, for after the service service cuts off, znode corresponding with the service service to disappear
Die.
5. system as claimed in claim 4, it is characterised in that the system also includes:
Service starting module, for selecting N platforms to start zookeeper services in the M platform servers of the cloud platform, M is not
Less than N, the M and N is the integer not less than 1.
6. system as claimed in claim 5, it is characterised in that the N is the odd number closest to M.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310722587.2A CN103747044B (en) | 2013-12-24 | 2013-12-24 | Service locking method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310722587.2A CN103747044B (en) | 2013-12-24 | 2013-12-24 | Service locking method and system |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103747044A CN103747044A (en) | 2014-04-23 |
CN103747044B true CN103747044B (en) | 2017-04-19 |
Family
ID=50504031
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310722587.2A Active CN103747044B (en) | 2013-12-24 | 2013-12-24 | Service locking method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103747044B (en) |
Families Citing this family (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103997498B (en) * | 2014-05-27 | 2017-04-26 | 北京京东尚科信息技术有限公司 | Distributed lock service implementation method and component |
CN105049549B (en) * | 2015-08-07 | 2018-12-28 | 北京思特奇信息技术股份有限公司 | A kind of method and system for realizing floating IP address automatic drift |
CN106776156A (en) * | 2016-12-13 | 2017-05-31 | 东软集团股份有限公司 | A kind of service control method and device |
CN106648903B (en) * | 2017-01-03 | 2019-03-26 | 北京百度网讯科技有限公司 | The method and apparatus for calling distributed file system |
CN107086940B (en) * | 2017-03-31 | 2019-11-15 | 北京奇艺世纪科技有限公司 | A kind of list service operation method and device |
CN109729160A (en) * | 2018-12-20 | 2019-05-07 | 新华三大数据技术有限公司 | Implementation method, Thrift server node and the client of Thrift server service |
CN111143318B (en) * | 2019-12-24 | 2023-10-27 | 北京奇艺世纪科技有限公司 | Information processing method, device, electronic equipment and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102710554A (en) * | 2012-06-25 | 2012-10-03 | 深圳中兴网信科技有限公司 | Distributed message system and service status detection method thereof |
CN103188110A (en) * | 2013-03-29 | 2013-07-03 | 汉柏科技有限公司 | Zookeeper-based cloud platform service hot backup method |
CN103259863A (en) * | 2013-05-17 | 2013-08-21 | 汉柏科技有限公司 | System and method for controlling zookeeper services based on clusters |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20020143946A1 (en) * | 2001-03-28 | 2002-10-03 | Daniel Crosson | Software based internet protocol address selection method and system |
-
2013
- 2013-12-24 CN CN201310722587.2A patent/CN103747044B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102710554A (en) * | 2012-06-25 | 2012-10-03 | 深圳中兴网信科技有限公司 | Distributed message system and service status detection method thereof |
CN103188110A (en) * | 2013-03-29 | 2013-07-03 | 汉柏科技有限公司 | Zookeeper-based cloud platform service hot backup method |
CN103259863A (en) * | 2013-05-17 | 2013-08-21 | 汉柏科技有限公司 | System and method for controlling zookeeper services based on clusters |
Also Published As
Publication number | Publication date |
---|---|
CN103747044A (en) | 2014-04-23 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103747044B (en) | Service locking method and system | |
CN102769667B (en) | Method, equipment and system for generating ID | |
CN107181808B (en) | Private cloud system and operation method | |
CN106850260A (en) | A kind of dispositions method and device of virtual resources management platform | |
US8695079B1 (en) | Allocating shared resources | |
CN106034138B (en) | A kind of remote service calling method and device | |
CN108089912A (en) | A kind of virtual machine surpasses emerging system construction method and device with container | |
CN102437933A (en) | Fault tolerance system and method of server | |
CN112398936B (en) | Kubernetes-based multi-network card container implementation method and system | |
WO2019104974A1 (en) | Dubbo platform-based automatic server starting and stopping method , server, and storage medium | |
CN103188245A (en) | Fight game server system | |
CN107347062A (en) | A kind of method, electronic equipment and the readable storage medium storing program for executing of daily record data processing | |
CN102438278A (en) | Load allocation method and device for mobile communication network | |
EP3211531A1 (en) | Virtual machine start method and apparatus | |
CN104283970A (en) | Cloud computing service device and system and cloud computing method | |
CN105872121A (en) | Method for connecting terminal with server, terminal and domain name server | |
WO2015055102A1 (en) | Method and device for invoking network function | |
CN111858161A (en) | Disaster recovery method, device and equipment for cloud host and computer readable storage medium | |
CN114422350B (en) | Public cloud container instance creation method | |
CN111371880A (en) | Dialing cloud server capable of dynamically switching IP | |
CN104506368A (en) | Method and equipment for managing switchboard equipment in unified manner | |
CN111861384A (en) | Method, device and medium for designing multiple workflow engines | |
CN104469420A (en) | Service emergency method, device and system for interactive personality TV (IPTV) | |
CN109347743B (en) | Special line communication method, computer readable storage medium and terminal equipment | |
CN101783730B (en) | Terminal network device and method and system for controlling access to administrator account thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant | ||
PP01 | Preservation of patent right | ||
PP01 | Preservation of patent right |
Effective date of registration: 20180528 Granted publication date: 20170419 |
|
PP01 | Preservation of patent right | ||
PP01 | Preservation of patent right |
Effective date of registration: 20180823 Granted publication date: 20170419 |