CN108063808A - A kind of acquisition methods of business, device, storage medium and computer equipment - Google Patents

A kind of acquisition methods of business, device, storage medium and computer equipment Download PDF

Info

Publication number
CN108063808A
CN108063808A CN201711310252.4A CN201711310252A CN108063808A CN 108063808 A CN108063808 A CN 108063808A CN 201711310252 A CN201711310252 A CN 201711310252A CN 108063808 A CN108063808 A CN 108063808A
Authority
CN
China
Prior art keywords
server
business
sensing node
zookeeper
identification number
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.)
Pending
Application number
CN201711310252.4A
Other languages
Chinese (zh)
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.)
Qingdao Haier Technology Co Ltd
Haier Uplus Intelligent Technology Beijing Co Ltd
Original Assignee
Haier Uplus Intelligent Technology Beijing 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 Haier Uplus Intelligent Technology Beijing Co Ltd filed Critical Haier Uplus Intelligent Technology Beijing Co Ltd
Priority to CN201711310252.4A priority Critical patent/CN108063808A/en
Publication of CN108063808A publication Critical patent/CN108063808A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1044Group management mechanisms 
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1044Group management mechanisms 
    • H04L67/1046Joining mechanisms

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a kind of acquisition methods of business, device, storage medium and computer equipment, wherein, this method includes:Obtain the corresponding modulus value of intended service;Whether identical with local server identification number detect the corresponding server identification number of list number identical with modulus value in predetermined server list;In the case where server identification number is identical with local server identification number, intended service is obtained.The present invention is different by the business serial number of different business, calculate the corresponding modulus value of business serial number, and determine that intended service should actually belong to which server is handled according to modulus value, server is made only to need to obtain the intended service that oneself should be handled, be not in multiple tasks on different server while handle the situation of same business, solve in the prior art business upon execution, the problems such as the repetitive schedule or scheduling conflict of appearance.

Description

