CN109218349A - A kind of method and device of management server cluster - Google Patents

A kind of method and device of management server cluster Download PDF

Info

Publication number
CN109218349A
CN109218349A CN201710520921.4A CN201710520921A CN109218349A CN 109218349 A CN109218349 A CN 109218349A CN 201710520921 A CN201710520921 A CN 201710520921A CN 109218349 A CN109218349 A CN 109218349A
Authority
CN
China
Prior art keywords
server
cluster
starting
server cluster
primary
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
CN201710520921.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.)
Beijing Micro Shadow Era Technology Co Ltd
Original Assignee
Beijing Micro Shadow Era Technology 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 Beijing Micro Shadow Era Technology Co Ltd filed Critical Beijing Micro Shadow Era Technology Co Ltd
Priority to CN201710520921.4A priority Critical patent/CN109218349A/en
Publication of CN109218349A publication Critical patent/CN109218349A/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
    • 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/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • 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/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1029Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers using data related to the state of servers by a load balancer
    • 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/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1031Controlling of the operation of servers by a load balancer, e.g. adding or removing servers that serve requests

Abstract

The embodiment of the present invention discloses a kind of method and device of management server cluster, is related to cluster management technology, is capable of the resource utilization of server cluster.The method of the management server cluster includes: the local data base of the server based on distributed push strategy of synchronous averaging after triggering starting is based on the server of distributed push strategy;Whether the server based on distributed push strategy of detection starting is primary server in subordinate server cluster, if the server based on distributed push strategy of starting is primary server, it is provided out service by the synchronous local data base, starting there are multiple primary servers in the server cluster;Pre-set monitoring process is opened, monitors the connection status of other servers in the server cluster, and the connection status obtained according to monitoring updates the corresponding server list of the connection status.The present invention is suitable for being managed the multiple servers using distributed push strategy.

Description

