CN109947451A - A kind of cluster application file updating method, system, medium and equipment - Google Patents

A kind of cluster application file updating method, system, medium and equipment Download PDF

Info

Publication number
CN109947451A
CN109947451A CN201910227239.5A CN201910227239A CN109947451A CN 109947451 A CN109947451 A CN 109947451A CN 201910227239 A CN201910227239 A CN 201910227239A CN 109947451 A CN109947451 A CN 109947451A
Authority
CN
China
Prior art keywords
file
configuration file
configuration
modification time
path
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
CN201910227239.5A
Other languages
Chinese (zh)
Other versions
CN109947451B (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.)
Beijing Si Tech Information Technology Co Ltd
Original Assignee
Beijing Si Tech Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Si Tech Information Technology Co Ltd filed Critical Beijing Si Tech Information Technology Co Ltd
Priority to CN201910227239.5A priority Critical patent/CN109947451B/en
Publication of CN109947451A publication Critical patent/CN109947451A/en
Application granted granted Critical
Publication of CN109947451B publication Critical patent/CN109947451B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present invention relates to a kind of cluster application file updating method, system, medium and equipment, this method comprises: traversing the position ID recorded in deployed position listed files and corresponding deployed position one by one;The file content of the corresponding attribute configuration file of current configuration file is read in, and is parsed into the configuration variables value list being grouped by the position ID;The variate-value in the file content of presently described configuration file is replaced with into the configuration variables value in the corresponding configuration variables value list according to each position ID respectively, and generates file to be sent;Distribute the file to be sent by the deployed position.The present invention can have the configuration file of different local contents to carry out unified distribution to different target position, reduce the workload of maintenance clustered software configuration file, while reduce the probability that repeats to modify by hand and malfunction, and improve the speed of distribution of document.

Description

