CN109976822A - Configuration method, device and the distributed system of Distributed Application - Google Patents

Configuration method, device and the distributed system of Distributed Application Download PDF

Info

Publication number
CN109976822A
CN109976822A CN201711419029.3A CN201711419029A CN109976822A CN 109976822 A CN109976822 A CN 109976822A CN 201711419029 A CN201711419029 A CN 201711419029A CN 109976822 A CN109976822 A CN 109976822A
Authority
CN
China
Prior art keywords
configuration
agent
application example
file
center
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.)
Granted
Application number
CN201711419029.3A
Other languages
Chinese (zh)
Other versions
CN109976822B (en
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.)
Tianyi Cloud Technology Co Ltd
Original Assignee
China Telecom Corp 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 China Telecom Corp Ltd filed Critical China Telecom Corp Ltd
Priority to CN201711419029.3A priority Critical patent/CN109976822B/en
Publication of CN109976822A publication Critical patent/CN109976822A/en
Application granted granted Critical
Publication of CN109976822B publication Critical patent/CN109976822B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming

Abstract

The present invention provides a kind of configuration method of Distributed Application, device and distributed system, method therein includes: that configuration Agent downloads configuration file corresponding with application example from configuration center and stores;If it is determined that the configuration file for being stored in configuration center changes, then Configuration Agent Agent downloads updated configuration file, restarts strategy based on preset application example, executes the reboot operation for application example.Configuration method, device and distributed system of the invention, from configuration center server-side download configuration file, monitors update, starting/stopping application example of configuration file etc., reduces maintenance cost, improve the stability of system by configuring Agent independent operating;For hypotactic heterogeneous system, it is only necessary to which the configuration of a small amount of modification configuration Agent can be realized configuration and pull automatically;It can be widely applied to large-scale distributed system, Legacy System, heterogeneous system realized and access configuration without intrusionization.

Description