A kind of method and device of management server cluster
Technical field
The present invention relates to cluster management technology more particularly to a kind of method and devices of management server cluster.
Background technique
With the continuous development of computer technology and Internet communication technology, so that the content that internet page provides is got over Come it is abundanter, due in a browser pass through hypertext transfer protocol (HTTP, Hyper Text Transfer Protocol) It is only able to achieve unidirectional communication, quasi real time interacts, needs so that browser needs constantly to issue request to server to be just able to achieve More bandwidth resources are occupied, and as client (browser) is higher and higher to the requirement of real-time of server, cause HTTP mode is no longer satisfied the real-time demand of user in certain application scenarios.In order to promote the real-time body of user It tests, proposes the distributed Push Service based on WebSocket technology, wherein WebSocket is the agreement based on HTML5, energy The full-duplex communication (full-duplex) for enough realizing browser and server, sends to server without browser and requests, Server can actively to browser Push Service, suitable for the business function that all kinds of needs push in real time, such as: chatroom, Page notice, in real time bulletin, dynamic seating plan etc..
Currently, in order to promote the reliability of the server of real-time Push Service, the more clothes based on distributed push strategy Business device forms a server cluster, and is managed to server each in server cluster, i.e., in server cluster, setting packet Containing main (master) server and one or more from (slave) server, primary server is provided out service, from clothes It is engaged in the operating status of device monitoring primary server, and keeps data synchronous with primary server, monitoring that primary server is abnormal Afterwards, according to pre-set election strategy, the primary server being abnormal is taken in election one from server, and is responsible for being provided out Service.
But the method for the management server cluster server, one or more backup from server as primary server Server, only when main service is abnormal, just election one is from server adapter tube primary server, so that from the resource of server It cannot efficiently use, cause the resource utilization of server cluster lower;Further, clothes are provided out by primary server Business, service request is more or need Push Service quantity of explorer it is more in the case where, may result in primary server Response speed or pushing speed are slack-off, to reduce the efficiency of service of primary server.
Summary of the invention
In view of this, the embodiment of the present invention provides a kind of method and device of management server cluster, it is able to ascend service The resource utilization of device cluster, to solve in the existing method based on the distributed management server cluster for pushing strategy, from clothes The lower problem of the resource utilization of server cluster caused by the resource of business device cannot efficiently use.
In a first aspect, the embodiment of the present invention provides a kind of method of management server cluster, comprising:
After triggering starting is based on the server of distribution push strategy, the described of synchronous averaging pushes plan based on distributed The local data base of server slightly;
Whether the server based on distributed push strategy of detection starting is main clothes in subordinate server cluster Business device passes through the synchronous local data if the server based on distributed push strategy of starting is primary server Library is provided out service, and starting has multiple primary servers in the server cluster;
Pre-set monitoring process in the server based on distributed push strategy of starting is opened, described in monitoring The connection status of other servers in server cluster in addition to the server for pushing strategy described in starting based on distribution, And the connection status obtained according to monitoring updates the corresponding server list of the connection status.
With reference to first aspect, in the first embodiment of first aspect, the described of the synchronous averaging is based on distribution The local data base of server of formula push strategy includes:
Its in addition to building and the server in subordinate server cluster based on distributed push strategy described in the starting The TCP long connection for the server that it runs;
The database update message in the server cluster is received by the TCP long connection, according to the database Update message updates local data base.
With reference to first aspect, in second of embodiment of first aspect, distribution is based in triggering starting described After pushing after the server of strategy, the local data base of the server based on distributed push strategy of synchronous averaging it Before, the method also includes:
Judge whether to be registered to server cluster, be pushed away if so, executing the described of the synchronous averaging based on distribution The step of sending the local data base of the server of strategy;If it is not, any primary server is sent into the server cluster Addition is requested, if addition request executes the described of the synchronous averaging and push strategy based on distribution by certification The step of local data base of server.
Second of embodiment with reference to first aspect, it is described to described in the third embodiment of first aspect Any primary server, which is sent, in server cluster is added request, if addition request includes: by certification
Primary server, which receives, is added request, after request certification is added and passes through, will send the server info that request is added It is added in the server list in local data base, the server list for adding server info is carried, request is being added In, it is back to the server for sending and request being added, the server info that request is added will be sent and be encapsulated as database update message, It is broadcasted in the server cluster.
With reference to first aspect, the first of first aspect any embodiment into the third, the of first aspect In four kinds of embodiments, it is described detect whether include: for the primary server in subordinate server cluster
According to the server list in the local data base synchronized, detect whether as the main clothes in subordinate server cluster Business device.
With reference to first aspect, the first of first aspect any embodiment into the third, the of first aspect In five kinds of embodiments, the connection status of other servers in the monitoring server cluster, and obtained according to monitoring Connection status updates the corresponding server list of the connection status
Ping request is sent according to other servers of pre-set heart beat cycle into the server cluster;
It, will not if not receiving the ping request response of server return in pre-set heartbeat detection time threshold The server for returning to ping request response is deleted from the server list, obtains updating server list;
The update server list is pushed to each server for including in the update server list.
The 5th kind of embodiment with reference to first aspect, in the 6th kind of embodiment of first aspect, if described After the ping request response for not receiving server return in pre-set heartbeat detection time threshold, ping will not be returned Request the server of response before deleting in the server list, the method also includes:
Ping request is successively sent to the server for not returning to ping request response, if in pre-set heartbeat detection The number for not receiving ping request response in time threshold reaches pre-set heartbeat detection frequency threshold value, and execution is described will not Return to the step of server that ping request responds is deleted from the server list.
With reference to first aspect, the first of first aspect any embodiment into the third, the of first aspect In seven kinds of embodiments, the method also includes:
If detecting itself as the slave server in subordinate server cluster, according to the pre-set update cycle, from The synchronous local data base of the primary server of normal operation, and after monitoring that primary server is abnormal, utilization is pre-set Election strategy election one substitutes the primary server being abnormal from server.
Second aspect, the embodiment of the present invention provide a kind of device of management server cluster, comprising: synchronization module, detection Module and process monitoring module, wherein
Synchronization module, after starting the server for pushing strategy based on distribution in triggering, the base of synchronous averaging In the local data base of the server of distributed push strategy;
Detection module pushes whether tactful server is subordinate server based on distributed described in starting for detecting Primary server in cluster, if the server based on distributed push strategy of starting is primary server, by synchronous The local data base is provided out service, and starting has multiple primary servers in the server cluster;
Process monitoring module, it is pre-set in the server based on distributed push strategy described in starting for opening Monitoring process monitors other in the server cluster in addition to the server for pushing strategy described in starting based on distribution The connection status of server, and the connection status obtained according to monitoring updates the corresponding server list of the connection status.
In conjunction with second aspect, in the first embodiment of second aspect, the synchronization module include: start unit, Connection unit and synchronization unit, wherein
Start unit, for notifying link unit after triggering starting is based on the server of distributed push strategy;
Connection unit, for constructing and removing the clothes based on distributed push strategy described in starting in subordinate server cluster The TCP long connection of the server of other operations except business device;
Synchronization unit, for receiving the database update message in the server cluster by the TCP long connection, according to Local data base is updated according to the database update message.
The method and device of a kind of management server cluster provided in an embodiment of the present invention, by being based on dividing in triggering starting After the server of cloth push strategy, the local data base of the server based on distributed push strategy of synchronous averaging; Whether the server based on distributed push strategy of detection starting is primary server in subordinate server cluster, if opening The dynamic server based on distributed push strategy is primary server, is provided out by the synchronous local data base It services, starting has multiple primary servers in the server cluster;Open the clothes based on distributed push strategy of starting It is engaged in pre-set monitoring process in device, monitors described based on distributed push strategy except starting in the server cluster The connection status of other servers except server, and the connection status obtained according to monitoring updates the connection status and corresponds to Server list, be provided out service due to can star more primary servers, carry out database between more primary servers It is synchronous, it is able to ascend the resource utilization of server cluster, to solve the existing management server based on distributed push strategy In the method for cluster, the resource utilization that cannot efficiently use caused server cluster from the resource of server is lower to be asked Topic.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with Other attached drawings are obtained according to these attached drawings.
Fig. 1 is the method flow schematic diagram of one management server cluster of the embodiment of the present invention;
Fig. 2 is the method flow schematic diagram of two management server cluster of the embodiment of the present invention;
Fig. 3 is the apparatus structure schematic diagram of the embodiment of the present invention san management server cluster.
Specific embodiment
The embodiment of the present invention is described in detail with reference to the accompanying drawing.
It will be appreciated that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.Base Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts it is all its Its embodiment, shall fall within the protection scope of the present invention.
Fig. 1 is the method flow schematic diagram of one management server cluster of the embodiment of the present invention, as shown in Figure 1, this implementation Example method may include:
Step 101, after triggering server of the starting based on distributed push strategy, the described of synchronous averaging is based on distribution The local data base of the server of formula push strategy;
In the present embodiment, as an alternative embodiment, the server based on distributed push strategy of synchronous averaging Local data base include:
Its in addition to building and the server in subordinate server cluster based on distributed push strategy described in the starting The TCP long connection for the server that it runs;
The database update message in the server cluster is received by the TCP long connection, according to the database Update message updates local data base.
In the present embodiment, as an alternative embodiment, between each server in server cluster (master server with Between master server, master server and between server, from server and between server) communication protocol Using TCP long connection, the data type of communication may make communication using the communication mode of the data type for binary format When data packet it is smaller, faster, communication efficiency is higher for communication speed.
In the present embodiment, as an alternative embodiment, database is located at server local, passes through between multiple servers TCP long connection type group builds up a distributed database, is stored with identical data backup in each database, can be effective Promote the high efficiency of inquiry.
In the present embodiment, as an alternative embodiment, described in service of the triggering starting based on distributed push strategy After after device, before the local data base of the server based on distributed push strategy of synchronous averaging, this method is also wrapped It includes:
Judge whether to be registered to server cluster, be pushed away if so, executing the described of the synchronous averaging based on distribution The step of sending the local data base of the server of strategy;If it is not, any primary server is sent into the server cluster Addition is requested, if addition request executes the described of the synchronous averaging and push strategy based on distribution by certification The step of local data base of server.
In the present embodiment, as an alternative embodiment, into the server cluster, any primary server sends to be added and ask It asks, if addition request includes: by certification
Primary server, which receives, is added request, after request certification is added and passes through, will send the server info that request is added It is added in the server list in local data base, the server list for adding server info is carried, request is being added In, it is back to the server for sending and request being added, the server info that request is added will be sent and be encapsulated as database update message, It is broadcasted in the server cluster.
In the present embodiment, when there is other servers to prepare that server cluster is added, it can be taken to any one master Business device, which is sent, is added request, for example, ping is requested, after master server authenticate and passes through, master server is agreed to The addition of the server returns to ping request response to the server, and carries the server of update in ping request response List, meanwhile, the server info that will be newly added, for example, by the address information tell the server cluster for the server being newly added In other servers for having been added to, or the address information for the server being newly added is broadcasted in server cluster.This Sample, it can be ensured that each server in server cluster being capable of synchronized update server list.
In the present embodiment, as an alternative embodiment, local data base is Relational DBMS (MySQL) number According to library.
In the present embodiment, it is configured with MYSQL database on the server using distributed push strategy, database uses knot Structure query language (SQL, Structured Query Language) language, sql like language are for accessing the most normal of database Use standardized language.
In the present embodiment, as an alternative embodiment, local data base is used for the shared resource of storage server cluster, and Service is provided out when server is primary server.
In the present embodiment, as an alternative embodiment, shared resource includes but is not limited to: server address information, offer Service name, local server be registered to global module name, global approach name, global listings data and business datum.Its In,
Server address information (server name) and the Service name provided, to be mutually connected in multiple servers Access address and provided service when connecing, convenient for each server of mark.As an alternative embodiment, in server In cluster, the Service name that each primary server provides is all the same.
Local server is registered to global module name and global approach name, in a certain service function of server calls When energy, directly fills in the corresponding module name for being registered to the overall situation of the service function and the service function can be realized in global approach name It calls, which is registered to global module name and global approach name according to what is recorded in local data base, finds correspondence Server address information, then carry out far call according to the server address information that finds.
In the present embodiment, as an alternative embodiment, global module's name and method name in database utilize TCP long connection Mode can share to each server and use, other servers can be according to the global module's name and method name information of the server It is remotely accessed, detailed process is as follows:
When server cluster is added by master server in a server, a service can be selected by random fashion Primary server transmission in device cluster pulls the Resources list (get_resources) request, that is, request, the main clothes selected are added Business device is receiving all data (server address that pulls and after the Resources list requests and adhere to, will store in database Information, the Service name of offer, global module name, global approach name, global listings data) it is encapsulated in and pulls the Resources list request In response, it is back to and sends the server for pulling the Resources list request and storage.
When server is called for module name and method name, first found from the database got module name+ The corresponding server address of method name, then server directly distally sends message.In this way, can be more efficient Carry out server between high-speed traffic, based on can be convenient under this connection mode realize server between synchronous communication, Asynchronous communication and broadcast communication.
Global listings data are available to a blank structure list of entire server cluster, deposit in blank structure list The data of storage, can be by each server access as shared data.In the present embodiment, blank structure list is as a function To extend use later, which is option.
Business datum is the corresponding data of service for pushing outward.
In the present embodiment, as an alternative embodiment, in the local database, local server is registered to global module Name can map one or more global approach names, and a local server is registered to global module name and a global approach name The Service name of one or more server address informations and offer, i.e. local server are registered to global module name and overall situation side Service name of the religious name (local server is registered to global module name+global approach name) with server address information and offer (server address information+offer Service name) is one-to-one or one-to-many corresponding relationship, and a module name combines a method name, The Service name of multiple server address informations and offer can be provided.
In the present embodiment, all primary servers in server cluster externally provide identical service, primary server with from It is mutually synchronized database between server, there is the database of complete striking resemblances on each server.
Step 102, whether the server based on distributed push strategy for detecting starting is subordinate server cluster In primary server, if the server based on distributed push strategy of starting is primary server, described in synchronous Local data base is provided out service, and starting has multiple primary servers in the server cluster;
In the present embodiment, as an alternative embodiment, in order to ensure stable, the reduction server set of server cluster The catastrophic failure of group, the interior primary server quantity started of server cluster can be according to the stability of requirement and the failure of tolerance Rate is configured, in this way, not having master-slave, each master between more primary servers by being arranged and starting more primary servers The configuration of server is all the same, is responsible for identical thing in server cluster, provides identical function, serves as the work of intermediary With can complete that stream is added so that other servers are connect when server cluster is added with which primary server Journey, moreover, other primary servers operated normally can ensure server cluster after the failure of one or more primary servers It operates normally, without to effectively reduce service latency, improving by re-electing primary server from server Efficiency of service.
In the present embodiment, as an alternative embodiment, detect whether include: for the primary server in subordinate server cluster
According to the server list in the local data base synchronized, detect whether as the main clothes in subordinate server cluster Business device.
In the present embodiment, as an alternative embodiment, starts if it is server cluster, then will start in server cluster All primary servers, if server cluster last time operate after close synchronously, each primary server carry out data it is same When step, the local data base in each primary server is all the same.
In the present embodiment, in server list in the local database, be previously provided with the server whether based on take The information of business device, thus, by reading the server list in local data base, can determine whether the server is affiliated clothes The primary server being engaged in device cluster.
In the present embodiment, server cluster includes one or more servers, including multiple primary servers and one Or it is multiple from server, each server can also be referred to as node.
In server cluster, multiple servers are previously provided with as primary server, for example, specified two to five clothes Business device is primary server, and other servers are from server.In server cluster starting, first start all main services The boot sequence of device, each primary server can be started using random device, after starting all primary servers, be restarted corresponding Slave server.
In the present embodiment, if detecting itself for the slave server in subordinate server cluster, according to pre-set Update cycle from the synchronous local data base of the primary server of normal operation, and after monitoring that primary server is abnormal, utilizes Pre-set election strategy chooses one from server, substitutes the primary server being abnormal.The primary server being abnormal exists It is abnormal eliminate after, as from server.
In the present embodiment, as an alternative embodiment, primary server after actuation, can be mentioned outward by local data base For service, due to be provided in server cluster more primary servers (by other from server updating be primary server), can be with It is provided out service by more primary servers, so that the resource of server cluster is efficiently used, improves server The resource utilization of cluster;Moreover, service request is more or need Push Service quantity of explorer it is more in the case where, can Service to be assigned on multiple primary servers by the strategy such as load balancing, so that the response speed of primary server or push speed The performance indicators such as degree will not reduce, and enhance the efficiency of service of primary server.
Step 103, pre-set monitoring process in the server based on distributed push strategy of starting is opened, Monitor other servers in the server cluster in addition to the server for pushing strategy described in starting based on distribution Connection status, and the connection status obtained according to monitoring updates the corresponding server list of the connection status.
In the present embodiment, master server start and construct with other primary servers and other from the mutual of server Even after intercommunication, pre-set monitoring process is opened.
In the present embodiment, in order to ensure, each server can be in connected state, master constantly in server cluster Monitoring process timing in server, which sends ping to each server, requests to be checked.Thus, as an optional implementation Example monitors the connection status of other servers in the server cluster, and described in the connection status update obtained according to monitoring The corresponding server list of connection status includes:
A11 sends ping request according to other servers of pre-set heart beat cycle into the server cluster;
A12, if not receiving the ping request response of server return in pre-set heartbeat detection time threshold, The server for not returning to ping request response is deleted from the server list, obtains updating server list;
In the present embodiment, as an alternative embodiment, the number for sending ping request can also be increased, determined with more accurate Whether be other servers Network Abnormal, thus, if do not received in pre-set heartbeat detection time threshold described After the ping request response returned to server, the server of ping request response will not be returned from the server list Before deletion, this method further include:
Ping request is successively sent to the server for not returning to ping request response, if in pre-set heartbeat detection The number for not receiving ping request response in time threshold reaches pre-set heartbeat detection frequency threshold value, and execution is described will not Return to the step of server that ping request responds is deleted from the server list.
In the present embodiment, sent according to other servers of pre-set heart beat cycle into the server cluster After ping request, if receiving the ping request response of server return in pre-set heartbeat detection time threshold;Or Person has received ping request response before heartbeat detection frequency threshold value, does not then deal with, continue waiting for lower heart cycle.
The update server list is pushed to each server for including in the update server list by A13.
In the present embodiment, request to check by ping, if it exceeds pre-set heartbeat detection frequency threshold value number Ping request failure (does not receive ping request response), for example, if continuous ping more than five times requests failure, master Server removes the server of ping request failure, and notifies described in other server updates in (broadcast) server cluster Server list;Alternatively, directly the update server list that processing obtains is notified to each connected server.
In the present embodiment, by the health examination strategy between server, available resource in management server cluster is gone forward side by side Row resource allocation, for example, by checking each server health status and performance parameter in server cluster, when a certain main clothes When device exception of being engaged in, the server of the exception can be removed into server cluster, and the user for accessing the primary server is switched to On other primary servers operated normally;When the number that a certain server is accessed causes congestion status too much, can will remain It is that can accomplish the maximized utilization of resources, to realize on idle server that remaining access request, which automatically switches to state, CPU, memory, the reasonable utilization of Internet resources and convenient function are extended.
Fig. 2 is the method flow schematic diagram of two management server cluster of the embodiment of the present invention, as shown in Fig. 2, server Each server in cluster is known as node, and the method for the present embodiment may include:
Step 201, start local node;
Step 202, judge whether itself is host node, if so, step 203 is executed, if not, executing step 211;
Step 203, start monitoring process;
Step 204, ping request is sent to other servers according to pre-set heart beat cycle, judges whether to be connected to, If so, lower heart cycle is waited to execute step 205 if not, confirmation goes offline;
Step 205, it retries ping to request five times, judges whether to be connected to, if so, lower heart cycle is waited, if not, Confirmation goes offline, and executes step 206;
Step 206, the server info to go offline is deleted from server list, the server info to go offline is encapsulated as Node updates message, is broadcasted in server cluster;
Step 207, node receiving node update message online in server cluster updates the server column of local maintenance Table;
Step 211, ping request is sent to request to register to host node, judge whether to be connected to, if not, confirmation goes offline, Step 212 is executed, if so, executing step 213;
In the present embodiment, as an alternative embodiment, it is that ping is requested that request, which is added,.
Step 212, it retries ping to request five times, judges whether to be connected to, if so, step 213 is executed, if not, confirmation It goes offline, terminates process;
Step 213, it is registered to host node;
Step 214, the server list that host node returns is received;
Step 215, it carries out calling between node, judges whether calling is normal, if so, step 216 is executed, if not, holding Row step 217;
Step 216, node is executed to call;
Step 217, it retries node to call five times, judge whether normally, if so, step 216 is executed, if not, confirmation It is abnormal, execute step 218;
Step 218, the nodal information abnormal to host node notice.
In the present embodiment, host node is after receiving abnormal nodal information, by the nodal information of the exception in server It is broadcasted in cluster.
Fig. 3 is the apparatus structure schematic diagram of the embodiment of the present invention san management server cluster, as shown in figure 3, this implementation The device of example may include: synchronization module 31, detection module 32 and process monitoring module 33, wherein
Synchronization module 31, for after triggering starting is based on the server of distributed push strategy, synchronous averaging it is described The local data base of server based on distributed push strategy;
In the present embodiment, as an alternative embodiment, synchronization module 31 includes: start unit, connection unit and synchronization Unit (not shown), wherein
Start unit, for notifying link unit after triggering starting is based on the server of distributed push strategy;
Connection unit, for constructing and removing the clothes based on distributed push strategy described in starting in subordinate server cluster The TCP long connection of the server of other operations except business device;
Synchronization unit, for receiving the database update message in the server cluster by the TCP long connection, according to Local data base is updated according to the database update message.
In the present embodiment, as an alternative embodiment, database is located at server local, passes through between multiple servers TCP long connection type group builds up a distributed database, is stored with identical data backup in each database.
In the present embodiment, as another alternative embodiment, synchronization module 31 further include: judging unit and registering unit, Wherein,
Judging unit judges whether to be registered to server cluster, if so, logical for receiving the notice of start unit Know connection unit;If it is not, notice registering unit;
Registering unit sends for primary server any into the server cluster and request is added, if the addition Request notifies connection unit by certification.
In the present embodiment, as an alternative embodiment, the primary server any into the server cluster, which is sent, to be added Enter request, if addition request includes: by certification
Primary server, which receives, is added request, after request certification is added and passes through, will send the server info that request is added It is added in the server list in local data base, the server list for adding server info is carried, request is being added In, it is back to the server for sending and request being added, the server info that request is added will be sent and be encapsulated as database update message, It is broadcasted in the server cluster.
In the present embodiment, when there is other servers to prepare that server cluster is added, it can be taken to any one master Business device, which is sent, is added request, for example, ping is requested, after master server authenticate and passes through, master server is agreed to The addition of the server returns to ping request response to the server, and carries the server of update in ping request response List, meanwhile, the server info that will be newly added, for example, by the address information tell the server cluster for the server being newly added In other servers for having been added to, or the address information for the server being newly added is broadcasted in server cluster.
In the present embodiment, as an alternative embodiment, local data base is MySQL database, is used for storage server collection The shared resource of group, and service is provided out when server is primary server.Wherein, shared resource includes but is not limited to: clothes Business device address information, the Service name of offer, local server are registered to global module name, global approach name, global listings number Accordingly and business datum.
Detection module 32 pushes whether tactful server is affiliated service based on distributed described in starting for detecting Primary server in device cluster passes through synchronization if the server based on distributed push strategy of starting is primary server The local data base be provided out service, starting has multiple primary servers in the server cluster;
In the present embodiment, as an alternative embodiment, if detection module 32 is also used to detect itself for subordinate server Slave server in cluster synchronizes local data base from the primary server of normal operation then according to the pre-set update cycle, And after monitoring that primary server is abnormal, using pre-set election strategy election one from server, substitution occurs different Normal primary server.
In the present embodiment, as an alternative embodiment, detection module 32 includes: detection unit and service rendering units (not shown), wherein
Detection unit, for detecting whether as affiliated service according to the server list in the local data base synchronized Primary server in device cluster;
In the present embodiment, in server list in the local database, be previously provided with the server whether based on take The information of business device, thus, by reading the server list in local data base, can determine whether the server is affiliated clothes The primary server being engaged in device cluster.
Service rendering units, for being mentioned outward by the local data base after detection unit is detected as primary server For service.
Process monitoring module 33 is preset for opening in the server based on distributed push strategy described in starting Monitoring process, its in addition to monitoring the server in the server cluster based on distributed push strategy described in the starting The connection status of his server, and the connection status obtained according to monitoring updates the corresponding server list of the connection status.
In the present embodiment, as an alternative embodiment, process monitoring module 33 includes: monitoring process opening unit, heartbeat Detection unit, heartbeat processing unit and update push unit (not shown), wherein
Monitoring process opening unit, for opening pre-set monitoring process;
Heartbeat detection unit, for other servers according to pre-set heart beat cycle into the server cluster Send ping request;
Heartbeat processing unit, if not receiving the ping of server return in pre-set heartbeat detection time threshold Request response deletes the server for not returning to ping request response from the server list, obtains updating server column Table;
In the present embodiment, as an alternative embodiment, heartbeat processing unit is also used in pre-set heartbeat detection Between the ping request response of server return is not received in threshold value after, successively sent to the server for not returning to ping request response Ping request is set in advance if the number for not receiving ping request response in pre-set heartbeat detection time threshold reaches The heartbeat detection frequency threshold value set deletes the server for not returning to ping request response from the server list.
Push unit is updated, includes for pushing to the update server list in the update server list Each server.
In the present embodiment, request to check by ping, if it exceeds pre-set heartbeat detection frequency threshold value number Ping request failure (does not receive ping request response), for example, if continuous ping more than five times requests failure, master Server removes the server of ping request failure, and notifies described in other server updates in (broadcast) server cluster Server list;Alternatively, directly the update server list that processing obtains is notified to each connected server.
The device of the present embodiment can be used for executing the technical solution of embodiment of the method shown in Fig. 1 and Fig. 2, realize former Reason is similar with technical effect, and details are not described herein again.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that There is also other identical elements in process, method, article or equipment including the element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodiment Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.
For Installation practice, since it is substantially similar to the method embodiment, so the comparison of description is simple Single, the relevent part can refer to the partial explaination of embodiments of method.
Expression or logic and/or step described otherwise above herein in flow charts, for example, being considered use In the order list for the executable instruction for realizing logic function, may be embodied in any computer-readable medium, for Instruction execution system, device or equipment (such as computer based system, including the system of processor or other can be held from instruction The instruction fetch of row system, device or equipment and the system executed instruction) it uses, or combine these instruction execution systems, device or set It is standby and use.For the purpose of this specification, " computer-readable medium ", which can be, any may include, stores, communicates, propagates or pass Defeated program is for instruction execution system, device or equipment or the dress used in conjunction with these instruction execution systems, device or equipment It sets.The more specific example (non-exhaustive list) of computer-readable medium include the following: there is the electricity of one or more wirings Interconnecting piece (electronic device), portable computer diskette box (magnetic device), random access memory (RAM), read-only memory (ROM), erasable edit read-only storage (EPROM or flash memory), fiber device and portable optic disk is read-only deposits Reservoir (CDROM).In addition, computer-readable medium can even is that the paper that can print described program on it or other are suitable Medium, because can then be edited, be interpreted or when necessary with it for example by carrying out optical scanner to paper or other media His suitable method is handled electronically to obtain described program, is then stored in computer storage.
It should be appreciated that each section of the invention can be realized with hardware, software, firmware or their combination.
In the above-described embodiment, multiple steps or method can be with storages in memory and by suitable instruction execution The software or firmware that system executes are realized.For example, in another embodiment, can be used if realized with hardware Any one of following technology well known in the art or their combination are realized: being had for realizing logic function to data-signal The discrete logic of the logic gates of energy, the specific integrated circuit with suitable combinational logic gate circuit, programmable gate Array (PGA), field programmable gate array (FPGA) etc..
Those skilled in the art are understood that realize all or part of step that above-described embodiment method carries It suddenly is that relevant hardware can be instructed to complete by program, the program can store in a kind of computer-readable storage medium In matter, which when being executed, includes the steps that one or a combination set of embodiment of the method.
For convenience of description, description apparatus above is to be divided into various units/modules with function to describe respectively.Certainly, exist Implement to realize each unit/module function in the same or multiple software and or hardware when the present invention.
As seen through the above description of the embodiments, those skilled in the art can be understood that the present invention can It realizes by means of software and necessary general hardware platform.Based on this understanding, technical solution of the present invention essence On in other words the part that contributes to existing technology can be embodied in the form of software products, the computer software product It can store in storage medium, such as ROM/RAM, magnetic disk, CD, including some instructions are used so that a computer equipment (can be personal computer, server or the network equipment etc.) executes the certain of each embodiment or embodiment of the invention Method described in part.
The above description is merely a specific embodiment, but scope of protection of the present invention is not limited thereto, any In the technical scope disclosed by the present invention, any changes or substitutions that can be easily thought of by those familiar with the art, all answers It is included within the scope of the present invention.Therefore, protection scope of the present invention should be subject to the protection scope in claims.