A kind of cluster application file updating method, system, medium and equipment
Technical field
The present invention relates to software technology fields, and in particular to a kind of cluster application file updating method, system, medium and sets It is standby.
Background technique
In the managing and maintaining of software application cluster, the update of program and configuration file in multiple main frames is usually had, In the case where each node file is identical, by the calling of shell script one by one scp, (one is connected based on SSH for this work Across the Hosts file delivery means connect) it can complete, but partial profiles may be according to deployment position in some cases Set different, for such configuration file, deployment and later maintenance are all the things of a trouble and high risk: reservation is more Part file, is modified one by one by hand, is then passed through scp and is distributed.
This process is to be very easy to error, and modify crowd the problem is that the manual multiple similar files of modification Multifile is also the thing of time and effort consuming, has the cluster of a up to a hundred hosts under the imagination, because of the configuration that this kind of opsition dependent is different Some parameter needs to adjust in file, and host one by one of having to is climbed up modification file by hand and then saved, this process Reliability is relatively low.
Summary of the invention
In view of the above technical problems, the present invention provides a kind of cluster application file updating method, system, medium and equipment.
The technical scheme to solve the above technical problems is that a kind of cluster application file updating method, comprising:
S1. the position ID recorded in deployed position listed files and corresponding deployed position are traversed one by one;
S2. the file content of the corresponding attribute configuration file of current configuration file is read in, and is parsed by the position ID The configuration variables value list of grouping;
S3. the variate-value in the file content of presently described configuration file is replaced with according to each position ID respectively Configuration variables value in the corresponding configuration variables value list, and generate file to be sent;
S4. distribute the file to be sent by the deployed position.
For achieving the above object, the present invention also provides a kind of cluster application file more new systems, comprising:
Spider module, for traversing the position ID recorded in deployed position listed files and corresponding deployed position one by one;
Parsing module, for reading in the file content of the corresponding attribute configuration file of current configuration file, and be parsed by The configuration variables value list of the position ID grouping;
Generation module, for respectively according to each position ID by the change in the file content of presently described configuration file Magnitude replaces with the configuration variables value in the corresponding configuration variables value list, and generates file to be sent;
Distribution module, for distributing the file to be sent by the deployed position.
The present invention also provides a kind of computer readable storage mediums, including instruction, when described instruction is run on computers When, so that the computer is executed the above method.
The present invention also provides a kind of computer equipment, including memory, processor and be stored on the memory and The computer program that can be run on the processor, the processor realize the above method when executing described program.
The beneficial effects of the present invention are: can there is the configuration file of different local contents to carry out unified point to different target position Hair, reduces the workload of maintenance clustered software configuration file, while reducing the probability that repeats to modify by hand and malfunction, and improves distribution The speed of file.
Detailed description of the invention
Fig. 1 is a kind of flow chart of cluster application file updating method provided in an embodiment of the present invention;
Fig. 2 is the flow chart figure of another cluster application file updating method provided in an embodiment of the present invention;
Fig. 3 is a kind of flow chart figure of cluster application file more new system provided in an embodiment of the present invention;
Fig. 4 is the flow chart figure of another cluster application file more new system provided in an embodiment of the present invention.
Specific embodiment
The principle and features of the present invention will be described below with reference to the accompanying drawings, and the given examples are served only to explain the present invention, and It is non-to be used to limit the scope of the invention.
Fig. 1 is a kind of flow chart of cluster application file updating method provided in an embodiment of the present invention, as shown in Figure 1, should Method includes:
101. traversing the position ID recorded in deployed position listed files and corresponding deployed position one by one;
Specifically, deployed position listed files (deploy_pos.txt) is a text file, one deployment position of a line Set, each column meaning is respectively: position ID, host ip and port, target directory are logged in a manner of pubkey-ssh to end main frame Private key file path.Specific format is as follows:<pos_id>,<host-port>,<host-user>,<target-path>,< private_key_file>
102. reading in the file content of the corresponding attribute configuration file of current configuration file, and it is parsed into opsition dependent ID grouping Configuration variables value list;
Specifically, having the configuration file<conf-file>of different local contents to different target position, under same catalogue There are a same filenames+" attribute configuration file<conf-file>.proplist of .proplist ", this file saves The configuration information of each deployment point difference, with the preservation of json format.It is wherein corresponding under each deployed position pos_id to need to configure Variable name and corresponding variate-value.
Attribute configuration file example format is as follows:
{
“<pos_id-1>”:{“<prop-name1>”:”<prop-value1>”,“<prop-name2>”:”<prop- value2>”,…},
“<pos_id-2>”:{“<prop-name1>”:”<prop-value1>”,“<prop-name2>”:”<prop- value2>”,…},
}
Position ID in each attribute configuration file, i.e. pos_id are required and the pos_id mono- in deploy_pos.txt One is corresponding, to be configuration file of each deployed position by filling variable generation differentiation in subsequent step.
103. the variate-value in the file content of current configuration file is replaced with according to each position ID respectively corresponding Configuration variables value in configuration variables value list, and generate file to be sent;
Configuration file<conf-file>format is respectively different according to different cluster applications, needs in former documentary base It is adjusted on plinth, the position for needing difference to handle hereof is configured to the variable name surrounded with #::#, is configured by comparing With the variable name in the variable name and configuration variables value list postponed in file, after comparing successfully, by variable name in configuration file Variate-value replace with the variate-value of corresponding variable name in middle configuration variables value list.For each position ID, Corresponding file to be sent is generated as procedure described above.Wherein, to the variable replacement in configuration file, character string time can be used Matched mode is gone through, replacement process can also be simplified using the template replacement software module of open source.
Format sample is following (part):
Ble.id.seq=#:ble_id_seq:#
Zookeeper.ble.path.temp=/idmm/ble_bak
Ble.default.priority=100
Ble.request.timeout=60000
Netty.listen.hostname=0.0.0.0
104. distributing file to be sent by deployed position.
Specifically, for each file to be distributed, according to deployed position list, according to the position of its configuration one by one with scp Distribution.Detailed process is, with the corresponding host address of scp connection pos_id, it is corresponding to pos_id then to send file to be sent Target directory.
A kind of cluster application file updating method provided in an embodiment of the present invention, can there is different parts to different target position The configuration file of content carries out unified distribution, reduces the workload of maintenance clustered software configuration file, while reducing manual repetition The probability of modification and error, improves the speed of distribution of document.
Optionally, as an embodiment of the present invention, as shown in Fig. 2, this method comprises:
201. read deployment listed files, when reading the wherein file path of each configuration file and the first modification line by line Between;
Specifically, deployment file list (deploy_files.txt) is a text file, every a line records one and matches File is set, first row is the filename with relative path, and second is classified as the filemodetime stamp of preservation, and format sample is such as Under: path/to/file<timestamp of file last modified>
202. check under the file path of current configuration file with the presence or absence of attribute configuration file corresponding with configuration file;
Specifically, it is identical as configuration file to search whether that there are filenames, but have under the file path of configuration file The attribute configuration file of " .proplist ".
203. if there is corresponding attribute configuration file, then takes current configuration file and corresponding attribute configuration text respectively The last modification time of part, using the time wherein the latest as the second modification time;If there is no corresponding attribute configuration text Part then directly acquires the last modification time of current configuration file as the second modification time;
If 204. first modification times are no earlier than the second modification time, 205 are gone to step;If when the first modification Between earlier than the second modification time, then the file path of current configuration file and the second modification time are stored in file to be distributed and arranged Table;
Specifically, illustrating that the modification file is not newest repairs if the first modification time is no earlier than the second modification time The file changed continues the file path and the first modification time that read next configuration file in deployment listed files, by upper Step is stated, it can be by the corresponding attribute configuration file of the file path of configuration file and the configuration file (if deposited ) in true modification time the latest be stored in listed files to be distributed.
Whether 205. judge to dispose all configuration files in listed files, which traverses, terminates, if so then execute step 206, otherwise Return step 201;
206. traverse the position ID recorded in deployed position listed files and corresponding deployed position one by one;
207. read the file path of configuration file and the second modification time in listed files to be distributed line by line;
208. check under the file path of current configuration file with the presence or absence of corresponding attribute configuration file;
If thening follow the steps 210 there are corresponding attribute configuration file under the file path of 209. current configuration files; If corresponding attribute configuration file is not present under the file path of current configuration file, using current configuration file as pending Send file;
210. read in the file content of the corresponding attribute configuration file of current configuration file, and are parsed into opsition dependent ID grouping Configuration variables value list;
211. the variate-value in the file content of current configuration file is replaced with according to each position ID respectively it is corresponding Configuration variables value in configuration variables value list, and generate file to be sent;
212. distribute file to be sent by deployed position;
213., which judge in listed files to be distributed whether all configuration files traverse, terminates, no if so then execute step 214 Then return step 207;
214. update the first modification time of all configuration files in deployment listed files.
It is illustrated in figure 3 a kind of cluster application file more new system provided in an embodiment of the present invention, it is each in the system The principle of work and power of module is described in detail in foregoing teachings, repeats no more below.
The system includes:
Spider module, for traversing the position ID recorded in deployed position listed files and corresponding deployed position one by one;
Parsing module, for reading in the file content of the corresponding attribute configuration file of current configuration file, and be parsed by The configuration variables value list of position ID grouping;
Generation module, for respectively replacing the variate-value in the file content of current configuration file according to each position ID For the configuration variables value in corresponding configuration variables value list, and generate file to be sent;
Distribution module, for distributing file to be sent by deployed position.
Optionally, in this embodiment, as shown in Fig. 2, the system further include:
Read module, for read in parsing module the corresponding attribute configuration file of current configuration file file content it Before, deployment listed files is read, reads the wherein file path of each configuration file and the first modification time line by line;
First checks module, whether there is under the file path for checking current configuration file corresponding with configuration file Attribute configuration file;
First comparison module then takes current configuration file and right for if there is corresponding attribute configuration file respectively The last modification time for the attribute configuration file answered, using the time wherein the latest as the second modification time;
Second comparison module reads deployment file column if being no earlier than the second modification time for the first modification time The file path of next configuration file and the first modification time in table;If the first modification time earlier than the second modification time, The file path of current configuration file and the second modification time are then stored in listed files to be distributed.
Optionally, in this embodiment, as shown in Fig. 2, the system further include:
Second checks module, after all configuration files in having traversed deployment file list, is read line by line wait divide The file path of configuration file and the second modification time in fat file list, check under the file path of current configuration file whether There are corresponding attribute configuration files;
Parsing module, if for, there are corresponding attribute configuration file, being read under the file path of current configuration file Enter the file content of the corresponding attribute configuration file of current configuration file, and is parsed into the configuration variables value column of opsition dependent ID grouping Table.
Optionally, in this embodiment, the first comparison module, if be also used under the file path of current configuration file not There are corresponding attribute configuration file, then the last modification time of current configuration file is directly acquired as the second modification time, Using current configuration file as file to be sent.
Optionally, in this embodiment, as shown in Fig. 2, the system further include:
Update module, for updating the first modification time of all configuration files in deployment listed files.
The present invention also provides a kind of computer readable storage mediums, including instruction to make when instruction is run on computers Computer executes the method and step in above method embodiment;Or each software module of storage the above system embodiment is corresponding Instruction.
The present invention also provides a kind of computer equipment, including memory, processor and storage on a memory and can be The computer program run on processor, processor realize the method and step in above method embodiment when executing program.
One application specific example of the invention is as follows:
In telecom business support system, the own message-oriented middleware application cluster of deployment has in configuration file pair The Connecting quantity of oracle, and oracle uses a library multiple instances deployment mode, wants in each client configuration parameter It asks and is all configured whole instance address in a manner of fail-over, but in order to enable each example have more balanced access number, It also requires the sequential rotation of the address list on each clustered node to intersect, therefore the configuration file of each position is made to have difference.
Actual deployment configuration bibliographic structure is as follows:
./config/ble:
server-ble-oracle.properties server-ble.xml
logback.xml server-ble-jdbc.xml
server-ble-oracle.properties.proplist
./config/broker:
authorization.xml server-oracle.properties.proplist
server-oracle.properties spring-jdbc-ble-not-found.xml
spring-metrics.xml
Wherein there is two files for there are different local contents by distribution position, config/ble/server-ble- Oracle.properties and config/broker/server-oracle.properties has correspondence under respective catalogue Same file name and the file for adding .proplist suffix, had both saved the change that replace in corresponding configuration file in this document The parameter of amount.
The foregoing is merely presently preferred embodiments of the present invention, is not intended to limit the invention, it is all in spirit of the invention and Within principle, any modification, equivalent replacement, improvement and so on be should all be included in the protection scope of the present invention.