Configuration method, device and the distributed system of Distributed Application
Technical field
The present invention relates to distributed system technical field more particularly to a kind of configuration method of Distributed Application, device with And distributed system.
Background technique
Distributed system (distributed system) is built upon the software systems on network.Distributed system is gathered around There are many general physics and logical resource, can dynamically distribute task, the physics and logical resource of dispersion pass through computer Network implementations information exchange.There are one in system manages the distributed operating system of computer resource in a manner of global.? In one distributed environment, many examples are often disposed in the service of same type, these examples have used some configurations, in order to more It safeguards that these configurations need a special configuration management platform i.e. configuration center well, can easily be managed by configuration center Manage the configuration of thousands of a Service Instances up to a hundred.Configuration center is divided into configuration center server-side and the big mould of configuration center client two Block.
Currently, common configuration center client implementation, is that configuration center client component is embedded into application, In application starting automatically from configuration center download configuration, to realize the decoupling of configuration and application.Existing allocation plan Have the following problems: the first, have it is stronger invasive, it is using if desired by configuration file trustship to configuration center, then necessary Rely on the client component of configuration center.For left over by history system, needs largely to modify code, increases maintenance cost, Reduce the stability of system;The second, for hypotactic heterogeneous system, existing intrusive mood schemes for configuration and management can not be provided It supports.
Summary of the invention
One or more embodiments of the invention provides configuration method, device and the distributed system of a kind of Distributed Application System.
According to one aspect of the disclosure, a kind of configuration method of Distributed Application is provided, comprising: starting and application example Corresponding configuration Agent;The configuration Agent and configuration center establish connection, download from the configuration center and answer with described With the corresponding configuration file of example and store;If the configuration Agent determines that being stored in the described of the configuration center matches It sets file to change, then the configuration Agent and the configuration center establish connection and download the updated configuration text Part;The configuration Agent is based on preset application example and restarts strategy, executes the reboot operation for the application example.
Optionally, the configuration Agent obtains the identification information of the application example;The configuration Agent is according to Identification information downloads configuration file corresponding with the application example from the configuration center.
Optionally, the configuration Agent obtains preset configuration relevant information, wherein the configuration relevant information includes: Configuration center information, application example starting strategy, the identification information;The configuration Agent examines the configuration related The legitimacy of information, if examining failure, the configuration Agent terminates to run, if examined successfully, the configuration Agent obtains the command parameter for the application example, and the command parameter includes: journal file store path;It is described to match It sets Agent to test to the legitimacy of the command parameter, if examined successfully, opens log update thread, being used for will Log is written in journal file indicated by the journal file store path.
Optionally, described to be downloaded described in corresponding with application example configuration file includes: from the configuration center It configures Agent and obtains ownship information, wherein the ownship information includes: the IP address of the machine, host name;The configuration Agent The connection with the configuration center is established based on the configuration center information and the ownship information;The configuration Agent sentences The connection of breaking is successfully established, if it is, the newest configuration file of downloading;The configuration Agent is on Zookeeper The first Znode is created, the configuration file is used for identifying the application example.
Optionally, it if the configuration Agent judges that failure is established in the connection, re-establishes and the configuration center Connection;When determining that connecting the number for establishing failure reaches preset frequency threshold value, then the configuration Agent terminates to run.
Optionally, the configuration Agent and the configuration center establish connection and download the updated configuration file It include: that the configuration Agent monitors twoth ZNode corresponding with the configuration file on Zookeeper;If based on described the Two ZNode determine that the configuration file occurs to change and issues success, automatically updated described from configuration center downloading Configuration file, to replace original configuration file.
Optionally, the configuration Agent restarts strategy, execution for the application example based on preset application example Reboot operation includes: that the configuration Agent determines the parameter modified in the configuration file, is restarted based on the application example The tactful and described parameter modified judges whether to need to restart the application example, if it is, configuration Agent weight Open the application example.
Optionally, the configuration Agent and the application example are to be arranged in a one-to-one correspondence, wherein the configuration Agent and Its corresponding described application example is deployed in same server or container.
Optionally, the configuration Agent is run as independent process;Start in the configuration Agent and matches from described After setting the center downloading configuration file and storing, the configuration Agent starts the corresponding application example.
Optionally, the configuration Agent obtains the locally specified catalogue of the configuration file, and the configuration file is stored Under the locally specified catalogue.
According to another aspect of the present disclosure, a kind of configuration device of Distributed Application is provided, comprising: starting module is acted on behalf of, For starting configuration Agent corresponding with application example;The configuration Agent, comprising: configuration download module, for match Connection is established at the center of setting, and is downloaded configuration file corresponding with the application example from the configuration center and is stored;Configuration is more New module, for if it is determined that the configuration file for being stored in the configuration center changes, then with the configuration center It establishes connection and downloads the updated configuration file;Instance processes module, for restarting plan based on preset application example Slightly, the reboot operation for the application example is executed.
Optionally, the configuration download module is believed for obtaining the identification information of the application example according to the mark Breath downloads configuration file corresponding with the application example from the configuration center.
Optionally, the configuration Agent, comprising: data obtaining module, for obtaining preset configuration relevant information, In, the configuration relevant information includes: configuration center information, application example starting strategy, the identification information;Inspection institute The legitimacy of configuration relevant information is stated, if examining failure, the configuration Agent terminates to run, if examined successfully, obtain The command parameter for the application example is taken, the command parameter includes: journal file store path;Log update module, It tests for the legitimacy to the command parameter, if examined successfully, opens log update thread, be used for log It is written in journal file indicated by the journal file store path.
Optionally, the configuration download module, for obtaining ownship information, wherein the ownship information includes: the machine IP address, host name;The connection with the configuration center is established based on the configuration center information and the ownship information;Sentence The connection of breaking is successfully established, if it is, the newest configuration file of downloading;First is created on Zookeeper The configuration file is used for identifying the application example in Znode.
Optionally, the configuration download module, be used for if it is determined that the connection establish fail, then re-establish with it is described The connection of configuration center;Wherein, it establishes the number to fail when determining connection and reaches preset frequency threshold value, then the configuration Agent terminates to run.
Optionally, the configuration update module, for monitoring corresponding with the configuration file second on Zookeeper ZNode;If determining the configuration file generation change based on the 2nd ZNode and issuing success, automatically from the configuration The updated configuration file is downloaded at center, to replace original configuration file.
Optionally, the instance processes module is answered for determining the parameter modified in the configuration file based on described Strategy is restarted with example and the parameter modified judges whether to need to restart the application example, if it is, described Configuration Agent restarts the application example.
Optionally, the configuration Agent and the application example are to be arranged in a one-to-one correspondence, wherein the configuration Agent and Its corresponding described application example is deployed in same server or container.
Optionally, the configuration Agent is run as independent process;Start in the configuration Agent and matches from described After setting the center downloading configuration file and storing, the configuration Agent starts the corresponding application example.
Optionally, the configuration download module obtains the locally specified catalogue of the configuration file, by the configuration file It is stored under the locally specified catalogue.
According to the another aspect of the disclosure, a kind of distributed system is provided, comprising: described in any item distributions as above are answered Configuration device.
According to the another aspect of the disclosure, a kind of configuration device of Distributed Application is provided, comprising: memory;And coupling It is connected to the processor of the memory, the processor is configured to the instruction based on storage in the memory, executes such as The configuration method of upper described in any item Distributed Applications.
According to the another further aspect of the disclosure, a kind of computer readable storage medium is provided, computer program is stored thereon with The step of instruction, which realizes method described in any one as above when being executed by one or more processors.
Configuration method, device and the distributed system of the Distributed Application of the disclosure configure Agent under configuration center It carries configuration file corresponding with application example and stores;If it is determined that the configuration file for being stored in configuration center changes, Then Configuration Agent Agent downloads updated configuration file, restarts strategy based on preset application example, executes real for application The reboot operation of example;By configuring Agent independent operating, from configuration center server-side download configuration file, configuration file is monitored Update, starting/stopping application example etc., reduce maintenance cost, improve the stability of system;For hypotactic different Construction system, it is only necessary to which the configuration of a small amount of modification configuration Agent can be realized configuration and pull automatically.
Detailed description of the invention
In order to illustrate more clearly of the embodiment of the present disclosure or technical solution in the prior art, 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 Some embodiments of the present disclosure, for those of ordinary skill in the art, without any creative labor, also Other drawings may be obtained according to these drawings without any creative labor.
Fig. 1 is the flow diagram according to one embodiment of the configuration method of the Distributed Application of the disclosure;
Fig. 2 is the Booting sequence schematic diagram according to another embodiment of the configuration method of the Distributed Application of the disclosure;
Fig. 3 is the operational process schematic diagram according to another embodiment of the configuration method of the Distributed Application of the disclosure;
Fig. 4 is the module diagram according to one embodiment of the configuration device of the Distributed Application of the disclosure;
Fig. 5 is the module diagram according to one embodiment of the configuration device of the Distributed Application of the disclosure.
Specific embodiment
The disclosure is described more fully with reference to the accompanying drawings, wherein illustrating the exemplary embodiment of the disclosure.Under Face will combine the attached drawing in the embodiment of the present disclosure, and the technical solution in the embodiment of the present disclosure is clearly and completely described, and show So, described embodiment is only disclosure a part of the embodiment, instead of all the embodiments.Based on the reality in the disclosure Example is applied, every other embodiment obtained by those of ordinary skill in the art without making creative efforts all belongs to In the range of disclosure protection.
" first " hereinafter, " second " etc. are only used for distinguishing in description, and there is no other special meanings.
Fig. 1 is according to the flow diagram of one embodiment of the configuration method of the Distributed Application of the disclosure, such as Fig. 1 institute Show:
Step 101, start configuration Agent corresponding with application example.Configuration Agent is Configuration Agent, application example As software instances, application example can be hosts applications, charging application, authentication application etc., and application example can be deployed in clothes It is engaged in device or container.
Step 102, configuration Agent and configuration center establish connection, download from configuration center corresponding with application example Configuration file simultaneously stores.
Configuration center is to store and manage server or host of the configuration file of application example etc. in distributed system.Match Connection can be established using existing a variety of methods and configuration center by setting Agent, for carrying out data transmission.Configuring Agent will Configuration file is saved in specified catalogue, usually in configuration center upload configuration file, specified configuration file is needed to store Catalogue, Agent is from configuration center download configuration file for configuration.There are setting multiple parameter values, application example base in configuration file It is run in parameter value.
Step 103, if configuration Agent determines that the configuration file for being stored in configuration center changes, Configuration Agent Agent and configuration center establish connection and download updated configuration file.
Step 104, configuration Agent restarts strategy based on preset application example, and execution restarts behaviour for application example Make.
In one embodiment, configuration Agent is to be arranged in a one-to-one correspondence with application example, and configuration Agent is corresponding Application example is deployed in same server or container, for example, the corresponding application example of configuration Agent be deployed in it is same In a Docker or LXC.Configuration Agent is run as independent process, and application example is also run as independent process, is being matched Set Agent starting and from configuration center download configuration file and store after, configuration Agent start corresponding application example.
The locally specified catalogue that Agent obtains configuration file is configured, configuration file is stored under locally specified catalogue.It answers The configuration file that configuration Agent downloading or updated can be obtained from this locally specified catalogue with example, carried out based on configuration file Operation.Configuration Agent based on preset application example restart strategy, execute for the reboot operation of application example can there are many Mode.Configuration Agent determines the parameter modified in configuration file, the parameter restarting strategy based on application example and being modified Judge whether to need to restart application example, if it is, configuration Agent restarts application example.
For example, configuration Agent starting and from configuration center download configuration file and store after, configuration Agent starting with Its corresponding application example.Application example can obtain configuration file from this locally specified catalogue on startup, based on configuration text Part is run.
If configuration Agent determines that the configuration file for being stored in configuration center changes, updated configuration text is downloaded Part.Original configuration file is compared configuration Agent with updated configuration file, if it is determined that is repaired in configuration file The parameter changed is free memory parameter, restarts strategy based on application example and the determination of free memory parameter does not need to restart application Example.Application example can obtain the configuration file updated from this locally specified catalogue in operation, based on new free memory The value of parameter continues to run.
If original configuration file is compared configuration Agent with updated configuration file, configuration file is determined The middle parameter modified is database URL parameter, username and password parameter, restarts strategy and database based on application example URL parameter, the determination of username and password parameter need to restart application example.Application example can be from this local in restarting Specified directory obtains the configuration file updated, the Profile Up based on update.
The configuration method of the Distributed Application of above-described embodiment resides finger daemon (configuration by using in host Agent mode), downloading latest configuration file, monitoring configuration update and start and stop mandatory system etc., so that application example is to system The access unaware of one configuration center reduces the system degree of coupling.
In one embodiment, configuration Agent obtains the identification information of application example.For example, when configuration Agent starting, The identifier of application example is read from environmental variance, configuration Agent downloads according to identification information from configuration center real with application The corresponding configuration file of example.For example, the identifier that configuration Agent obtains charging application example is A1, Agent is configured from configuration Download configuration file corresponding with A1 in center.
It configures Agent and obtains preset configuration relevant information, configuration relevant information can save hereof, and configuration is related Information includes: configuration center information, application example starting strategy, identification information etc.;Configuration center information includes configuration center URL, user name, password etc..It configures the legitimacy that Agent examines configuration relevant information and configures Agent if examining failure Terminate operation, successfully configures Agent acquisition for the command parameter of application example if examined, command parameter can be to obtain The parameter that family is inputted by order line is taken, command parameter includes: journal file store path etc..Agent is configured to join order Several legitimacies are tested, if examined successfully, open log update thread, for storing log write-in journal file In journal file indicated by path.
In one embodiment, configuration Agent obtains ownship information, and ownship information includes: the IP address of the machine, host Name.Configure connection of the Agent based on configuration center information and ownship information foundation and configuration center.Agent judgement is configured to connect It connects and is successfully established, if it is, downloading newest configuration file.Configuration Agent creates the first Znode on Zookeeper, uses Configuration file is used in mark application example.If configuring Agent judgement connection establishes failure, re-establishes and configure The connection at center, when determining that connecting the number for establishing failure reaches preset frequency threshold value, then configuring Agent terminates to run.
It configures Agent and monitors twoth ZNode corresponding with configuration file on Zookeeper.If true based on the 2nd ZNode Determine configuration file to occur to change and issue success, downloads updated configuration file from configuration center automatically, it is original to replace Configuration file.
ZooKeeper is distributed, open source code a distributed application program coordination service, be Hadoop and The significant components of Hbase, it is one and provides the software of Consistency service for Distributed Application, and the function of providing includes: configuration Maintenance, domain name service, distributed synchronization, group service etc..In ZooKeeper, node is also referred to as znode.Use ZooKeeper The realization of distributed coordination service can be greatly simplified, to develop each NameSpace (Namespace) quilt in ZooKeeper Referred to as ZNode.What is stored in each node (ZNode) is to synchronize relevant data, and a ZNode maintains a state knot Structure, the structure include: version number, ACL change, timestamp.Each ZNode data change, and version number can all be incremented by, in this way The read request of client can be based on version number come retrieval status related data.Configuring Agent can be corresponding with configuration file A ZNode on monitor is set, if the ZNode data change, ZooKeeper be notified that configuration Agent.Configuration Agent can download updated configuration file using existing a variety of methods.
Fig. 2 be according to the Booting sequence schematic diagram of another embodiment of the configuration method of the Distributed Application of the disclosure, It is as shown in Figure 2:
Step 201, configuration Agent parses preset profile parameters.
The customized operating parameter of user is relied on when configuring Agent operation, is read by parsing preset profile parameters Take configuration center information, retry strategy, the identifier of application example etc..
Step 201, configuration Agent judges parameter legitimacy, and whether the parameter verified in configuration file is legal, if do not conformed to Rule directly terminates to run, and 203 are entered step if legal.
Step 203, Agent resolve command row parameter is configured.For example, user can be passed to parameter, parameter by order line For log file store path etc..
Step 204, judge command line parameter legitimacy, if legal, enter step 205, if command line parameter is not It is legal, directly terminate to run.
Step 205, configuration Agent opens asynchronous log update thread, individually starts a thread (goroutine), uses In log is brushed in journal file from buffer area.
Step 206, the information for initializing server, according in the configuration in the presupposed information parsed in step 201 The information of the heart (server) obtains zk and application example information from configuration center (server).
Step 207, initialization retries device, connect for zk connection or with server communication, requires when connection failure According to being that the strategy that retries configured in step 201 is retried.
Step 208, ownship information is obtained, IP address, host name of the machine etc. are obtained.
Step 209, the main thread contextual information of initial configuration Agent.
Fig. 3 be according to the operational process schematic diagram of another embodiment of the configuration method of the Distributed Application of the disclosure, It is as shown in Figure 3:
Step 301, configuration Agent starts connector, begins setting up the connection communicated with server (configuration center).
Step 302, judgement establishes whether connection succeeds, and enters step 307 if connection is successfully established, otherwise starts to hold Row step 303 starts retry mechanism.
Step 303, configuration Agent starts retry mechanism, and retry mechanism is configured in step 201, for example, retrying machine System is configured as retrying every n seconds once, retries m times in total.
Step 304, configuration Agent judges whether reconnection, if you do not need to reconnection then directly terminates to run, if necessary to weight Even, then 305 are entered step.Usually, not reconnection then means that number of retries has reached preset threshold value, no longer carries out weight Examination.
Step 305, configuration Agent starts to carry out the reconnection with configuration center, the connection institute in connection type and step 301 The logic of execution is identical.
Step 306, configuration Agent judge judge retry whether successful connection, 307 are entered step if successful connection, Otherwise 304 are entered step, judges whether current number of retries has reached the threshold value of setting.
Step 307, configuration Agent starts from configuration center download configuration file.After establishing successful connection, configuration Agent needs to download newest configuration file from configuration center (server) according to the identifier of application example.
Step 308, configuration Agent creates Znode, and a Znode indicates one and answering for current configuration file is used Use example information.It can check that multiple application examples have used current configuration file in O&M window by Znode.
Step 309, configuration Agent monitors Zk variation, monitors the corresponding Znode node of configuration file, in real time discovery configuration The alteration of file.
Step 310, configuration Agent determines that configuration changes, if configuration file is modified, configures Agent and starts Re-download configuration.
In one embodiment, as shown in figure 4, the disclosure provides a kind of configuration device of Distributed Application, including agency Starting module 41 and configuration Agent42.Configuration Agent includes: configuration download module 421, configuration update module 422, at example Manage module 423, data obtaining module 424 and log update module 425.
It acts on behalf of starting module 41 and starts Configuration Agent Agent corresponding with application example.It configures download module 421 and matches Connection is established at the center of setting, and is downloaded configuration file corresponding with application example from configuration center and is stored.Configure update module 422 If it is determined that the configuration file for being stored in configuration center changes, then connection is established with configuration center and downloads updated match Set file.Instance processes module 423 is based on preset application example and restarts strategy, executes the reboot operation for application example.
Configuration Agent is to be arranged in a one-to-one correspondence with application example, and configuration Agent corresponding application example is deployed in together In one server or container.Configuration Agent is run as independent process, in configuration Agent starting and under configuration center After carrying configuration file and storing, configuration Agent starts corresponding application example.It configures download module 421 and obtains configuration text The locally specified catalogue of part, configuration file is stored under locally specified catalogue.
In one embodiment, configuration download module 421 obtains the identification information of application example, according to identification information from matching It sets center and downloads configuration file corresponding with application example.Data obtaining module 424 obtains preset configuration relevant information, In, configuration relevant information includes: configuration center information, application example starting strategy, identification information etc..
Data obtaining module 424 examines the legitimacy of configuration relevant information, if examining failure, configuring Agent terminates Operation obtains the command parameter for application example, command parameter includes: journal file store path if examined successfully Deng.Log update module 425 tests to the legitimacy of command parameter, if examined successfully, opens log update thread, For log to be written in journal file indicated by journal file store path.
It configures download module 421 and obtains ownship information, ownship information includes: the IP address of the machine, host name etc..Under configuration Connection of the module 421 based on configuration center information and ownship information foundation and configuration center is carried, judges that connection is successfully established, such as Fruit is then to download newest configuration file.Configuration download module 421 creates the first Znode on Zookeeper, for identifying Configuration file is used in application example.
Download module 421 is configured if it is determined that connection foundation failure, then re-establish the connection with configuration center, work as determination The number that failure is established in connection reaches preset frequency threshold value, then configuring Agent terminates to run.Update module 422 is configured to monitor Upper twoth ZNode corresponding with configuration file of Zookeeper.If determining that change occurs for configuration file simultaneously based on the 2nd ZNode It issues successfully, configuration update module 422 downloads updated configuration file from configuration center automatically, to replace original configuration File.
Instance processes module 423 determines the parameter modified in configuration file, based on application example restart strategy and by The parameter of modification judges whether to need to restart application example, if it is, configuration Agent restarts application example.
In one embodiment, the disclosure provides a kind of distributed system, including the distribution in any embodiment as above The configuration device of application.
Fig. 5 is the module diagram according to another embodiment of the configuration device of Distributed Application disclosed by the invention. As shown in figure 5, the device may include memory 51, processor 52, communication interface 53 and bus 54.Memory 51 is for storing Instruction, processor 52 are coupled to memory 51, and the instruction execution that processor 52 is configured as storing based on memory 51 is realized The configuration method for the Distributed Application stated.
Memory 51 can be high speed RAM memory, nonvolatile memory (NoN-volatile memory) etc., deposit Reservoir 51 is also possible to memory array.Memory 51 is also possible to by piecemeal, and block can be combined into virtually by certain rule Volume.Processor 52 can be central processor CPU or application-specific integrated circuit ASIC (Application Specific Integrated Circuit), or it is arranged to implement one of the configuration method of Distributed Application disclosed by the invention Or multiple integrated circuits.
In one embodiment, the disclosure also provides a kind of computer readable storage medium, wherein computer-readable storage Media storage has computer instruction, and matching for the Distributed Application that any embodiment as above is related to is realized in instruction when being executed by processor Set method.It should be understood by those skilled in the art that, embodiment of the disclosure can provide as method, apparatus or computer program Product.Therefore, complete hardware embodiment, complete software embodiment or reality combining software and hardware aspects can be used in the disclosure Apply the form of example.Moreover, it wherein includes the computer of computer usable program code that the disclosure, which can be used in one or more, The calculating implemented in non-transient storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) can be used The form of machine program product.
The disclosure is reference according to the method for the embodiment of the present disclosure, the flow chart of equipment (system) and computer program product And/or block diagram describes.It should be understood that each process in flowchart and/or the block diagram can be realized by computer program instructions And/or the combination of the process and/or box in box and flowchart and/or the block diagram.It can provide these computer programs to refer to Enable the processor of general purpose computer, special purpose computer, Embedded Processor or other programmable data processing devices to generate One machine so that by the instruction that the processor of computer or other programmable data processing devices executes generate for realizing The device for the function of being specified in one or more flows of the flowchart and/or one or more blocks of the block diagram.
So far, the disclosure is described in detail.In order to avoid covering the design of the disclosure, it is public that this field institute is not described The some details known.Those skilled in the art as described above, completely it can be appreciated how implementing technology disclosed herein Scheme.
Configuration method, device and the distributed system of Distributed Application provided by the above embodiment, Agent is from matching for configuration Center is set to download configuration file corresponding with application example and store;If it is determined that being stored in the configuration file hair of configuration center It changes more, then Configuration Agent Agent downloads updated configuration file, restarts strategy, execution pair based on preset application example In the reboot operation of application example;By configuring Agent independent operating, from configuration center server-side download configuration file, monitor Update, starting/stopping application example of configuration file etc., reduce maintenance cost, improve the stability of system;For principal and subordinate The heterogeneous system of structure, it is only necessary to which the configuration of a small amount of modification configuration Agent can be realized configuration and pull automatically;It is not only limited to same The group system of structure can be widely applied to large-scale distributed system, realizes to Legacy System, heterogeneous system and matches without intrusionization access It sets.
Disclosed method and system may be achieved in many ways.For example, can by software, hardware, firmware or Software, hardware, firmware any combination realize disclosed method and system.The said sequence of the step of for method is only In order to be illustrated, the step of disclosed method, is not limited to sequence described in detail above, especially says unless otherwise It is bright.In addition, in some embodiments, also the disclosure can be embodied as to record program in the recording medium, these programs include For realizing according to the machine readable instructions of disclosed method.Thus, the disclosure also covers storage for executing according to this public affairs The recording medium of the program for the method opened.
The description of the disclosure is given for the purpose of illustration and description, and is not exhaustively or by the disclosure It is limited to disclosed form.Many modifications and variations are obvious for the ordinary skill in the art.It selects and retouches Embodiment is stated and be the principle and practical application in order to more preferably illustrate the disclosure, and those skilled in the art is enable to manage The solution disclosure is to design various embodiments suitable for specific applications with various modifications.