Claims (10)

1. a kind of method of management server cluster characterized by comprising
After triggering starting is based on the server of distributed push strategy, synchronous averaging it is described based on distributed push strategy The local data base of server;
Whether the server based on distributed push strategy of detection starting is primary server in subordinate server cluster, If the server based on distributed push strategy of starting is primary server, outside by the synchronous local data base Service is provided, starting there are multiple primary servers in the server cluster;
Pre-set monitoring process in the server based on distributed push strategy of starting is opened, the service is monitored The connection status of other servers in device cluster in addition to the server for pushing strategy described in starting based on distribution, and according to The corresponding server list of the connection status is updated according to the connection status that monitoring obtains.
2. the method for management server cluster according to claim 1, which is characterized in that the base of the synchronous averaging Include: in the local data base of the server of distributed push strategy
Building and other fortune in subordinate server cluster in addition to the server for pushing strategy described in starting based on distribution The TCP long connection of capable server;
The database update message in the server cluster is received by the TCP long connection, according to the database update Information updating local data base.
3. the method for management server cluster according to claim 1, which is characterized in that be based on described in triggering starting After after the server of distribution push strategy, the local number of the server based on distributed push strategy of synchronous averaging Before library, the method also includes:
Judge whether to be registered to server cluster, if so, executing the described based on distributed push plan of the synchronous averaging The step of local data base of server slightly;If it is not, any primary server sends addition into the server cluster Request, if addition request executes the service based on distributed push strategy of the synchronous averaging by certification The step of local data base of device.
4. the method for management server cluster according to claim 3, which is characterized in that described to the server cluster In any primary server send request be added, if additions request includes: by authenticating
Primary server, which receives, is added request, after request certification is added and passes through, will send the server info that request is added and adds In server list into local data base, the server list for adding server info is carried in request is added, is returned It is back to the server for sending and request being added, the server info that request is added will be sent and be encapsulated as database update message, in institute It states in server cluster and is broadcasted.
5. the method for management server cluster according to any one of claims 1 to 4, which is characterized in that the detection is No is that the primary server in subordinate server cluster includes:
According to the server list in the local data base synchronized, detect whether as the main service in subordinate server cluster Device.
6. the method for management server cluster according to any one of claims 1 to 4, which is characterized in that the monitoring institute The connection status of other servers in server cluster is stated, and the connection status obtained according to monitoring updates the connection status pair The server list answered includes:
Ping request is sent according to other servers of pre-set heart beat cycle into the server cluster;
If not receiving the ping request response of server return in pre-set heartbeat detection time threshold, will not return The server of ping request response is deleted from the server list, obtains updating server list;
The update server list is pushed to each server for including in the update server list.
7. the method for management server cluster according to claim 6, which is characterized in that if preset described Heartbeat detection time threshold in do not receive server return ping request response after, will not return ping request response Server from the server list delete before, the method also includes:
Ping request is successively sent to the server for not returning to ping request response, if in the pre-set heartbeat detection time The number for not receiving ping request response in threshold value reaches pre-set heartbeat detection frequency threshold value, and execution will be described not to be returned The step of server of ping request response is deleted from the server list.
8. the method for management server cluster according to any one of claims 1 to 4, which is characterized in that the method is also Include:
If detecting itself for the slave server in subordinate server cluster, according to the pre-set update cycle, from operation Normal primary server synchronizes local data base, and after monitoring that primary server is abnormal, utilizes pre-set election Strategy election one substitutes the primary server being abnormal from server.
9. a kind of device of management server cluster characterized by comprising synchronization module, detection module and process monitoring Module, wherein
Synchronization module, for after triggering starting is based on the server of distributed push strategy, synchronous averaging it is described based on point The local data base of the server of cloth push strategy;
Detection module pushes whether tactful server is subordinate server cluster based on distributed described in starting for detecting In primary server, if the server based on distributed push strategy of starting is primary server, described in synchronous Local data base is provided out service, and starting has multiple primary servers in the server cluster;
Process monitoring module, for opening pre-set monitoring in the server based on distributed push strategy described in starting Process monitors other services in the server cluster in addition to the server for pushing strategy described in starting based on distribution The connection status of device, and the connection status obtained according to monitoring updates the corresponding server list of the connection status.
10. the device of management server cluster according to claim 9, which is characterized in that the synchronization module includes: to open Moving cell, connection unit and synchronization unit, wherein
Start unit, for notifying link unit after triggering starting is based on the server of distributed push strategy;
Connection unit, for constructing and removing the server based on distributed push strategy described in starting in subordinate server cluster Except other operations server TCP long connection;
Synchronization unit, for receiving the database update message in the server cluster by the TCP long connection, according to institute It states database update message and updates local data base.
CN201710520921.4A 2017-06-29 2017-06-29 A kind of method and device of management server cluster Pending CN109218349A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710520921.4A CN109218349A (en) 2017-06-29 2017-06-29 A kind of method and device of management server cluster

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710520921.4A CN109218349A (en) 2017-06-29 2017-06-29 A kind of method and device of management server cluster