A kind of acquisition methods of business, device, storage medium and computer equipment
Technical field
The present invention relates to distributed application program coordination service ZooKeeper technologies, more particularly to a kind of obtaining for business Take method, apparatus, storage medium and computer equipment.
Background technology
ZooKeeper is distributed, open source code a distributed application program coordination service, is Google Google Mono- realization increased income of distributed file system Chubby, it is the manager of cluster, monitors each node shape in cluster The feedback that state is submitted according to node carries out next step reasonable operation, finally, interface and performance efficiency easy to use, function is steady Fixed system is supplied to user.
Fig. 1 is the data model structure schematic diagram of ZooKeeper, as shown in Figure 1, the structure of ZooKeeper data models It is similar with Unix file system, it can be regarded as one tree on the whole, each node is referred to as a ZNode, and each ZNode is deposited In its unique ID of trace route path, for example, in Fig. 1 third layer first ZNode, its path is /app1/c1.ZNode points are Conventional type node (Regular ZNode) and interim type node (Ephemeral ZNode), wherein, Regular ZNode can only It is created or is deleted by the explicit operation of user, Ephemeral Znode can be created by the explicit operation of user Build or delete or after creation, the session (Session) for creating the Ephemeral Znode terminates, by ZooKeeper into The deletion of row active.
When single server ability is inadequate, it is necessary to which more servers are extending transversely to carry out, and pass through more The division of labor of server, to realize stronger oncurrent processing ability, shorter response time.Multiple servers in the task of processing, It is present with same business to be called respectively by multiple and different servers, business is caused to repeat, user obtains reproducible results Situation;Or there is multiple tasks program and same business called to cause to conflict simultaneously, especially timed task when being handled, The situation of deadlock may be caused because of processing database same record.
For the problem when handling timed task, the distributed timing task framework that existing part is increased income can be with It is solved, but since its principle is complicated, encapsulation degree is higher, when timed task frame, the short time can not solve when something goes wrong Certainly, and the distributed timing task framework increased income provides more multi-functional, pursues versatility, but execution efficiency is relatively low, makes User but can not be to directly optimizing frame, it is necessary to very high cost.
The content of the invention
The present invention provides a kind of acquisition methods of business, device, storage medium and computer equipment, to solve existing skill In art business upon execution, the problems such as the repetitive schedule or scheduling conflict of appearance.
In order to solve the above technical problems, on the one hand, the present invention provides a kind of acquisition methods of business, including:It obtains predetermined The corresponding modulus value of business;Detect in predetermined server list the list number corresponding server identification number identical with modulus value whether with Local server identification number is identical;In the case where server identification number is identical with local server identification number, predetermined industry is obtained Business.
Further, the corresponding modulus value of intended service is obtained, including:Obtain the business serial number of intended service and current place In the quantity of the Servers-all of working condition;The quantity of business serial number and server is subjected to modulo operation, is determined predetermined The corresponding modulus value of business.
Further, before the quantity for obtaining the Servers-all for being currently at working condition, further include:Establish with The connection of ZooKeeper;The information for the server being connected with ZooKeeper is obtained, wherein, information includes at least server name With server identification number;Predetermined server list is established according to the quantity of information and the server being connected with ZooKeeper.
Further, after establishing predetermined server list according to the quantity of information and the server being connected with ZooKeeper, It further includes:Whether the quantity for detecting the server being connected with ZooKeeper changes;In the case where the quantity of server changes, Predetermined server list is changed according to the quantity of server after change.
Further, whether the quantity for the server that detection is connected with ZooKeeper changes, including:Detect ZooKeeper In whether there is sensing node;In the case of there are sensing node, child node is established under sensing node, wherein, child node Value be local server identification number;The state of sensing node is monitored, wherein, the state of sensing node includes:In sensing node Lower increase or deletion child node.
Further, detect in ZooKeeper with the presence or absence of after sensing node, further include:There is no sensing nodes In the case of, sensing node is created, and child node is established under sensing node.
On the other hand, the present invention also provides a kind of acquisition device of business, which is characterized in that including:First acquisition module, For obtaining the corresponding modulus value of intended service;Detection module, for detecting list identical with modulus value in predetermined server list Whether number corresponding server identification number is identical with local server identification number;Second acquisition module, in server identification In the case of number identical with local server identification number, intended service is obtained.
Further, the first acquisition module is specifically used for:It obtains the business serial number of intended service and is currently at work The quantity of the Servers-all of state;The quantity of business serial number and server is subjected to modulo operation, determines current business pair The modulus value answered.
Further, the first acquisition module is specifically used for:It establishes with distributed application program coordination service ZooKeeper's Connection;The information for the server being connected with ZooKeeper is obtained, wherein, information includes at least server name and server mark Knowledge number;Predetermined server list is established according to the quantity of information and the server being connected with ZooKeeper.
Further, the first acquisition module is specifically used for:Whether the quantity for detecting the server being connected with ZooKeeper changes Become;In the case where the quantity of server changes, predetermined server list is changed according to the quantity of server after change.
Further, the first acquisition module is specifically used for:It detects and whether there is sensing node in ZooKeeper;Feel existing In the case of knowing node, child node is established under sensing node, wherein, the value of child node is local server identification number;It monitors The state of sensing node, wherein, the state of sensing node includes:Increase under sensing node or delete child node.
Further, the first acquisition module is specifically used for:In the case of there is no sensing node, sensing node is created, and Child node is established under sensing node.
On the other hand, the present invention also provides a kind of storage medium, computer program is stored on storage medium, program is located Reason device realizes the acquisition methods of above-mentioned business when performing.
On the other hand, the present invention also provides a kind of computer equipments, which is characterized in that including memory, processor and deposits The computer program that can be run on a memory and on a processor is stored up, processor realizes obtaining for above-mentioned business when performing program Take method.
The present invention is different by the business serial number of different business, calculates the corresponding modulus value of business serial number, and according to Modulus value determines that intended service should actually belong to which server is handled, and server is made only to need to obtain oneself and should locate The intended service of reason is not in multiple tasks on different server while handles the situation of same business, solves existing There is in technology business upon execution, the problems such as the repetitive schedule or scheduling conflict of appearance.
Description of the drawings
Fig. 1 is the data model structure schematic diagram of ZooKeeper in the prior art of the invention;
Fig. 2 is the flow chart of the acquisition methods of business in first embodiment of the invention;
Fig. 3 is the structure diagram of the acquisition device of business in second embodiment of the invention.
Specific embodiment
In order to solve to solve in the prior art business upon execution, the problems such as the repetitive schedule or scheduling conflict of appearance, this Invention provides the acquisition methods and storage medium of a kind of business, below in conjunction with attached drawing and embodiment, to the present invention into traveling One step is described in detail.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, this hair is not limited It is bright.
The first embodiment of the present invention provides a kind of acquisition methods of business, and flow chart is as shown in Fig. 2, specifically include Step S201 to S203:
S201 determines the corresponding modulus value of intended service;
S202, detect in predetermined server list the list number corresponding server identification number identical with modulus value whether with from Body server identification number is identical;
S203 in the case where server identification number is identical with local server identification number, obtains intended service.
The subject of implementation of the business obtaining method provided in first embodiment of the invention is each server in cluster.Respectively The business serial number of a business is unique, and the business serial number of the subsequent next business of current business is the industry in current business Business serial number numerically adds 1, to ensure the continuous and unique of business serial number.
Server is when obtaining the corresponding modulus value of intended service, business serial number that can first by obtaining intended service And the quantity of the Servers-all of working condition is currently at, then by the business serial number of intended service and the number of server Amount carries out modulo operation, to determine the corresponding modulus value of intended service.Preferably due in the task of acquisition, in cluster each just The calculating of the corresponding modulus value of carry out business is required in the server of work, and the actual number of services obtained of server may be only Have the part in all business, therefore many unnecessary calculating can be caused, thus can also arrange one it is pre- for calculating Determine the computing device of the corresponding modulus value of business, the corresponding magnitude calculation of all business is responsible for by the computing device, server only needs The result of calculation of modulus value is directly acquired from the computing device, unnecessary calculating is eliminated, further improves industry The efficiency that business obtains.
Server obtains the business serial number of intended service in the corresponding modulus value of the definite intended service of needs itself, and And server can obtain the working condition of other servers in this cluster and be currently at the Servers-all of working condition Quantity.Modulo operation is then carried out to business serial number according to the quantitative value, i.e. business serial number is as dividend X, currently The quantitative value of in running order Servers-all is divisor Y, calculates maximum integer business and remainder, and the remainder is The value range of modulus value mod, mod are [0, N-1].Server obtains the predetermined server list preserved, is preserved in the list The server identification number of current all in running order servers, according to mod, obtain in predetermined server list with mod The corresponding server identification number of identical list number, and judge the server identification number and the server identification number of itself whether phase Together, when the server identification number is identical with the server identification number of itself, server determines that the intended service should be by certainly Oneself is handled, and is obtained the intended service and handled, and ensure that a business is only handled by a server, will not There are multiple servers while handle a business.
The present embodiment is different by the corresponding modulus value of business serial number of different business, and determines predetermined industry according to modulus value Which server pragmatic border, which should belong to, is handled, and server is made only to need to obtain the intended service that oneself should be handled, no It is present with multiple tasks on different server while handles the situation of same business, solves business in the prior art and holding During row, the problems such as the repetitive schedule or scheduling conflict of appearance.Also, the business obtaining method principle letter of the proposition of the present embodiment It is single, it can extend or optimize, autgmentability higher according to the different demands of user.
Server should start first before the quantity for the Servers-all for being currently at working condition obtain ZooKeeper simultaneously establishes the connection between server and ZooKeeper, and after successful connection, acquisition is currently connected with ZooKeeper Servers-all information, including at least the corresponding server identification number of server name and its of Servers-all, and root Predetermined server list is established according to the information of acquisition and the quantity for the server being connected with ZooKeeper, to Servers-all When identification number is arranged, can in order it be arranged or according to server according to the numerical values recited of server identification number The time order and function order that the corresponding server of identification number is connected to ZooKeeper is arranged.It will be appreciated that preset service The list number of device list is arranged since 0, and the corresponding content of each list number includes at least server identifier, can also include Other attributes on server that the title or system of server are set.Further, establish predetermined server list it Afterwards, whether the quantity of pair server being connected with ZooKeeper changes progress detection in real time or separated in time detection, In the case that the quantity of server changes, predetermined server list is changed according to the quantity of server after change.It is understood that It is the predetermined server list for having their own to create in the Servers-all being connected with ZooKeeper, and the row of list content Row rule is identical, ensures that Servers-all is identical according to the result that business serial number judges, is not in conflict.Such as:Institute Have in the predetermined server list of server, list number is that the corresponding contents of A are the server identification number that value is 0001, works as clothes During the mod=A that business device calculates, which is obtained by the server that server identification number is 0001 and is handled.
In the present embodiment, server is by detecting the child node number under sensing node present in ZooKeeper, really The quantity of the fixed server being connected with ZooKeeper.After server is connected with ZooKeeper, detects and whether deposited in ZooKeeper In sensing node, if there are sensing node, created under the sensing node can with the child node of representative server itself, In, the value of child node is local server identification number;If there is no sensing node, creating one, routinely node is perceptually Node, name can be/timer, and establish after creation under/timer can with the child node of representative server itself, In, the value of child node is similarly local server identification number;After establishing child node, the state of sensing node, sensing node are monitored State include:Increase under sensing node or delete child node, when the state of sensing node changes, ZooKeeper To server sending node Status Change message, message includes the specific situation of change of sensing node state, such as increases son section During point, the information such as title, value of increased child node, which child node delete is during deletion child node, the value of the child node It is how many, server to be facilitated to change the content of predetermined server list in real time.Also, working as can be with processing business When number of servers changes, the specific business and number of services of other server process can also change, and pass through The establishment of sensing node and the monitoring to sensing node, the ability that server is made to possess dynamic capacity-expanding make entire distribution System work is more flexible.Preferably, the number for the server that computing device determines to be connected with ZooKeeper also by sensing node Amount, but computing device can not establish child node under sensing node, and it can only monitor the state of sensing node, to obtain calculating mould It is worth corresponding information.
The second embodiment of the present invention provides a kind of acquisition device of business, and structure diagram is as shown in figure 3, main Including:First acquisition module 301,302 and second acquisition module 303 of detection module, wherein, the first acquisition module 301 is used for Obtain the corresponding modulus value of intended service;Detection module 302 is used to detect list number identical with modulus value in predetermined server list Whether corresponding server identification number is identical with local server identification number;Second acquisition module 303 is used in server identification In the case of number identical with local server identification number, intended service is obtained.
On each server of the installation of the business acquisition device provided in second embodiment of the invention in the cluster.It is each The business serial number of business is unique, and the business serial number of the subsequent next business of current business is the business in current business Serial number numerically adds 1, to ensure the continuous and unique of business serial number.
Acquisition device can be obtained pre- in the corresponding modulus value of acquisition intended service by the first acquisition module 301 first The quantity of the business serial number for determining business and the Servers-all for being currently at working condition, then by the business of intended service The quantity of serial number and server carries out modulo operation, to determine the corresponding modulus value of intended service.Preferably due to appoint obtaining During business, each server to work is required for the calculating of the corresponding modulus value of carry out business in cluster, and server is actual obtains The number of services taken may only have the part in all business, therefore can cause many unnecessary calculating, so can be with Arrangement one is responsible for the corresponding mould of all business for calculating the computing device of the corresponding modulus value of intended service by the computing device Value calculates, and acquisition device only needs to directly acquire the result of calculation of modulus value from the computing device by the first acquisition module 301 , unnecessary calculating is eliminated, further improves the efficiency of business acquisition.
First acquisition module 301 obtains the business of intended service in the corresponding modulus value of the definite intended service of needs itself Serial number, and the first acquisition module 301 can obtain the working condition of other servers in this cluster and be currently at work Make the quantity of the Servers-all of state.Modulo operation, i.e. business flowing water are then carried out to business serial number according to the quantitative value Number be used as dividend X, be currently at the quantitative value of Servers-all of working condition as divisor Y, calculate maximum integer business with And remainder, and the remainder is modulus value mod, the value range of mod is [0, N-1].Detection module 302 obtains the default of preservation Server list preserves the server identification number of current all in running order servers in the list, according to mod, The corresponding server identification number of list number identical with mod in predetermined server list is obtained, and judges the server identification number It is whether identical with the server identification number of itself, when the server identification number is identical with the server identification number of itself, detection Module 302 determines that the intended service should be handled by oneself, and passes through the second acquisition module 303 and obtain the intended service It is handled, ensure that a business is only handled by a server, there is no multiple servers to handle one simultaneously The situation of business.
The present embodiment is different by the corresponding modulus value of business serial number of different business, and determines predetermined industry according to modulus value Which server pragmatic border, which should belong to, is handled, and server is made only to need to obtain the intended service that oneself should be handled, no It is present with multiple tasks on different server while handles the situation of same business, solves business in the prior art and holding During row, the problems such as the repetitive schedule or scheduling conflict of appearance.Also, the business obtaining method principle letter of the proposition of the present embodiment It is single, it can extend or optimize, autgmentability higher according to the different demands of user.
First acquisition module 301 is before the quantity for the Servers-all for being currently at working condition obtain, first ZooKeeper should be started and establish the connection between server and ZooKeeper, after successful connection, obtain currently with The information of the Servers-all of ZooKeeper connections can include server name service corresponding with its of Servers-all Device identification number, and predetermined server list is established according to the information of acquisition and the quantity for the server being connected with ZooKeeper, When arranging Servers-all identification number, can in order be arranged according to the numerical values recited of server identification number or The time order and function order that person is connected to ZooKeeper according to the corresponding server of server identification number is arranged.It is understood that , the list number of predetermined server list arranges since 0, and the corresponding content of each list number is identified including at least server Number, other attributes on server that the title of server or system are set can also be included.Further, establishing in advance If after server list, whether the quantity of pair server being connected with ZooKeeper, which changes progress, is detected or is spaced in real time Certain time detects, and in the case where the quantity of server changes, predetermined server is changed according to the quantity of server after change List.It will be appreciated that the predetermined server row for thering is their own to create in the Servers-all being connected with ZooKeeper Table, and the queueing discipline of list content is identical, ensures that Servers-all is identical according to the result that business serial number judges, will not go out Now conflict.Such as:In the predetermined server list of Servers-all, list number is that the corresponding contents of A are that value is 0001 As the mod=A that server calculates, the business is obtained by the server that server identification number is 0001 for server identification number It is handled.
In the present embodiment, the first acquisition module 301 is saved by the son detected under sensing node present in ZooKeeper Point number determines the quantity for the server being connected with ZooKeeper.After server is connected with ZooKeeper, detection With the presence or absence of sensing node in ZooKeeper, if there are sensing nodes, being created under the sensing node can be with representative server The child node of itself, wherein, the value of child node is local server identification number;If there is no sensing nodes, one is created often Rule property node perceptually node, name can be/timer, and established under/timer can represent service after creation The child node of device itself, wherein, the value of child node is similarly local server identification number;After establishing child node, monitor and perceive section The state of point, the state of sensing node include:Increase under sensing node or delete child node, when the state of sensing node occurs During variation, ZooKeeper includes the specific variation of sensing node state to server sending node Status Change message, message Situation, when such as increasing child node, the information such as title, value of increased child node, which sub- section delete is during deletion child node Point, the value of the child node is how many, server to be facilitated to change the content of predetermined server list in real time.Also, When can be changed with the number of servers of processing business, the specific business and number of services of other server process It can change, the establishment by sensing node and the monitoring to sensing node make server possess the energy of dynamic capacity-expanding Power makes entire distributed system work more flexible.Preferably, computing device determines to connect with ZooKeeper also by sensing node The quantity of the server connect, but computing device can not establish child node under sensing node, and it can only monitor the shape of sensing node State calculates the corresponding information of modulus value to obtain.
Through the above description of the embodiments, those skilled in the art can be understood that according to above-mentioned implementation The method of example can add the mode of required general hardware platform to realize by software, naturally it is also possible to by hardware, but it is very much In the case of the former be more preferably embodiment.Based on such understanding, technical scheme is substantially in other words to existing The part that technology contributes can be embodied in the form of software product, which is stored in a storage In medium (such as ROM/RAM, magnetic disc, CD), used including some instructions so that a station terminal equipment (can be mobile phone, calculate Machine, server or network equipment etc.) method that performs each embodiment of the present invention.
The third embodiment of the present invention additionally provides a kind of storage medium, is stored with computer program.Optionally, in this reality It applies in example, following steps is realized when computer program is executed by processor:
S31 determines the corresponding modulus value of intended service;
S32, detect in predetermined server list the list number corresponding server identification number identical with modulus value whether with from Body server identification number is identical;
S33 in the case where server identification number is identical with local server identification number, obtains intended service.
On each server of the storage medium installation provided in third embodiment of the invention in the cluster.Each business Business serial number is unique, and the business serial number of the subsequent next business of current business is the business serial number in current business Numerically plus 1, to ensure the continuous and unique of business serial number.
Optionally, computer program is specific real when being executed by processor the step of the corresponding modulus value of definite intended service Existing following steps:The quantity of the business serial number for obtaining intended service and the Servers-all for being currently at working condition;It will The quantity of business serial number and server carries out modulo operation, determines the corresponding modulus value of intended service.Preferably due to it is obtaining During task, each server to work is required for the calculating of the corresponding modulus value of carry out business in cluster, and server is actual The number of services of acquisition may only have the part in all business, therefore can cause many unnecessary calculating, so may be used also With one computing device for being used to calculate the corresponding modulus value of intended service of arrangement, it is corresponding that all business are responsible for by the computing device Magnitude calculation, server are only needed to directly acquire the result of calculation of modulus value from the computing device, eliminated unnecessary It calculates, further improves the efficiency of business acquisition.
Computer program be executed by processor obtain be currently at working condition Servers-all quantity the step of Before, following steps are also executed by processor:Establish the connection with ZooKeeper;Obtain the service being connected with ZooKeeper The information of device, wherein, information includes at least server name and server identification number;It is connected according to information and with ZooKeeper The quantity of server establish predetermined server list.Further, computer program be executed by processor according to information and with The quantity of the server of ZooKeeper connections is established after predetermined server list, is also executed by processor following steps:Detection Whether the quantity for the server being connected with ZooKeeper changes;In the case where the quantity of server changes, according to being taken after change The quantity modification predetermined server list of business device.
It will be appreciated that computer program is being executed by processor the number for the server that detection is connected with ZooKeeper When measuring the step whether changed, step is implemented as follows:It detects and whether there is sensing node in ZooKeeper;Feel existing In the case of knowing node, child node is established under sensing node, wherein, the value of child node is local server identification number;It monitors The state of sensing node, wherein, the state of sensing node includes:Increase under sensing node or delete child node.Preferably, count Calculation machine program is also executed by processor following after being executed by processor in detection ZooKeeper with the presence or absence of sensing node Step:In the case of there is no sensing node, sensing node is created, and child node is established under sensing node.
The present embodiment is different by the corresponding modulus value of business serial number of different business, and determines predetermined industry according to modulus value Which server pragmatic border, which should belong to, is handled, and server is made only to need to obtain the intended service that oneself should be handled, no It is present with multiple tasks on different server while handles the situation of same business, solves business in the prior art and holding During row, the problems such as the repetitive schedule or scheduling conflict of appearance.Also, the business obtaining method principle letter of the proposition of the present embodiment It is single, it can extend or optimize, autgmentability higher according to the different demands of user.
Optionally, in the present embodiment, above-mentioned storage medium can include but is not limited to:USB flash disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disc or The various media that can store program code such as CD.Optionally, in the present embodiment, processor has been deposited according in storage medium The program code of storage performs the method and step of above-described embodiment record.Optionally, the specific example in the present embodiment may be referred to Example described in above-described embodiment and optional embodiment, details are not described herein for the present embodiment.Obviously, the technology of this field Personnel should be understood that each module of the above-mentioned present invention or each step can be realized with general computing device, they can be with It concentrates on single computing device or is distributed on the network that multiple computing devices are formed, optionally, they can be used The program code that computing device can perform is realized, it is thus possible to be stored in storage device by computing device to hold Row, and in some cases, it can be with the steps shown or described are performed in an order that is different from the one herein or divides them Each integrated circuit modules are not fabricated to or multiple modules in them or step are fabricated to single integrated circuit module It realizes.It to be combined in this way, the present invention is not limited to any specific hardware and softwares.
Fourth embodiment of the invention provides a kind of computer equipment, including memory, processor and is stored in memory Computer program that is upper and can running on a processor, realizes what is provided in first embodiment of the invention when processor performs program Business obtaining method, in this not go into detail, and it realizes process.
Although for example purpose, the preferred embodiment of the present invention is had been disclosed for, those skilled in the art will recognize Various improvement, increase and substitution are also possible, and therefore, the scope of the present invention should be not limited to above-described embodiment.