Claims (23)

1. a kind of configuration method of Distributed Application, comprising:
Start configuration Agent corresponding with application example;
The configuration Agent and configuration center establish connection, download from the configuration center corresponding with the application example Configuration file simultaneously stores;
If the configuration Agent determines that the configuration file for being stored in the configuration center changes, the configuration Agent and the configuration center establish connection and download the updated configuration file;
The configuration Agent is based on preset application example and restarts strategy, executes the reboot operation for the application example.
2. the method for claim 1, wherein further include:
The configuration Agent obtains the identification information of the application example;
The configuration Agent downloads configuration corresponding with the application example from the configuration center according to the identification information File.
3. method according to claim 2, wherein further include:
The configuration Agent obtains preset configuration relevant information, wherein the configuration relevant information includes: configuration center letter Breath, application example starting strategy, the identification information;
The configuration Agent examines the legitimacy of the configuration relevant information, if examining failure, the configuration Agent knot Shu Yunhang, if examined successfully, the configuration Agent obtains the command parameter for the application example, the order ginseng Number includes: journal file store path;
The configuration Agent tests to the legitimacy of the command parameter, if examined successfully, opens log update line Journey, for log to be written in journal file indicated by the journal file store path.
4. method as claimed in claim 3, wherein described corresponding with the application example from configuration center downloading Configuration file includes:
The configuration Agent obtains ownship information, wherein the ownship information includes: the IP address of the machine, host name;
The configuration Agent establishes the company with the configuration center based on the configuration center information and the ownship information It connects;
The configuration Agent judges that the connection is successfully established, if it is, the newest configuration file of downloading;
The configuration Agent creates the first Znode on Zookeeper, for identify the application example be used it is described Configuration file.
5. method as claimed in claim 4, wherein further include:
If the configuration Agent judges that failure is established in the connection, the connection with the configuration center is re-established;
When determining that connecting the number for establishing failure reaches preset frequency threshold value, then the configuration Agent terminates to run.
6. method as claimed in claim 4, wherein the configuration Agent and the configuration center are established connection and downloaded more The configuration file after new includes:
The configuration Agent monitors twoth ZNode corresponding with the configuration file on Zookeeper;
If determining the configuration file generation change based on the 2nd ZNode and issuing success, automatically from the configuration The heart downloads the updated configuration file, to replace original configuration file.
7. the method for claim 1, wherein the configuration Agent restarts strategy, execution based on preset application example Reboot operation for the application example includes:
The configuration Agent determines the parameter modified in the configuration file, based on the application example restart strategy and The parameter modified judges whether to need to restart the application example, if it is, the configuration Agent restarts described answer Use example.
8. the method for claim 1, wherein
The configuration Agent is to be arranged in a one-to-one correspondence with the application example, wherein the configuration Agent corresponding institute Application example is stated to be deployed in same server or container.
9. the method for claim 1, wherein
The configuration Agent is run as independent process;Start in the configuration Agent and downloads institute from the configuration center After stating configuration file and storing, the configuration Agent starts the corresponding application example.
10. the method for claim 1, wherein
The configuration Agent obtains the locally specified catalogue of the configuration file, and the configuration file is stored in the local Under specified directory.
11. a kind of configuration device of Distributed Application, comprising:
Starting module is acted on behalf of, for starting configuration Agent corresponding with application example;
The configuration Agent, comprising:
Download module is configured, for establishing connection with configuration center, is downloaded from the configuration center opposite with the application example The configuration file answered and storage;
Configure update module, for if it is determined that the configuration file for being stored in the configuration center changes, then with institute Configuration center is stated to establish connection and download the updated configuration file;
Instance processes module, for restarting strategy based on preset application example, execution restarts behaviour for the application example Make.
12. device as claimed in claim 11, wherein
The configuration download module is matched according to the identification information from described for obtaining the identification information of the application example It sets center and downloads configuration file corresponding with the application example.
13. device as claimed in claim 12, wherein
The configuration Agent, comprising:
Data obtaining module, for obtaining preset configuration relevant information, wherein the configuration relevant information includes: in configuration Heart information, application example starting strategy, the identification information;The legitimacy for examining the configuration relevant information, if inspection Testing failure, then the configuration Agent terminates to run, if examined successfully, the command parameter for the application example is obtained, The command parameter includes: journal file store path;
Log update module is tested for the legitimacy to the command parameter, if examined successfully, opens log brush New thread, for log to be written in journal file indicated by the journal file store path.
14. device as claimed in claim 13, wherein
The configuration download module, for obtaining ownship information, wherein the ownship information includes: the IP address of the machine, host Name;The connection with the configuration center is established based on the configuration center information and the ownship information;Judge the connection It is successfully established, if it is, the newest configuration file of downloading;The first Znode is created on Zookeeper, for identifying The configuration file is used in the application example.
15. device as claimed in claim 14, wherein further include:
The configuration download module is used for if it is determined that connection foundation failure, then re-establish and the configuration center Connection;Wherein, when determining that connecting the number for establishing failure reaches preset frequency threshold value, then the configuration Agent terminates to run.
16. device as claimed in claim 14, wherein
The configuration update module, for monitoring twoth ZNode corresponding with the configuration file on Zookeeper;If base The configuration file generation change is determined in the 2nd ZNode and issues success, is downloaded and is updated from the configuration center automatically The configuration file afterwards, to replace original configuration file.
17. device as claimed in claim 11, wherein
The instance processes module is restarted for determining the parameter modified in the configuration file based on the application example The tactful and described parameter modified judges whether to need to restart the application example, if it is, configuration Agent weight Open the application example.
18. device as claimed in claim 11, wherein
The configuration Agent is to be arranged in a one-to-one correspondence with the application example, wherein the configuration Agent corresponding institute Application example is stated to be deployed in same server or container.
19. device as claimed in claim 11, wherein
The configuration Agent is run as independent process;Start in the configuration Agent and downloads institute from the configuration center After stating configuration file and storing, the configuration Agent starts the corresponding application example.
20. device as claimed in claim 11, wherein
The configuration download module obtains the locally specified catalogue of the configuration file, and the configuration file is stored in described Under ground specified directory.
21. a kind of distributed system, wherein include:
Such as the configuration device of the described in any item Distributed Applications of claim 11 to 20.
22. a kind of configuration device of Distributed Application, wherein include:
Memory;And it is coupled to the processor of the memory, the processor is configured to based on the storage is stored in Instruction in device executes the configuration method of the Distributed Application as described in any one of claims 1 to 10.
23. a kind of computer readable storage medium, is stored thereon with computer program instructions, which is handled by one or more The step of method described in claims 1 to 10 any one is realized when device executes.
CN201711419029.3A 2017-12-25 2017-12-25 Configuration method and device of distributed application and distributed system Active CN109976822B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711419029.3A CN109976822B (en) 2017-12-25 2017-12-25 Configuration method and device of distributed application and distributed system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711419029.3A CN109976822B (en) 2017-12-25 2017-12-25 Configuration method and device of distributed application and distributed system