Publications (1)

Publication Number Publication Date
CN109218349A true CN109218349A (en) 2019-01-15

Family

ID=64976703

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710520921.4A Pending CN109218349A (en) 2017-06-29 2017-06-29 A kind of method and device of management server cluster

Country Status (1)

Country Link
CN (1) CN109218349A (en)

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110336884A (en) * 2019-07-09 2019-10-15 西安点告网络科技有限公司 Server cluster update method and device
CN111211989A (en) * 2019-12-24 2020-05-29 浙江云诺通信科技有限公司 CDN quality analysis method based on broadband television
CN111221557A (en) * 2020-01-15 2020-06-02 苏州浪潮智能科技有限公司 Method and device for refreshing server BMC in batch
CN111555931A (en) * 2020-04-23 2020-08-18 北京奇艺世纪科技有限公司 Upstream server monitoring processing method, monitor and electronic equipment
CN111831455A (en) * 2020-07-02 2020-10-27 上海微亿智造科技有限公司 Distributed transaction processing system and method under industrial Internet of things
CN112068939A (en) * 2020-08-24 2020-12-11 浙江知水信息技术有限公司 Method and system for scheduling multiple early warning services
CN112564932A (en) * 2019-09-26 2021-03-26 北京比特大陆科技有限公司 Target server offline notification method and device
CN112769889A (en) * 2020-11-18 2021-05-07 青岛海尔科技有限公司 Service data pushing method and device, storage medium and electronic device
CN113220485A (en) * 2021-05-25 2021-08-06 金蝶软件(中国)有限公司 Processing method and device for remote procedure call service and readable storage medium
CN113391759A (en) * 2020-03-13 2021-09-14 华为技术有限公司 Communication method and device
CN113407403A (en) * 2020-03-16 2021-09-17 顺丰科技有限公司 Cloud host management method and device, computer equipment and storage medium
CN114039976A (en) * 2021-10-29 2022-02-11 深圳市科思科技股份有限公司 Server cluster master-slave machine management method and system
WO2022095678A1 (en) * 2020-11-04 2022-05-12 华云数据控股集团有限公司 Message push method and message service system
CN115202882A (en) * 2022-07-26 2022-10-18 上海中汇亿达金融信息技术有限公司 Distributed application architecture and execution method of the architecture
CN116233137A (en) * 2023-02-17 2023-06-06 通明智云(北京)科技有限公司 Cluster-based load sharing and backup method and device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101690136A (en) * 2007-06-26 2010-03-31 汤姆逊许可证公司 Real time protocol stream migration
CN103795572A (en) * 2014-01-24 2014-05-14 北京京东尚科信息技术有限公司 Method for switching master server and slave server and monitoring server
CN104468777A (en) * 2014-12-05 2015-03-25 北京奇虎科技有限公司 Data operating method and device
US9223877B1 (en) * 2007-03-30 2015-12-29 Google Inc. Index server architecture using tiered and sharded phrase posting lists
EP2919130A4 (en) * 2012-12-28 2015-12-30 Huawei Tech Co Ltd Method and system for synchronizing distributed database
CN105429799A (en) * 2015-11-30 2016-03-23 浙江宇视科技有限公司 Server backup method and device
CN105721200A (en) * 2016-01-21 2016-06-29 北京乐动卓越科技有限公司 Master-slave server system application method and system thereof

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9223877B1 (en) * 2007-03-30 2015-12-29 Google Inc. Index server architecture using tiered and sharded phrase posting lists
CN101690136A (en) * 2007-06-26 2010-03-31 汤姆逊许可证公司 Real time protocol stream migration
EP2919130A4 (en) * 2012-12-28 2015-12-30 Huawei Tech Co Ltd Method and system for synchronizing distributed database
CN103795572A (en) * 2014-01-24 2014-05-14 北京京东尚科信息技术有限公司 Method for switching master server and slave server and monitoring server
CN104468777A (en) * 2014-12-05 2015-03-25 北京奇虎科技有限公司 Data operating method and device
CN105429799A (en) * 2015-11-30 2016-03-23 浙江宇视科技有限公司 Server backup method and device
CN105721200A (en) * 2016-01-21 2016-06-29 北京乐动卓越科技有限公司 Master-slave server system application method and system thereof