Claims (14)

1. a kind of acquisition methods of business, which is characterized in that including:
Determine the corresponding modulus value of intended service;
Detect whether the corresponding server identification number of list number identical with the modulus value in predetermined server list takes with itself Business device identification number is identical;
In the case where the server identification number is identical with the local server identification number, the intended service is obtained.
2. acquisition methods as described in claim 1, which is characterized in that the corresponding modulus value of intended service is obtained, including:
The quantity of the business serial number for obtaining the intended service and the Servers-all for being currently at working condition;
The quantity of the business serial number and the server is subjected to modulo operation, determines the corresponding mould of the intended service Value.
3. acquisition methods as claimed in claim 2, which is characterized in that acquisition is currently at the Servers-all of working condition Before quantity, further include:
Establish the connection with distributed application program coordination service ZooKeeper;
The information for the server being connected with ZooKeeper is obtained, wherein, described information includes at least server name and server Identification number;
The predetermined server list is established according to described information and with the quantity of the ZooKeeper servers being connected.
4. acquisition methods as claimed in claim 3, which is characterized in that be connected according to described information and with the ZooKeeper The quantity of server establish after predetermined server list, further include:
Whether detection changes with the quantity of the ZooKeeper servers being connected;
In the case where the quantity of the server changes, the predetermined server is changed according to the quantity of server after change and is arranged Table.
5. acquisition methods as claimed in claim 4, which is characterized in that detection and the ZooKeeper servers being connected Whether quantity changes, including:
It detects and whether there is sensing node in the ZooKeeper;
In the case of there are the sensing node, child node is established under the sensing node, wherein, the value of the child node For the local server identification number;
The state of the sensing node is monitored, wherein, the state of the sensing node includes:Under the sensing node increase or Delete child node.
6. acquisition methods as claimed in claim 7, which is characterized in that detect in the ZooKeeper with the presence or absence of perception section After point, further include:
In the case of there is no the sensing node, sensing node is created, and son section is established under the sensing node Point.
7. a kind of acquisition device of business, which is characterized in that including:
First acquisition module, for obtaining the corresponding modulus value of intended service;
Detection module, for detecting the corresponding server identification number of list number identical with the modulus value in predetermined server list It is whether identical with local server identification number;
Second acquisition module, in the case where the server identification number is identical with the local server identification number, obtaining Take the intended service.
8. acquisition device as claimed in claim 7, which is characterized in that first acquisition module is specifically used for:
The quantity of the business serial number for obtaining the intended service and the Servers-all for being currently at working condition;
The quantity of the business serial number and the server is subjected to modulo operation, determines the corresponding mould of the current business Value.
9. acquisition device as claimed in claim 8, which is characterized in that first acquisition module is specifically used for:
Establish the connection with distributed application program coordination service ZooKeeper;
The information for the server being connected with ZooKeeper is obtained, wherein, described information includes at least server name and server Identification number;
The predetermined server list is established according to described information and with the quantity of the ZooKeeper servers being connected.
10. acquisition device as claimed in claim 9, which is characterized in that first acquisition module is specifically used for:
Whether detection changes with the quantity of the ZooKeeper servers being connected;
In the case where the quantity of the server changes, the predetermined server is changed according to the quantity of server after change and is arranged Table.
11. acquisition device as claimed in claim 10, which is characterized in that first acquisition module is specifically used for:
It detects and whether there is sensing node in the ZooKeeper;
In the case of there are the sensing node, child node is established under the sensing node, wherein, the value of the child node For the local server identification number;
The state of the sensing node is monitored, wherein, the state of the sensing node includes:Under the sensing node increase or Delete child node.
12. acquisition device as claimed in claim 10, which is characterized in that first acquisition module is specifically used for:
In the case of there is no the sensing node, sensing node is created, and son section is established under the sensing node Point.
13. a kind of storage medium, computer program is stored on the storage medium, is realized when described program is executed by processor In claim 1 to 6 the step of any one the method.
14. a kind of computer equipment, which is characterized in that including memory, processor and be stored on the memory and can be The computer program run on the processor, the processor are realized any one in claim 1 to 6 when performing described program The step of item the method.
CN201711310252.4A 2017-12-11 2017-12-11 A kind of acquisition methods of business, device, storage medium and computer equipment Pending CN108063808A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711310252.4A CN108063808A (en) 2017-12-11 2017-12-11 A kind of acquisition methods of business, device, storage medium and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711310252.4A CN108063808A (en) 2017-12-11 2017-12-11 A kind of acquisition methods of business, device, storage medium and computer equipment