Claims (10)

1. a kind of cluster application file updating method characterized by comprising
S1. the position ID recorded in deployed position listed files and corresponding deployed position are traversed one by one;
S2. the file content of the corresponding attribute configuration file of current configuration file is read in, and is parsed into and is grouped by the position ID Configuration variables value list;
S3. the variate-value in the file content of presently described configuration file is replaced with into correspondence according to each position ID respectively The configuration variables value list in configuration variables value, and generate file to be sent;
S4. distribute the file to be sent by the deployed position.
2. the method according to claim 1, wherein before executing step S2 further include:
Sa. deployment listed files is read, reads the wherein file path of each configuration file and the first modification time line by line;
Sb. it checks under the file path of presently described configuration file with the presence or absence of attribute configuration text corresponding with the configuration file Part;
Sc. if there is corresponding attribute configuration file, then presently described configuration file and the corresponding attribute is taken to match respectively The last modification time for setting file, using the time wherein the latest as the second modification time;
Sd. if first modification time is no earlier than second modification time, under reading in the deployment file list The file path and the first modification time of one configuration file;If first modification time is earlier than the described second modification Between, then the file path of presently described configuration file and the second modification time are stored in listed files to be distributed;
Se. circulation executes step Sa to Sd, until having traversed all configuration files in the deployment file list.
3. according to the method described in claim 2, it is characterized in that, after step Se further include:
Sf. the file path and the second modification time of configuration file in the listed files to be distributed are read line by line, are checked current It whether there is corresponding attribute configuration file under the file path of the configuration file;
Sg. if thening follow the steps S2 extremely there are corresponding attribute configuration file under the file path of presently described configuration file S4;
Sh. circulation executes step Sf and Sg, until having traversed all configuration files in the listed files to be distributed.
4. according to the method described in claim 2, it is characterized by further comprising:
If corresponding attribute configuration file is not present under the file path of presently described configuration file, then current institute is directly acquired The last modification time of configuration file is stated as the second modification time, using presently described configuration file as file to be sent.
5. the method according to claim 3 or 4, which is characterized in that after step Sh, further includes:
Si. the first modification time of all configuration files in the deployment file list is updated.
6. a kind of cluster application file more new system characterized by comprising
Spider module, for traversing the position ID recorded in deployed position listed files and corresponding deployed position one by one;
Parsing module for reading in the file content of the corresponding attribute configuration file of current configuration file, and is parsed by described The configuration variables value list of position ID grouping;
Generation module, for respectively according to each position ID by the variate-value in the file content of presently described configuration file The configuration variables value in the corresponding configuration variables value list is replaced with, and generates file to be sent;
Distribution module, for distributing the file to be sent by the deployed position.
7. system according to claim 6, which is characterized in that further include:
Read module, for read in the parsing module the corresponding attribute configuration file of current configuration file file content it Before, deployment listed files is read, reads the wherein file path of each configuration file and the first modification time line by line;
First checks module, whether there is and the configuration file pair under the file path for checking presently described configuration file The attribute configuration file answered;
First comparison module then takes presently described configuration file and right for if there is corresponding attribute configuration file respectively The last modification time for the attribute configuration file answered, using the time wherein the latest as the second modification time;
Second comparison module reads the portion if being no earlier than second modification time for first modification time Affix one's name to the file path and the first modification time of next configuration file in listed files;If first modification time is earlier than institute The second modification time is stated, then the file path of presently described configuration file and the second modification time is stored in file to be distributed and arranged Table.
8. system according to claim 7, which is characterized in that further include:
Second checks module, after all configuration files in having traversed the deployment file list, line by line described in reading The file path of configuration file and the second modification time in listed files to be distributed, check the file road of presently described configuration file It whether there is corresponding attribute configuration file under diameter;
The parsing module, if under the file path of presently described configuration file there are corresponding attribute configuration file, The file content of the corresponding attribute configuration file of current configuration file is then read in, and is parsed into the configuration being grouped by the position ID Variable value list.
9. a kind of computer readable storage medium, including instruction, which is characterized in that when described instruction is run on computers, The computer is set to execute method according to claim 1-5.
10. a kind of computer equipment, including memory, processor and be stored on the memory and can be in the processor The computer program of upper operation, which is characterized in that the processor is realized when executing described program such as any one of claim 1-5 The method.
CN201910227239.5A 2019-03-25 2019-03-25 Cluster application file updating method, system, medium and equipment Active CN109947451B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910227239.5A CN109947451B (en) 2019-03-25 2019-03-25 Cluster application file updating method, system, medium and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910227239.5A CN109947451B (en) 2019-03-25 2019-03-25 Cluster application file updating method, system, medium and equipment