Cited By (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110336884B (en) * 2019-07-09 2022-03-29 西安点告网络科技有限公司 Server cluster updating method and device
CN110336884A (en) * 2019-07-09 2019-10-15 西安点告网络科技有限公司 Server cluster update method and device
CN112564932A (en) * 2019-09-26 2021-03-26 北京比特大陆科技有限公司 Target server offline notification method and device
CN111211989A (en) * 2019-12-24 2020-05-29 浙江云诺通信科技有限公司 CDN quality analysis method based on broadband television
CN111211989B (en) * 2019-12-24 2023-04-07 浙江云诺通信科技有限公司 CDN quality analysis method based on broadband television
CN111221557A (en) * 2020-01-15 2020-06-02 苏州浪潮智能科技有限公司 Method and device for refreshing server BMC in batch
CN113391759A (en) * 2020-03-13 2021-09-14 华为技术有限公司 Communication method and device
CN113391759B (en) * 2020-03-13 2024-04-09 华为云计算技术有限公司 Communication method and equipment
CN113407403A (en) * 2020-03-16 2021-09-17 顺丰科技有限公司 Cloud host management method and device, computer equipment and storage medium
CN113407403B (en) * 2020-03-16 2023-04-25 顺丰科技有限公司 Cloud host management method and device, computer equipment and storage medium
CN111555931A (en) * 2020-04-23 2020-08-18 北京奇艺世纪科技有限公司 Upstream server monitoring processing method, monitor and electronic equipment
CN111831455A (en) * 2020-07-02 2020-10-27 上海微亿智造科技有限公司 Distributed transaction processing system and method under industrial Internet of things
CN112068939A (en) * 2020-08-24 2020-12-11 浙江知水信息技术有限公司 Method and system for scheduling multiple early warning services
WO2022095678A1 (en) * 2020-11-04 2022-05-12 华云数据控股集团有限公司 Message push method and message service system
CN112769889A (en) * 2020-11-18 2021-05-07 青岛海尔科技有限公司 Service data pushing method and device, storage medium and electronic device
CN113220485A (en) * 2021-05-25 2021-08-06 金蝶软件(中国)有限公司 Processing method and device for remote procedure call service and readable storage medium
CN114039976A (en) * 2021-10-29 2022-02-11 深圳市科思科技股份有限公司 Server cluster master-slave machine management method and system
CN114039976B (en) * 2021-10-29 2024-01-09 深圳市科思科技股份有限公司 Master-slave management method and system for server cluster
CN115202882A (en) * 2022-07-26 2022-10-18 上海中汇亿达金融信息技术有限公司 Distributed application architecture and execution method of the architecture
CN115202882B (en) * 2022-07-26 2023-11-03 上海中汇亿达金融信息技术有限公司 Distributed application architecture and execution method thereof
CN116233137A (en) * 2023-02-17 2023-06-06 通明智云(北京)科技有限公司 Cluster-based load sharing and backup method and device
CN116233137B (en) * 2023-02-17 2023-11-17 通明智云(北京)科技有限公司 Cluster-based load sharing and backup method and device

Similar Documents

Publication Publication Date Title
CN109218349A (en) A kind of method and device of management server cluster
CN103338243B (en) The data cached update method and system of Web node
CN103207867B (en) It handles the method for data block, initiate the method and node of recovery operation
CN103236949B (en) Monitoring method, device and the system of a kind of server cluster
CN105471622B (en) A kind of high availability method and system of the control node active-standby switch based on Galera
CN104077199B (en) Based on partition method and the system of the high-availability cluster of shared disk
US11068499B2 (en) Method, device, and system for peer-to-peer data replication and method, device, and system for master node switching
CN103634411B (en) A kind of marketing data real time broadcasting system and method with state consistency
CN107566214B (en) Performance test method and device
CN111966289A (en) Partition optimization method and system based on Kafka cluster
CN104573428B (en) A kind of method and system for improving server cluster resource availability
CN112333249A (en) Business service system and method
EP2524308A2 (en) Methods and apparatus for predicting the performance of a multi-tier computer software system
CN108063832B (en) Cloud storage system and storage method thereof
CN109450711A (en) The choosing method of host node, device, system and storage medium in distributed system
CN114844809B (en) Multi-factor arbitration method and device based on network heartbeat and kernel disk heartbeat
CN108418859A (en) The method and apparatus for writing data
CN111552701B (en) Method for determining data consistency in distributed cluster and distributed data system
Gankevich et al. Subordination: Cluster management without distributed consensus
CN109302319B (en) Message pool distributed cluster and management method thereof
CN109510730A (en) Distributed system and its monitoring method, device, electronic equipment and storage medium
CN116541461A (en) Data processing method, device, equipment and storage medium applied to database
CN116346834A (en) Session synchronization method, device, computing equipment and computer storage medium
US10860580B2 (en) Information processing device, method, and medium
CN113055461B (en) ZooKeeper-based unmanned cluster distributed cooperative command control method

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190115