Publications (1)

Publication Number Publication Date
CN108063808A true CN108063808A (en) 2018-05-22

Family

ID=62136344

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711310252.4A Pending CN108063808A (en) 2017-12-11 2017-12-11 A kind of acquisition methods of business, device, storage medium and computer equipment

Country Status (1)

Country Link
CN (1) CN108063808A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109039803A (en) * 2018-07-10 2018-12-18 武汉斗鱼网络科技有限公司 A kind of method, system and the computer equipment of processing readjustment notification message
CN111475291A (en) * 2020-03-27 2020-07-31 深圳市梦网科技发展有限公司 Data processing method, system, server and medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6324570B1 (en) * 1997-02-25 2001-11-27 E-Parcel, Llc Prioritized delivery and content auto select system
CN102571699A (en) * 2010-12-20 2012-07-11 中兴通讯股份有限公司 Method for selecting application server in application server pool and device adopting same
CN103581273A (en) * 2012-08-08 2014-02-12 阿里巴巴集团控股有限公司 Service executing method, device and system for distributed system
CN104092650A (en) * 2013-12-04 2014-10-08 腾讯数码(天津)有限公司 Service distributing request method and device
CN106980669A (en) * 2017-03-23 2017-07-25 珠海格力电器股份有限公司 A kind of storage of data, acquisition methods and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6324570B1 (en) * 1997-02-25 2001-11-27 E-Parcel, Llc Prioritized delivery and content auto select system
CN102571699A (en) * 2010-12-20 2012-07-11 中兴通讯股份有限公司 Method for selecting application server in application server pool and device adopting same
CN103581273A (en) * 2012-08-08 2014-02-12 阿里巴巴集团控股有限公司 Service executing method, device and system for distributed system
CN104092650A (en) * 2013-12-04 2014-10-08 腾讯数码(天津)有限公司 Service distributing request method and device
CN106980669A (en) * 2017-03-23 2017-07-25 珠海格力电器股份有限公司 A kind of storage of data, acquisition methods and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109039803A (en) * 2018-07-10 2018-12-18 武汉斗鱼网络科技有限公司 A kind of method, system and the computer equipment of processing readjustment notification message
CN111475291A (en) * 2020-03-27 2020-07-31 深圳市梦网科技发展有限公司 Data processing method, system, server and medium