Publications (2)

Publication Number Publication Date
CN109976822A true CN109976822A (en) 2019-07-05
CN109976822B CN109976822B (en) 2022-04-08

Family

ID=67070978

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711419029.3A Active CN109976822B (en) 2017-12-25 2017-12-25 Configuration method and device of distributed application and distributed system

Country Status (1)

Country Link
CN (1) CN109976822B (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110874263A (en) * 2019-11-06 2020-03-10 北京宝兰德软件股份有限公司 Method and device for monitoring instances of docker container
CN111309390A (en) * 2020-01-19 2020-06-19 维沃移动通信有限公司 Method for acquiring configuration information and electronic equipment
CN111343026A (en) * 2020-03-09 2020-06-26 杭州迪普科技股份有限公司 Electronic device and configuration importing method thereof
CN111338832A (en) * 2020-02-17 2020-06-26 中国农业银行股份有限公司 Data processing method and device
CN111654532A (en) * 2020-05-08 2020-09-11 国云科技股份有限公司 Centralized management system, method and device for configuration files
CN111708557A (en) * 2020-05-26 2020-09-25 北京金山云网络技术有限公司 Method, device and storage medium for updating configuration file
CN112003918A (en) * 2020-08-14 2020-11-27 济南浪潮数据技术有限公司 Method, apparatus, device and medium for configuration synchronization between container application and client
CN112835650A (en) * 2021-03-18 2021-05-25 南威软件股份有限公司 Method and system for realizing system parameter unified configuration real-time effect
CN113157332A (en) * 2021-03-24 2021-07-23 深圳依时货拉拉科技有限公司 PHP dynamic configuration automatic validation method and system
CN113626095A (en) * 2021-06-29 2021-11-09 欧电云信息科技(江苏)有限公司 Switching method and switching system of configuration center, electronic equipment and storage medium

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7228306B1 (en) * 2002-12-31 2007-06-05 Emc Corporation Population of discovery data
WO2011069730A1 (en) * 2009-12-10 2011-06-16 International Business Machines Corporation A method and system for managing configurations of system management agents in a distributed environment
CN104243515A (en) * 2013-06-13 2014-12-24 中兴通讯股份有限公司 Method and device for processing configuration information
CN104536785A (en) * 2014-12-23 2015-04-22 北京国双科技有限公司 Method and device for updating real-time system
CN105320527A (en) * 2014-06-12 2016-02-10 中兴通讯股份有限公司 Configuration file renewing method, device and system based on zookeeper distributed type search engine
CN105592127A (en) * 2014-11-20 2016-05-18 中国银联股份有限公司 Application management system for cloud computing environment
US20160191613A1 (en) * 2014-12-31 2016-06-30 Juniper Networks, Inc. Policy based framework for application management in a network device having multiple packet-processing nodes
US20160359704A1 (en) * 2015-06-05 2016-12-08 Cisco Technology, Inc. High availability of collectors of traffic reported by network sensors
CN106371932A (en) * 2013-10-11 2017-02-01 北京奇虎科技有限公司 Information configuration method and device based on zookeeper
US20170163479A1 (en) * 2015-12-02 2017-06-08 Le Holdings (Beijing) Co., Ltd. Method, Device and System of Renewing Terminal Configuration In a Memcached System
CN106815012A (en) * 2016-12-14 2017-06-09 深圳中顺易金融服务有限公司 Decentralized configuration Explore of Unified Management Ideas and system based on Zookeeper

Patent Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7228306B1 (en) * 2002-12-31 2007-06-05 Emc Corporation Population of discovery data
WO2011069730A1 (en) * 2009-12-10 2011-06-16 International Business Machines Corporation A method and system for managing configurations of system management agents in a distributed environment
CN104243515A (en) * 2013-06-13 2014-12-24 中兴通讯股份有限公司 Method and device for processing configuration information
CN106371932A (en) * 2013-10-11 2017-02-01 北京奇虎科技有限公司 Information configuration method and device based on zookeeper
CN105320527A (en) * 2014-06-12 2016-02-10 中兴通讯股份有限公司 Configuration file renewing method, device and system based on zookeeper distributed type search engine
CN105592127A (en) * 2014-11-20 2016-05-18 中国银联股份有限公司 Application management system for cloud computing environment
CN104536785A (en) * 2014-12-23 2015-04-22 北京国双科技有限公司 Method and device for updating real-time system
US20160191613A1 (en) * 2014-12-31 2016-06-30 Juniper Networks, Inc. Policy based framework for application management in a network device having multiple packet-processing nodes
US20160359704A1 (en) * 2015-06-05 2016-12-08 Cisco Technology, Inc. High availability of collectors of traffic reported by network sensors
US20170163479A1 (en) * 2015-12-02 2017-06-08 Le Holdings (Beijing) Co., Ltd. Method, Device and System of Renewing Terminal Configuration In a Memcached System
CN106815012A (en) * 2016-12-14 2017-06-09 深圳中顺易金融服务有限公司 Decentralized configuration Explore of Unified Management Ideas and system based on Zookeeper

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
袁子淇: "基于ZooKeeper的集群应用配置管理的设计与实现", 《中国优秀硕士学位论文全文数据库 信息科技辑》 *

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110874263A (en) * 2019-11-06 2020-03-10 北京宝兰德软件股份有限公司 Method and device for monitoring instances of docker container
CN110874263B (en) * 2019-11-06 2022-07-29 北京宝兰德软件股份有限公司 Method and device for monitoring instances of docker container
CN111309390A (en) * 2020-01-19 2020-06-19 维沃移动通信有限公司 Method for acquiring configuration information and electronic equipment
CN111338832A (en) * 2020-02-17 2020-06-26 中国农业银行股份有限公司 Data processing method and device
CN111343026A (en) * 2020-03-09 2020-06-26 杭州迪普科技股份有限公司 Electronic device and configuration importing method thereof
WO2021223471A1 (en) * 2020-05-08 2021-11-11 国云科技股份有限公司 Configuration file centralized management system, method and apparatus
CN111654532A (en) * 2020-05-08 2020-09-11 国云科技股份有限公司 Centralized management system, method and device for configuration files
CN111708557A (en) * 2020-05-26 2020-09-25 北京金山云网络技术有限公司 Method, device and storage medium for updating configuration file
CN111708557B (en) * 2020-05-26 2024-01-26 北京金山云网络技术有限公司 Method, device and storage medium for updating configuration file
CN112003918A (en) * 2020-08-14 2020-11-27 济南浪潮数据技术有限公司 Method, apparatus, device and medium for configuration synchronization between container application and client
CN112003918B (en) * 2020-08-14 2023-01-24 济南浪潮数据技术有限公司 Method, device, equipment and medium for configuration synchronization between container application and client
CN112835650A (en) * 2021-03-18 2021-05-25 南威软件股份有限公司 Method and system for realizing system parameter unified configuration real-time effect
CN113157332A (en) * 2021-03-24 2021-07-23 深圳依时货拉拉科技有限公司 PHP dynamic configuration automatic validation method and system
CN113626095A (en) * 2021-06-29 2021-11-09 欧电云信息科技(江苏)有限公司 Switching method and switching system of configuration center, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN109976822B (en) 2022-04-08

Similar Documents

Publication Publication Date Title
CN109976822A (en) Configuration method, device and the distributed system of Distributed Application
US10802951B2 (en) Systems and methods of integrated testing and deployment in a continuous integration continuous deployment (CICD) system
US9515953B2 (en) Virtual computing environments
US10326645B2 (en) System and methods for configuration management
US20170161059A1 (en) Management of multiple application programming interface versions for development environments
US20060037016A1 (en) Methods and systems for modifying nodes in a cluster environment
WO2017019684A1 (en) Techniques for evaluating server system reliability, vulnerability and component compatibility using crowdsourced server and vulnerability data
US10817267B2 (en) State machine representation of a development environment deployment process
US7370101B1 (en) Automated testing of cluster data services
US20130246838A1 (en) Discovering boot order sequence of servers belonging to an application
CN107153571A (en) A kind of dispositions method and device of virtual management node
CN106657167A (en) Management server, server cluster and management method
US10120707B2 (en) Deployment of development environments
US20030103310A1 (en) Apparatus and method for network-based testing of cluster user interface
US20190386886A1 (en) Method and system for virtual network service activation
CN109491886A (en) Compatibility test method, device, electronic equipment and storage medium
US11853277B2 (en) Model ML registry and model serving
US10997042B2 (en) Systems and methods for configuration management
Huang et al. PDA: A Tool for Automated Problem Determination.
US10019272B1 (en) Virtual appliance manager
US9798608B2 (en) Recovery program using diagnostic results
US10394534B2 (en) Framework for flexible logging of development environment deployment
Dell
CN105607878B (en) A kind of log Method of printing and its equipment
Jebbar et al. Regression Test Suite Reduction for Cloud Systems

Legal Events

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

Effective date of registration: 20220126

Address after: 100007 room 205-32, floor 2, building 2, No. 1 and No. 3, qinglonghutong a, Dongcheng District, Beijing

Applicant after: Tianyiyun Technology Co.,Ltd.

Address before: No.31, Financial Street, Xicheng District, Beijing, 100033

Applicant before: CHINA TELECOM Corp.,Ltd.

GR01 Patent grant
GR01 Patent grant