A kind of method, system, equipment and the storage medium of group document synchronizationTechnical field
The present embodiments relate to cluster network communication technique field, more particularly to a kind of method of group document synchronization,System, equipment and storage medium.
Background technology
There is the cluster environment of up to a hundred servers in a quantity, data configuration between each server and be synchronouslyOne complexity and cumbersome process.After metadata, configuration, policy data change in cluster, Fast synchronization to Servers-allOn, it usually needs a host node carrys out management configuration, when the file of the node changes, notifies other sections of whole clusterPoint, renewal that could rapidly and efficiently from node are synchronous.
In existing technical solution, real-time monitoring file change can not be realized, change configuration file need to be to a large amount of clustersServer is largely manually operated, and the possibility that the application program caused by operation error is not normally functioning becomes larger.
The content of the invention
The present invention provides a kind of method, system, equipment and the storage medium of group document synchronization, each on cluster to realizeThe application program of server operation can real-time update it is synchronous or download newest configuration file, the normal fortune of maintenance data streamOK.
In a first aspect, an embodiment of the present invention provides a kind of method of group document synchronization, this method includes:
Configuration file is installed, the configuration file is used to manage the management platform clothes in cluster in management platform serverMetadata, configuration and the policy data of business device;The configuration file is uploaded to the management and put down by the management platform serverOn the zookeeper built in platform server;
Oracle listener is built on other servers in the cluster, the oracle listener is used for the zookeeperOn configuration file monitored;
When the configuration file modification in the management platform server, the configuration file on the zookeeperSynchronized update, and the zookeeper sends new information to the oracle listener on other servers;
The oracle listener on other servers in the cluster is according to the corresponding file of the new information synchronized update.
Second aspect, the embodiment of the present invention additionally provide a kind of system of group document synchronization, which includes:
Zookeeper builds module, and configuration file, the configuration file are installed in management platform server in clusterFor managing metadata, configuration and the policy data of the management platform server;The management platform server is matched somebody with somebody by described inFile is put to upload in the management platform server on the zookeeper built;
Oracle listener builds module, and oracle listener, the monitoring journey are built on other servers in the clusterSequence is used to monitor the configuration file on the zookeeper;
New information sending module, for when in the management platform server the configuration file modification when, it is describedConfiguration file synchronized update on zookeeper, and the zookeeper is sent more to the oracle listener on other serversNew information;
Synchronized update module, the oracle listener on other servers in the cluster are same according to the new informationStep updates corresponding file.
The third aspect, the embodiment of the present invention additionally provide a kind of equipment, including memory, processor and are stored in memoryComputer program that is upper and can running on a processor, the processor realize that the embodiment of the present invention is any when performing described programThe method of the group document synchronization.
Fourth aspect, the embodiment of the present invention additionally provide a kind of computer-readable recording medium, are stored thereon with computerProgram, which realizes any group document synchronization of embodiment of the present invention method when being executed by processor.
The embodiment of the present invention by the configuration file in the management platform server by uploading to the management platformOn the zookeeper built in server, oracle listener is built on other servers in the cluster to the zookeeperOn configuration file monitored, when in the management platform server the configuration file modification when, the zookeeperOn configuration file synchronized update, and the zookeeper on other servers oracle listener send new information, instituteThe oracle listener on other servers in cluster is stated according to the corresponding file of the new information synchronized update, to realize clusterOn the operation of each server application program can real-time update it is synchronous or download newest configuration file, maintenance data stream is justOften operation.
Brief description of the drawings
Fig. 1 is a kind of flow chart of the method for group document synchronization that the embodiment of the present invention one provides;
Fig. 2 is a kind of flow chart of the method for group document synchronization provided by Embodiment 2 of the present invention;
Fig. 3 is a kind of structure chart of the system for group document synchronization that the embodiment of the present invention three provides;
Fig. 4 is a kind of hardware architecture diagram for equipment that the embodiment of the present invention five provides.
Embodiment
In order to make the object, technical solutions and advantages of the present invention clearer, below in conjunction with the accompanying drawings to of the invention specific realExample is applied to be described in further detail.It is understood that specific embodiment described herein is used only for explaining the present invention,Rather than limitation of the invention.
It also should be noted that for the ease of description, illustrate only in attached drawing part related to the present invention rather thanFull content.It should be mentioned that some exemplary embodiments are described before exemplary embodiment is discussed in greater detailInto the processing or method described as flow chart.Although operations (or step) are described as the processing of order by flow chart,It is that many of which operation can be implemented concurrently, concomitantly or at the same time.In addition, the order of operations can be by againArrange.The processing can be terminated when its operations are completed, it is also possible to the additional step being not included in attached drawing.The processing can correspond to method, function, code, subroutine, subprogram etc..
Embodiment one
Fig. 1 is a kind of flow chart of the method for group document synchronization that the embodiment of the present invention one provides, and the present embodiment can fitFor synchronizing situation to group document based on zookeeper, this method can be performed by the system of group document synchronization,Specifically comprise the following steps:
Configuration file is installed, the configuration file is used to manage the management in S110, cluster in management platform serverMetadata, configuration and the policy data of Platform Server;The management platform server uploads to the configuration file describedOn the zookeeper built in management platform server.
Wherein, the zookeeper is distributed, open source code a distributed application program coordination service systemSystem, is mono- realization increased income of Chubby of Google, it is the software that Consistency service is provided for Distributed Application, is carriedThe function of confession includes:Configuring maintenance, domain name service, distributed synchronization, group service etc..
In zookeeper, watcher mechanism is introduced to notify client, it allows client to be registered to server-sideOne watcher is monitored, and when some of server-side specify events to trigger this watcher, will be sent out to specified clientSend an event notice.
The watcher mechanism of Zookeeper mainly include client thread, client watcher-manager andZookeeper server three parts.Its specific workflow is:Client is to zookeeper server registrations watcher'sMeanwhile watcher objects can be stored in the watcher-manager of client.When server-side triggers watcher eventsAfterwards, it can send and notify to client, client thread takes out corresponding watcher objects from watcher-manager, according toNotification type and node path, to handle readjustment logic, respective handling is made to client data.
Oracle listener is built on other servers in S120, the cluster, the oracle listener is used for describedConfiguration file on zookeeper is monitored.
Specifically, the oracle listener is the management platform clothes to the configuration file management on the zookeeperMetadata, configuration and the policy data of business device are monitored.
S130, when the configuration file modification in the management platform server, the configuration on the zookeeperSynchronously renewing file, and the zookeeper sends new information to the oracle listener on other servers.
Specifically, when the management platform server of the configuration file management in the management platform serverWhen metadata, configuration and policy data at least one are changed, to corresponding file in the configuration file on the zookeeperContent synchronizes renewal, and the zookeeper sends new information to the oracle listener on other servers.
The oracle listener on other servers in S140, the cluster is corresponding according to the new information synchronized updateFile.
The embodiment of the present invention by the configuration file in the management platform server by uploading to the management platformOn the zookeeper built in server, oracle listener is built on other servers in the cluster to the zookeeperOn configuration file monitored, when in the management platform server the configuration file modification when, the zookeeperOn configuration file synchronized update, and the zookeeper on other servers oracle listener send new information, instituteThe oracle listener on other servers in cluster is stated according to the corresponding file of the new information synchronized update, to realize clusterOn the operation of each server application program can real-time update it is synchronous or download newest configuration file, maintenance data stream is justOften operation.
Embodiment two
Fig. 2 is a kind of flow chart of the method for group document synchronization provided by Embodiment 2 of the present invention.It is more than the present embodimentState and optimize based on embodiment, in the present embodiment, in management platform server described in step by the configuration fileAfter passing in the management platform server on the zookeeper built, further include:Taken in the management platform serverThe first monitoring node is established on the zookeeper built, and preserves described first in the configuration file and monitors node.MeanwhileOracle listener will be built on other servers in cluster described in step, the oracle listener is used for the zookeeperConfiguration file monitored and be further optimized for:Foundation is built on other servers in the cluster the second monitoring sectionThe oracle listener of point, the oracle listener are used to monitor the configuration file on the zookeeper.Meanwhile by stepWhen the configuration file modification in the management platform server, the configuration file synchronized update on the zookeeper,And the zookeeper sends new information to the oracle listener on other servers and is further optimized for:When the managementWhen the configuration file on Platform Server is changed, the described first configuration for monitoring node is preserved on the zookeeperSynchronously renewing file, and on the zookeeper it is described first monitor node to the oracle listener on other serversIn it is described second monitor node send new information.Meanwhile by the monitoring journey on other servers in cluster described in stepSequence is further optimized for according to the corresponding file of the new information synchronized update:The prison on other servers in the clusterAfter listening program to receive new information, according to metadata, configuration and the plan of the zookeeper management platform servers providedThe slightly access interface of data, to be preserved to amended configuration file in the management platform server.
Correspondingly, the method for the present embodiment specifically includes:
Configuration file is installed, the configuration file is used to manage the management in S210, cluster in management platform serverMetadata, configuration and the policy data of Platform Server;The management platform server uploads to the configuration file describedOn the zookeeper built in management platform server.
The first monitoring node is established on S220, the zookeeper built in the management platform server, and describedDescribed first is preserved in configuration file and monitors node.
Wherein, the monitoring node represents that there is no relative path with absolute path.
The oracle listener established and have the second monitoring node is built on S230, other servers in the cluster, it is describedOracle listener is used to monitor the configuration file on the zookeeper.
S240, when the configuration file modification in the management platform server, preserve on the zookeeperIt is described first monitor node configuration file synchronized update, and on the zookeeper it is described first monitor node toDescribed second in oracle listener on other servers, which monitors node, sends new information.
Specifically, when the configuration file modification in the management platform server, first to described in readingThe content of configuration file carries out legitimacy verifies, if verification failure, verification failure information is recorded in journal file, such asFruit verification passes through, then continues to calculate the MD5 values of the configuration file with program, and by the MD5 values and database that are calculatedMD5 values contrasted, if both contents of the identical explanation configuration file are not changed, said if both are differentThe content of the bright configuration file is modified.When the content of the configuration file is modified, then further this described is matched somebody with somebodyPut file and further judged whether zookeeper needs establishment to monitor node, then directly will when monitoring node existsThe configuration file is placed at corresponding monitoring node, is first created monitoring node when monitoring node and being not present, again will afterwardsThe monitoring node of establishment is saved in the configuration file.
, it is necessary to which explanation is when the content legality to the configuration file verifies failure on the basis of above-described embodimentWhen, exist but monitor when node can not be saved in the configuration file and there is no first create when monitoring node when monitoring nodeWhen the above situation when building node failure occurs, by the above situation information record into journal file.
After the oracle listener on other servers in S250, the cluster receives new information, according to zookeeperThe access interface of the metadata of the management platform server, configuration and the policy data that provide, to be taken to the management platformAmended configuration file is preserved on business device.
It also should be noted that when having the corresponding configuration file for monitoring node to change in cluster, then lead toCross logical between the oracle listener on other servers in the zookeeper in the management platform server and the clusterLetter so that the renewal of the configuration file of change rapidly and efficiently is synchronous.
The embodiment of the present invention by the configuration file in the management platform server by uploading to the management platformOn the zookeeper built in server, the first monitoring is established on the zookeeper that is built in the management platform serverNode, and the first monitoring node is preserved in the configuration file, build foundation on other servers in the clusterThe oracle listener for having the second monitoring node monitors the configuration file on the zookeeper, when the management platform takesWhen the configuration file being engaged on device is changed, the configuration file that the first monitoring node is preserved on the zookeeper is sameStep renewal, and on the zookeeper it is described first monitor node to the institute in the oracle listener on other serversState the second monitoring node and send new information, according to the metadata of the zookeeper management platform servers provided, configurationWith the access interface of policy data, to be preserved to amended configuration file in the management platform server.The present inventionThe monitoring mechanism of zookeeper is employed in embodiment, so as to reach the effect of real-time monitoring configuration file change, is avoidedChange configuration file is needed to the workload that a large amount of servers are operated manually in cluster, is also reduced since manual operation is lostThe possibility that application program caused by by mistake is not normally functioning, realizes that the application program of each server operation on cluster can be realShi Gengxin is synchronous or downloads newest configuration file, and the normal operation of maintenance data stream, has saved vast resources, greatly liftedAccuracy and server work efficiency.
Embodiment three
Fig. 3 is a kind of structure chart of the system for group document synchronization that the embodiment of the present invention three provides, and the present embodiment can fitFor synchronizing situation to group document based on zookeeper, which can be performed by the method for group document synchronization.
As shown in figure 3, the system comprises:Zookeeper builds module 310, oracle listener builds module 320, renewalMessage transmission module 330 and synchronized update module 340, wherein:
Zookeeper builds mould 310, and configuration file, the configuration text are installed in management platform server in clusterPart is used for metadata, configuration and the policy data for managing the management platform server;The management platform server is by described inConfiguration file is uploaded in the management platform server on the zookeeper built;
Oracle listener builds module 320, and oracle listener, the monitoring are built on other servers in the clusterProgram is used to monitor the configuration file on the zookeeper;
New information sending module 330, for when in the management platform server the configuration file modification when, instituteThe configuration file synchronized update on zookeeper is stated, and the zookeeper is sent to the oracle listener on other serversNew information;
Synchronized update module 340, the oracle listener on other servers in the cluster disappear according to the renewalCease the corresponding file of synchronized update.
The embodiment of the present invention is by providing a kind of system of group document synchronization, by the management platform serverThe configuration file is uploaded in the management platform server on the zookeeper built, other clothes in the clusterOracle listener is built on business device to monitor the configuration file on the zookeeper, when in the management platform serverThe configuration file modification when, the configuration file synchronized update on the zookeeper, and the zookeeper to itsOracle listener on his server sends new information, the oracle listener on other servers in the cluster according to moreThe corresponding file of new information synchronized update, to realize that the application program of the operation of each server on cluster being capable of real-time update synchronizationOr download newest configuration file, the normal operation of maintenance data stream.
On the basis of the various embodiments described above, the system also includes:
Zookeeper monitors node and establishes module 350, for what is built in the management platform serverThe first monitoring node is established on zookeeper, and preserves described first in the configuration file and monitors node.
On the basis of the various embodiments described above, the oracle listener is built module 320 and is specifically used for:
The oracle listener established and have the second monitoring node, the monitoring journey are built on other servers in the clusterSequence is used to monitor the configuration file on the zookeeper.
On the basis of the various embodiments described above, the new information sending module 330 is specifically used for:
When the configuration file modification in the management platform server, preserved on the zookeeper describedFirst monitor node configuration file synchronized update, and on the zookeeper it is described first monitor node to otherDescribed second in oracle listener on server, which monitors node, sends new information.
On the basis of the various embodiments described above, the synchronized update module 340 is specifically used for:
After the oracle listener on other servers in the cluster receives new information, provided according to zookeeperThe metadata of the management platform server, the access interface of configuration and policy data, with to the management platform serverUpper amended configuration file is preserved.
The system for the group document synchronization that the various embodiments described above are provided can perform what any embodiment of the present invention was providedThe method of group document synchronization, possesses the corresponding function module of method and beneficial effect for performing group document synchronization.
Example IV
The embodiment of the present invention also provides a kind of storage medium for including computer executable instructions, and the computer can performWhen being performed by computer processor for performing a kind of method of group document synchronization, this method includes for instruction:
Configuration file is installed, the configuration file is used to manage the management platform clothes in cluster in management platform serverMetadata, configuration and the policy data of business device;The configuration file is uploaded to the management and put down by the management platform serverOn the zookeeper built in platform server;
Oracle listener is built on other servers in the cluster, the oracle listener is used for the zookeeperOn configuration file monitored;
When the configuration file modification in the management platform server, the configuration file on the zookeeperSynchronized update, and the zookeeper sends new information to the oracle listener on other servers;
The oracle listener on other servers in the cluster is according to the corresponding file of the new information synchronized update.
Optionally, which can be also used for performing the present invention times when being performed by computer processorA kind of technical solution of the method for group document synchronization that meaning embodiment is provided.
By the description above with respect to embodiment, it is apparent to those skilled in the art that, the present inventionIt can be realized by software and required common hardware, naturally it is also possible to which by hardware realization, but the former is more in many casesGood embodiment.Based on such understanding, what technical scheme substantially in other words contributed the prior artPart can be embodied in the form of software product, which can be stored in computer-readable recording mediumIn, floppy disk, read-only storage (Read-Only Memory, ROM), random access memory (Random such as computerAccess Memory, RAM), flash memory (FLASH), hard disk or CD etc., including some instructions are with so that a computer is setStandby (can be personal computer, server, or network equipment etc.) performs the method described in each embodiment of the present invention.
Embodiment five
As shown in figure 4, a kind of hardware architecture diagram of the equipment provided for the embodiment of the present invention five, as shown in figure 4, shouldEquipment includes:
One or more processors 410, in Fig. 4 by taking a processor 410 as an example;
Memory 420;
The equipment can also include:Input unit 430 and output device 440.
Processor 410, memory 420, input unit 430 and output device 440 in the equipment can pass through busOr other modes connect, in Fig. 4 exemplified by being connected by bus.
Memory 420 is used as a kind of non-transient computer readable storage medium storing program for executing, can available for storage software program, computerExecutive program and module, such as a kind of corresponding programmed instruction/module of method of group document synchronization in the embodiment of the present invention(for example, the Zookeeper shown in attached drawing 3 builds module 310, oracle listener builds module 320, new information sending module 330With synchronized update module 340).Processor 410 is stored in software program, instruction and module in memory 420 by operation,So as to perform various function application and the data processing of equipment, that is, realize that a kind of group document of above method embodiment is synchronousMethod.
Memory 420 can include storing program area and storage data field, wherein, storing program area can store operation systemSystem, the required application program of at least one function;Storage data field can be stored uses created data etc. according to equipment.In addition, memory 420 can include high-speed random access memory, non-transitory memory can also be included, for example, at least oneA disk memory, flush memory device or other non-transitory solid-state memories.In certain embodiments, memory 420 canChoosing includes to set by network connection to terminal relative to the remotely located memory of processor 410, these remote memoriesIt is standby.The example of above-mentioned network includes but not limited to internet, intranet, LAN, mobile radio communication and combinations thereof.
Input unit 430 can be used for the numeral or character information for receiving input, and produce with the user setting of equipment withAnd the key signals input that function control is related.Output device 440 may include the display devices such as display screen.
Note that it above are only presently preferred embodiments of the present invention and institute's application technology principle.It will be appreciated by those skilled in the art thatThe invention is not restricted to specific embodiment described here, can carry out for a person skilled in the art various obvious changes,Readjust and substitute without departing from protection scope of the present invention.Therefore, although being carried out by above example to the present inventionIt is described in further detail, but the present invention is not limited only to above example, without departing from the inventive concept, alsoIt can include other more equivalent embodiments, and the scope of the present invention is determined by scope of the appended claims.