Similar Documents

Publication Publication Date Title
CN109597685A (en) Method for allocating tasks, device and server
CN105979007A (en) Acceleration resource processing method and device and network function virtualization system
CN106936659B (en) Public cloud dial testing method and device
CN111082960B (en) Data processing method and device
CN104408640B (en) Application software recommends method and device
CN108259200B (en) A kind of physical network function PNF moving method and relevant device
CN103716356B (en) Storing process operating method, device and system based on web
CN111092752B (en) Fault positioning method and device spanning multiple network slices
CN109189758B (en) Operation and maintenance flow design method, device and equipment, operation method, device and host
US20150019722A1 (en) Determining, managing and deploying an application topology in a virtual environment
CN106874189A (en) A kind of implementation method of the automatization test system of real-time data of power grid storehouse system
CN105743946A (en) Template disposition method and apparatus
CN108063808A (en) A kind of acquisition methods of business, device, storage medium and computer equipment
CN109582418A (en) User behavior data collection method, device, computer installation, storage medium
CN107526636B (en) Resource identification method and device
CN107852422A (en) Connected from the server interface with different API to obtain ad data
CN103581273B (en) A kind of distributed system performs method, the apparatus and system of business
CN104182348B (en) Software test method and device
CN112044061B (en) Game picture processing method and device, electronic equipment and storage medium
CN110995856B (en) Method, device and equipment for server expansion and storage medium
CN112131010A (en) Server layout method and device, computer equipment and storage medium
CN112433908A (en) Method, system, device and medium for determining interval time of detection server
CN107577822A (en) A kind of method of data synchronization, data synchronization unit and mobile terminal
CN109582829A (en) A kind of processing method, device, equipment and readable storage medium storing program for executing
CN106911634A (en) A kind of login method and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20191231

Address after: 100086, room 601-606, room 6, Pacific International Building, No. 106, Haidian District, Beijing, Zhichun Road

Applicant after: Haier Youjia Intelligent Technology (Beijing) Co., Ltd.

Applicant after: Qingdao Haier Science and Technology Co., Ltd.

Address before: 100086, room 601-606, room 6, Pacific International Building, No. 106, Haidian District, Beijing, Zhichun Road

Applicant before: Haier Youjia Intelligent Technology (Beijing) Co., Ltd.

TA01 Transfer of patent application right
RJ01 Rejection of invention patent application after publication

Application publication date: 20180522

RJ01 Rejection of invention patent application after publication