Publications (2)

Publication Number Publication Date
CN109947451A true CN109947451A (en) 2019-06-28
CN109947451B CN109947451B (en) 2022-03-15

Family

ID=67011396

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910227239.5A Active CN109947451B (en) 2019-03-25 2019-03-25 Cluster application file updating method, system, medium and equipment

Country Status (1)

Country Link
CN (1) CN109947451B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111666128A (en) * 2020-05-25 2020-09-15 北京思特奇信息技术股份有限公司 Container cluster building system and method

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE3068853D1 (en) * 1979-11-06 1984-09-13 Frederick Electronics Corp A high-speed time share processor for use in a data processing system
CN102662705A (en) * 2012-03-31 2012-09-12 中国工商银行股份有限公司 System and method for upgrading system environment of computer cluster
CN104615466A (en) * 2015-02-05 2015-05-13 广州亦云信息技术有限公司 Cloud platform deployment method and system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE3068853D1 (en) * 1979-11-06 1984-09-13 Frederick Electronics Corp A high-speed time share processor for use in a data processing system
CN102662705A (en) * 2012-03-31 2012-09-12 中国工商银行股份有限公司 System and method for upgrading system environment of computer cluster
CN104615466A (en) * 2015-02-05 2015-05-13 广州亦云信息技术有限公司 Cloud platform deployment method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
刘恩海等: ""集群文件服务系统中的负载均衡算法的研究"", 《计算机工程与设计》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111666128A (en) * 2020-05-25 2020-09-15 北京思特奇信息技术股份有限公司 Container cluster building system and method
CN111666128B (en) * 2020-05-25 2023-07-04 北京思特奇信息技术股份有限公司 Container cluster building system and method

