Summary of the invention
It is an object of the invention to overcome problems of the prior art, a kind of company-data synchronous method is provided, itThe configuration that simplified clustered node may be implemented, is matched automatically by the IP address that Automatic Negotiation Mechanism completes clustered node sync capIt sets.
To realize above-mentioned technical purpose and the technique effect, the present invention is achieved by the following technical solutions:
A kind of company-data synchronous method, includes the following steps:
Step 1, the design of company-data synchronous architecture;
Step 2, company-data are synchronous, and the company-data, which synchronizes, to be included the following steps:
Cluster management: the cluster management includes the following steps:
Step 2.1, cluster starting;
Step 2.2, cluster are closed;
Step 2.3, cluster configuration;
Step 2.4, clustered node condition monitoring: the clustered node condition monitoring includes following content: nodes heart beat is moreBroadcast, node address is negotiated, it is active and standby automatically switch, main controlled node transfer and switching, the node of the cluster by CDSP agreement comeExchange information;
Step 2.5, clustered node sync cap IP negotiate;
Data are synchronous, and the data, which synchronize, to be included the following steps:
Step 2.6, configuration change data are synchronous: the api interface data based on HTTP are synchronous;
Step 2.7, operation data are synchronous: operation data is synchronous using CDSP multicast protocol;
Step 3, company-data synchronous protocol CDSP.
Further, step 1 company-data leads in architecture design, includes the following steps:
Step 1.1, cluster engine open monitoring nodes thread and complete clustered node status checkout, and IP negotiates, node operationState switching, while also receiving the system call interception from user's space and the sync message from sync cap;
Step 1.2, cluster ports receive the message from other nodes, complete Message processing by cluster engine.
Further, it is mainly solved two problems in the step 2.5 clustered node sync cap IP negotiation:
1), non-main controlled node is unreachable to main controlled node IP;
2), the identical IP conflict of cluster interior nodes.
Further, the solution of described problem includes the following steps:
A, node IP is initialized, using effective node IP, if it find that the IP in the synchronous mouth of node is invalid, is reset to silentRecognize IP;
B, checking is whether present node is master control, if it is main controlled node, then negotiates without IP, IP address was negotiatedJourney only corrects non-master control node IP address;
C, it is identified in main controlled node using node control identification field cluster main controlled node, is main controlled node when set, it is noThen non-main controlled node illustrates in current cluster system if all nodes all do not find main controlled node in node table without master control, thisWhether Shi Ze skips present node and main controlled node address up to inspection;
D, check whether node table with present node sync cap IP have repetition, if it find that repeat, it is automatic to correctThe IP of node at that time, until not repeated with the IP of all nodes.
Beneficial effects of the present invention: cluster node configuration simplifies, the IP auto negotiation of node sync cap, node fortuneRow state detects automatically, and the configuration data and operation data of node have reached real-time synchronization, and configuration information is synchronized to avoid passing through and be configuredService disconnection caused by the upload reloading mode of file, so that configuration flexibly and easily also mitigates the work of administrator.
Specific embodiment
In order to be easy to understand the technical means, the creative features, the aims and the efficiencies achieved by the present invention, below willIn conjunction with the attached drawing in the embodiment of the present invention, technical scheme in the embodiment of the invention is clearly and completely described, it is clear thatDescribed embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.Based on the implementation in the present inventionExample, all other embodiment obtained by those of ordinary skill in the art without making creative efforts belong toThe scope of protection of the invention.
A kind of company-data synchronous method as shown in Figure 1, includes the following steps:
Step 1, the design of company-data synchronous architecture, include the following steps:
Step 1.1, cluster engine open monitoring nodes thread and complete clustered node status checkout, and IP negotiates, node operationState switching, while also receiving the system call interception from user's space and the sync message from sync cap;
Step 1.2, cluster ports receive the message from other nodes, complete Message processing by cluster engine;
Step 2, company-data are synchronous, and the company-data, which synchronizes, to be included the following steps:
Cluster management: the cluster management includes the following steps:
Step 2.1, cluster starting, click in the node for participating in cluster and open, and cluster, cluster starting can be added in this nodeAfterwards, the synchronization mouth of clustered node is in listening state, for monitoring the CDSP message from the other nodes of cluster;
Step 2.2, cluster are closed, and after cluster is closed, clustered node exits cluster, and the synchronization mouth of clustered node is no longer monitoredCDSP message, another: node is hung improper when exiting cluster, and other nodes can also detect;
Step 2.3, cluster configuration allow administrator to change the cluster attributes such as cluster main-standby nodes heartbeat duration, with applicationDifferent service environments;
The node of step 2.4, clustered node condition monitoring, the cluster exchanges information by CDSP agreement comprisingFollowing steps:
Step 2.4.1, nodes heart beat multicast: after cluster starting, cluster present node is in configuration status, first heartbeatAfter multicast message is sent with multicast, node switchs to learning state, and node receives the heartbeat response with other nodes at this time, and remembersThe information of all nodes is recorded to local node table;
Step 2.4.2, node address is negotiated: when current cluster node is in learning state, checking entire clustered node tableWhether main controlled node is had, if it find that present node is then set to main controlled node without main controlled node by node table;
Step 2.4.3, active and standby automatic switchover: clustered node is divided under AB active-standby mode: active and standby two kinds of working methods,Host node is in running order, and slave node is in off working state.Point all main working condition under load-sharing mode.In AB masterWhen standby mode deployment, condition monitoring finds host node time-out, is actively cut to main working condition;
Step 2.4.4, main controlled node transfer and switching: when node restores normal, the node of recovery is automatically added to cluster,If cluster mode is in LB mode, the node just restored is automatically cut into working condition, if cluster configuration is AB mode,Node inspection is then carried out, into active and standby automatic switchover step;
Wherein the node of the cluster is communicated by CDSP agreement;
Step 2.5, clustered node sync cap IP negotiate, and mainly solve two problems:
1), non-main controlled node is unreachable to main controlled node IP;
2), the identical IP conflict of cluster interior nodes;
The solution of described problem includes the following steps:
A, node IP is initialized, using effective node IP, if it find that the IP in the synchronous mouth of node is invalid, is reset to silentRecognize IP;
B, checking is whether present node is master control, if it is main controlled node, then negotiates without IP, IP address was negotiatedJourney only corrects non-master control node IP address;
C, it is identified in main controlled node using node control identification field cluster main controlled node, is main controlled node when set, it is noThen non-main controlled node illustrates in current cluster system if all nodes all do not find main controlled node in node table without master control, thisWhether Shi Ze skips present node and main controlled node address up to inspection;
D, check whether node table with present node sync cap IP have repetition, if it find that repeat, it is automatic to correctThe IP of node at that time, until not repeated with the IP of all nodes;
Data are synchronous, and the data, which synchronize, to be included the following steps:
Step 2.6, configuration change data are synchronous: after cluster starts, when administrator's altering system configuration parameter,Corresponding change is synchronized to other all nodes in group system, is completed using the api interface based on http protocol, for safetyIt is required that relatively high system, synchronous data transmission channel uses HTTPS.
Illustrate the synchronous process of data by taking WAF group system as an example below, such as: administrator adds the address L3 host ip A and arrivesIn equipment, step is poly- as follows:
A, administrator logs in node WUI;
B, administrator submits host ip A to present node;
C, present node addition finishes calling sync cap, and sync cap is first checked whether to open and be synchronized, if openedIt is synchronous, then continue, otherwise without synchronization;
D, query node table initiates HTTP [S] by sync cap IP and establishes node connection, after adding sync mark,HTTP [S] message part of this node of Admin Access API is transmitted to each node by POST mode;
E, other nodes receive message, make same operation, and after node processing, discovery has sync mark, thenNo longer forward;
Note: being generally not that all node configuration datas require to synchronize, and handles function return value by node API come reallyIt is fixed whether to need to synchronize;
Step 2.7, operation data are synchronous, and operation data is synchronous using CDSP multicast protocol, when node operation data table becomesMore, such as creation, update, deletion, cluster synchronization is triggered, it is synchronous to be carried out by multicast;
Step 3, company-data synchronous protocol CDSP, data exchange passes through CDSP and carries out between clustered node.CDSP association textThe main information exchange completed between clustered node by multicast of exchange, such as: node IP address, node state, which is master controlDeng.
CDSP protocol format is as follows:
Present invention disclosed above preferred embodiment is only intended to help to illustrate the present invention.There is no detailed for preferred embodimentAll details are described, are not limited the invention to the specific embodiments described.Obviously, according to the content of this specification,It can make many modifications and variations.These embodiments are chosen and specifically described to this specification, is in order to better explain the present inventionPrinciple and practical application, so that skilled artisan be enable to better understand and utilize the present invention.The present invention is onlyIt is limited by claims and its full scope and equivalent.