Also Published As

Publication number Publication date
CN109947451B (en) 2022-03-15

Similar Documents

Publication Publication Date Title
US20200218701A1 (en) Consistent data storage in distributed computing systems
US10740352B2 (en) Cooperative naming for configuration items in a distributed configuration management database environment
US11886870B2 (en) Maintaining and updating software versions via hierarchy
US7493518B2 (en) System and method of managing events on multiple problem ticketing system
US9304815B1 (en) Dynamic replica failure detection and healing
US7490265B2 (en) Recovery segment identification in a computing infrastructure
US9053167B1 (en) Storage device selection for database partition replicas
US9489443B1 (en) Scheduling of splits and moves of database partitions
US7496579B2 (en) Transitioning of database service responsibility responsive to server failure in a partially clustered computing environment
US9244958B1 (en) Detecting and reconciling system resource metadata anomolies in a distributed storage system
US7856496B2 (en) Information gathering tool for systems administration
US10177976B2 (en) System and method for configuring network devices
US10243919B1 (en) Rule-based automation of DNS service discovery
US8612383B2 (en) Method and systems for caching objects in a computer system
KR20010109086A (en) Method, system and program products for managing a clustered computing environment
US10230567B2 (en) Management of a plurality of system control networks
US9747291B1 (en) Non-disruptive upgrade configuration translator
CN107797767A (en) One kind is based on container technique deployment distributed memory system and its storage method
CN105227379A (en) A kind of centralized monitor for java web application and method for early warning
CN105635311A (en) Method for synchronizing resource pool information in cloud management platform
CN102355499A (en) Cloud computing system
US7080102B2 (en) Method and system for migrating data while maintaining hard links
CN109710223B (en) API gateway hot plug system based on distributed KV storage system
CN110019539A (en) A kind of method and apparatus that the data of data warehouse are synchronous
CN104360839A (en) Method for automatically migrating LINUX system to WINDOWS system

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
GR01 Patent grant
GR01 Patent grant