CN110795117B - Method, system, electronic device and storage medium for updating configuration file - Google Patents

Method, system, electronic device and storage medium for updating configuration file Download PDF

Info

Publication number
CN110795117B
CN110795117B CN201910859956.XA CN201910859956A CN110795117B CN 110795117 B CN110795117 B CN 110795117B CN 201910859956 A CN201910859956 A CN 201910859956A CN 110795117 B CN110795117 B CN 110795117B
Authority
CN
China
Prior art keywords
configuration file
node
memory
configuration
updated
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.)
Active
Application number
CN201910859956.XA
Other languages
Chinese (zh)
Other versions
CN110795117A (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.)
Ping An Property and Casualty Insurance Company of China Ltd
Original Assignee
Ping An Property and Casualty Insurance Company of China Ltd
Filing date
Publication date
Application filed by Ping An Property and Casualty Insurance Company of China Ltd filed Critical Ping An Property and Casualty Insurance Company of China Ltd
Priority to CN201910859956.XA priority Critical patent/CN110795117B/en
Publication of CN110795117A publication Critical patent/CN110795117A/en
Application granted granted Critical
Publication of CN110795117B publication Critical patent/CN110795117B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The embodiment of the application belongs to the field of big data, and relates to a method, a system, electronic equipment and a storage medium for updating configuration files in real time. The method comprises the following steps: writing a newly built configuration file or an updated configuration file into a first node, wherein a first memory for placing the configuration file is arranged in the first node; acquiring the types of the configuration files, determining the grades of the configuration files according to the types of the configuration files, and configuring preset frequencies according to the grades of the configuration files; creating a second node, and reading configuration files from a first memory of the first node through the second node according to preset frequencies corresponding to the configuration files; writing the configuration file read by the second node into a second memory in real time; and when a request for using the configuration file is received, reading the configuration file from the second memory. According to the application, the configuration file in the first memory is updated to the second memory at regular time, so that the risk of the system is greatly reduced, and the effect of modifying and updating the configuration file in real time is achieved.

Description

Method, system, electronic device and storage medium for updating configuration file
Technical Field
The present application relates to the field of big data technologies, and in particular, to a method, a system, an electronic device, and a storage medium for updating a configuration file.
Background
In recent years, with the rapid development of information technology, software applications and systems have presented many new features and are becoming more and more complex. Often applied to various profiles during business processes, such as: the quotation and insurance process of the car insurance system can be applied to various switch data configurations, mechanism personalized configurations and other related parameters and data in many systems, and the configurations are saved json, properties, xml and other files in consideration of performance and subsequent maintenance. In the prior art, the update of the configuration file is generally realized by the following modes: the method is to read directly from json, properties, xml files, and the like, and the method is to load the data into the memory once when the system is started, and then to acquire the data from the memory when certain configuration or parameter data is needed. However, since the configuration file is loaded only once at the start-up of the system, it is not efficient to take effect at the next restart if the parameter value of a certain configuration needs to be changed at the normal operation of the system.
Disclosure of Invention
The embodiment of the application aims to provide a method, a system, electronic equipment and a storage medium for updating a configuration file, which are convenient for individualized implementation of system operation, and can update newly modified configuration file data into a second memory in real time without restarting the system, thereby achieving the effect of updating the configuration file in real time.
In order to solve the above technical problems, an embodiment of the present application provides a method for updating a configuration file, which adopts the following technical scheme:
A method of updating a configuration file, comprising the steps of:
writing a newly built configuration file or an updated configuration file into a first node, wherein a first memory for placing the configuration file is arranged in the first node;
acquiring the types of the configuration files, determining the grades of the configuration files according to the types of the configuration files, and configuring preset frequencies according to the grades of the configuration files;
Creating a second node, and reading configuration files from a first memory of the first node through the second node according to preset frequencies corresponding to the configuration files;
Writing the configuration file read by the second node into a second memory in real time;
And when a request for using the configuration file is received, reading the configuration file from the second memory.
Further, after the step of writing the newly created configuration file or the updated configuration file into the first node, the method further includes:
Setting a new identifier for the newly built configuration file or the updated configuration file;
The step of reading the configuration file from the first memory of the first node by the second node according to the preset frequency corresponding to each configuration file specifically includes:
Judging whether a new identifier exists in a configuration file of a first memory of the first node;
If the new identifier exists, reading a configuration file corresponding to the new identifier, acquiring a corresponding preset frequency, and reading the configuration file corresponding to the new identifier from a first memory of the first node after the preset frequency is reached.
Further, the step of writing the configuration file into the first node, where the first node is provided with a first memory for storing the configuration file specifically includes:
in the process of writing a newly built configuration file or an updated configuration file into a first node, configuring a readable attribute for the configuration file, wherein the readable attribute is yes or no;
Judging whether illegal data exist in the written configuration file;
When illegal data exists in the configuration file, the readable attribute of the configuration file is set to be no.
Further, the step of writing the newly built configuration file or the updated configuration file into the first node specifically includes:
Configuring a switch control for a configuration file in advance to indicate the on-line and off-line states of the configuration file;
Monitoring the operation of a user on a switch control;
when the operation of the user on the switch control is monitored, the online state and the offline state of the configuration file are updated, and the updated configuration file is written into a first memory in the first node.
Further, before the step of creating the second node, the method further comprises:
Configuring a first address within a first node;
the step of creating the second node specifically includes:
configuring a second address within the second node, the second address for pointing to the first address;
The step of reading the configuration file from the first memory of the first node by the second node according to the preset frequency is to read the first address configured by the first node according to the direction of the second address configured by the second node so as to acquire the configuration file.
Further, the step of writing the configuration file read by the second node into the second memory in real time specifically includes:
if the configuration file read by the second node is the updated configuration file, judging whether the configuration file to be updated corresponding to the updated configuration file is occupied in a second memory or not;
if the configuration file is occupied, writing the updated configuration file into a second memory, reserving the configuration file in the first memory, and deleting the corresponding updated configuration file in the first memory and the configuration file to be updated in the second memory after the occupied configuration file is released;
If the configuration file is not occupied, writing the updated configuration file into a second memory to replace the configuration file to be updated, and deleting the updated configuration file in the first memory.
Further, the second node is a thread or a timed task.
In order to solve the above technical problems, the embodiment of the present application further provides a system for updating a configuration file, which adopts the following technical scheme:
A system for updating a configuration file, comprising:
The first writing module is used for writing the newly built configuration file or the updated configuration file into a first node, and a first memory for placing the configuration file is arranged in the first node;
the first configuration module is used for obtaining the types of the configuration files, determining the grades of the configuration files according to the types of the configuration files, and configuring preset frequencies according to the grades of the configuration files;
the first reading module is used for creating a second node, and reading the configuration files from the first memory of the first node through the second node according to the preset frequency corresponding to each configuration file;
the second writing module is used for writing the configuration file read by the second node into a second memory in real time;
and the second reading module is used for reading the configuration file from the second memory when receiving the request for using the configuration file.
In order to solve the technical problems, the embodiment of the application also provides electronic equipment, which adopts the following technical scheme:
an electronic device comprising a server and at least one terminal in communication with the server, the terminal comprising at least one memory and at least one processor, the memory having stored therein a computer program, the processor, when executing the computer program, performing the steps of the method of updating a profile as described above.
In order to solve the above technical problems, an embodiment of the present application further provides a computer readable storage medium, which adopts the following technical schemes:
a computer readable storage medium having stored thereon a computer program which when executed by a processor implements the steps of a method of updating a profile as described above.
Compared with the prior art, the embodiment of the application has the following main beneficial effects:
According to the type configuration preset frequency of the configuration files, the configuration files are read from the first memory of the first node through the second node according to the preset frequency, the configuration files read from the second node are written into the second memory in real time, so that the configuration files in the first memory are updated to the second memory at regular time, personalized implementation of system operation is facilitated, the configuration file reading strategy can be customized, an optimal scheme is provided for different scenes, maximization of resource utilization is achieved, real-time response to production or operation problems can be achieved, system risk is greatly reduced, a system is not required to be restarted, newly modified configuration file data can be updated to the system memory in real time, and the effect of real-time update of modification of the configuration files is achieved.
Drawings
In order to more clearly illustrate the solution of the present application, a brief description will be given below of the drawings required for the description of the embodiments of the present application, it being apparent that the drawings in the following description are some embodiments of the present application, and that other drawings may be obtained from these drawings without the exercise of inventive effort for a person of ordinary skill in the art.
FIG. 1 is a flow chart of one embodiment of a method of updating a configuration file in accordance with the present application;
FIG. 2 is a schematic diagram of one embodiment of a system for updating a profile in accordance with the present application;
fig. 3 is a schematic structural view of an embodiment of an electronic device according to the present application.
Reference numerals: 2. a system for updating the configuration file; 201. a first write module; 202. a first configuration module; 203. a first reading module; 204. a second write module; 205. a second reading module; 3. an electronic device; 301. a memory; 302. a processor.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the applications herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having" and any variations thereof in the description of the application and the claims and the description of the drawings above are intended to cover a non-exclusive inclusion. The terms first, second and the like in the description and in the claims or in the above-described figures, are used for distinguishing between different objects and not necessarily for describing a sequential or chronological order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
In order to make the person skilled in the art better understand the solution of the present application, the technical solution of the embodiment of the present application will be clearly and completely described below with reference to the accompanying drawings.
The system architecture may include terminal devices, networks, and servers. The network is used as a medium to provide a communication link between the terminal device and the server. The network may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server via the network using the terminal device to receive or send messages or the like. Various communication client applications, such as payment applications, shopping applications, transportation applications, instant messaging tools, mailbox clients, social platform software, and the like, can be installed on the terminal device.
The terminal device may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, electronic book readers, and laptop computers, among others.
The server may be a server providing various services, such as a background server providing support for pages displayed on the terminal device.
It should be noted that, the method for updating the configuration file provided by the embodiment of the present application is generally executed by the server/terminal device, and accordingly, the device for updating the configuration file is generally disposed in the server/terminal device. It should be appreciated that there may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring to FIG. 1, a flow chart of one embodiment of a method of updating a configuration file according to the present application is shown. The method for updating the configuration file comprises the following steps:
step S1: writing a newly built configuration file or an updated configuration file into a first node, wherein a first memory for placing the configuration file is arranged in the first node.
The first node may be a file json, properties, xml, for example, a configuration file generated by the vehicle insurance mobile out single system for the first time is stored in a file json, properties, xml, for example.
If the subsequent configuration file has an update, the updated configuration file is written into the first node (the original configuration file is modified at the same time so as to achieve the effect of real-time update).
The configuration file can be used for configuring various switch data generated in the quotation and insurance process of the vehicle insurance system, and relevant parameters and data used in the system such as personalized configuration of institutions and the like.
As a preferred solution, the stored configuration files may be stored in a sorted (expandable) manner, so that the configuration files are more efficiently read at the preset frequency in step S2, without scanning all the memory.
Step S1, writing a newly created configuration file or an updated configuration file into a first node, where a first memory for storing the configuration file is provided in the first node, and specifically includes:
in the process of writing a newly built configuration file or an updated configuration file into a first node, configuring a readable attribute for the configuration file, wherein the readable attribute is yes or no;
Judging whether illegal data exist in the written configuration file;
When illegal data exists in the configuration file, the readable attribute of the configuration file is changed to be no.
When illegal data exists in a certain configuration file, the readable attribute is set to be convenient for locking the configuration file so as to prevent the continuous updating of the configuration file and prevent the system from generating errors.
For example, when there is illegal data (such as illegal, illegal etc.) in the personalized configuration of the organization, the method can be judged according to the rules carried by the system itself, and then the readable attribute is automatically set to be no.
The step of writing the newly built configuration file or the updated configuration file into the first node specifically includes:
Configuring a switch control for a configuration file in advance to indicate the on-line and off-line states of the configuration file;
Monitoring the operation of a user on a switch control;
when the operation of the user on the switch control is monitored, the online state and the offline state of the configuration file are updated, and the updated configuration file is written into a first memory in the first node.
Specifically, a switch control is configured in each configuration file, and the switch control is used for indicating the online and offline of the configuration file.
As a preferred solution, the switch control may be configured to be 0/1, with 0 indicating that the switch is off, i.e. indicating that the profile is down, and 1 indicating that the profile is on, i.e. indicating that the profile is on.
For example, when a function is found to have an undesirable or problematic operation effect, the switch control of the function is turned off to enable the configuration file to be offline, that is, the configuration file is set to 0 in the switch control of the configuration file, and when the user is monitored to perform an operation on the switch control, the state of the configuration file is updated to indicate that the configuration file is offline. The system can react in real time to production or operation problems, and the risk of the system is greatly reduced. And the system is not required to be restarted, so that the flexibility of the development and operation processes is greatly improved.
In one possible implementation, the switch control is set to a visual interface, an on/off button is set in the visual interface to perform the up-down or down-line of the configuration file, on points to 1, representing the configuration file up-line, off points to 0, representing the configuration file down-line.
For example, when a function is found to have an undesirable or problematic operation, the switch control is operated, i.e., the switch control of the configuration file is clicked OFF, to offline the configuration file, and after a set time (e.g., one minute), the function is equivalent to offline. The system can react in real time to production or operation problems, and the risk of the system is greatly reduced. And the system is not required to be restarted, so that the flexibility of the development and operation processes is greatly improved.
Step S2: the types of the configuration files are obtained, the grades of the configuration files are determined according to the types of the configuration files, and the preset frequency is configured according to the grades of the configuration files.
Corresponding read frequency policies are set for different kinds of configuration files. Such as: for such configuration data files with more frequent and irregular changes of the personalized configuration of the storage mechanism, the reading frequency can be set to be read once in a shorter time, and other configuration data files with less frequent predictable changes can be set to be read once in a longer time.
Specifically, according to the types of the configuration files, the levels are set for the configuration files, and the reading frequency is set for the configuration files of each level. Setting a configuration file which is frequently and irregularly changed for personalized configuration of the storage mechanism as a first grade, wherein the setting frequency of the first grade is read once every first time period; other profiles that are predictably variable are set to a secondary level, the frequency of setting the secondary level being read every second time period.
As a preferred embodiment, the first period of time may be 1 to 5 minutes and the second period of time may be 30 to 60 minutes.
Therefore, the configuration file reading strategy can be customized, an optimal scheme is provided for different scenes, and the resource utilization maximization is realized.
Step S3: creating a second node, and reading the configuration files from the first memory of the first node through the second node according to the preset frequency corresponding to each configuration file.
The second node is specifically configured to read the configuration files such as json, properties, xml used for configuring switch data and personalized configuration in the system.
As a preferred solution, the second node may be a thread.
As another preferred solution, the second node may be a timing task.
In one possible implementation, the second node has no memory, and the second node only has the function of reading the configuration file in the first node, and writing the read file into the system memory (i.e., into the second memory), which is very efficient.
After the step of writing the newly created configuration file or the updated configuration file into the first node, the method further includes:
and setting a new identifier for the newly built configuration file or the updated configuration file.
The step of reading the configuration file from the first memory of the first node by the second node according to the preset frequency corresponding to each configuration file specifically includes:
Judging whether a new identifier exists in a configuration file of a first memory of the first node;
If the new identifier exists, reading a configuration file corresponding to the new identifier, acquiring a corresponding preset frequency, and reading the configuration file corresponding to the new identifier from a first memory of the first node after the preset frequency is reached.
Specifically, all configuration files including updated configuration files and original configuration files are stored in the first memory of the application, new identifiers are set for newly-built configuration files or updated configuration files, the second node detects whether the new identifiers exist in the configuration files of the first memory of the first node in the process of reading the configuration files from the first memory of the first node, if the new identifiers exist, the configuration files corresponding to the new identifiers are read after the preset frequency is reached, if the new identifiers do not exist, the configuration files are not read, and the aim is to avoid system resource waste and invalid reading.
The data after the n+1st reading will cover the data after the N reading to realize the real-time updating of the configuration file, i.e. only the latest configuration file is reserved in the second memory.
Before the step of creating the second node, the method further comprises:
a first address is configured within a first node.
The step of creating the second node specifically includes:
configuring a second address within the second node, the second address for pointing to the first address;
The step of reading the configuration file from the first memory of the first node by the second node according to the preset frequency is to read the first address configured by the first node according to the direction of the second address configured by the second node so as to acquire the configuration file.
In one possible implementation manner, the second node reads the configuration file according to the direction of the second address, and the first address and the second address can be set more conveniently and quickly to enable the second node to read the configuration file in the first node.
In one possible implementation, the first address and the second address may be physical addresses.
In another possible implementation, the first address and the second address may be set tags.
Step S4: and writing the configuration file read by the second node into a second memory in real time.
The second memory can be a system memory, namely, the newly modified configuration file data can be updated to the system memory in real time, and the newly modified data is the next time the configuration data is used, so that the effect of updating the configuration file in real time is achieved. The configuration file is updated in real time, so that more personalized configuration and switch control configuration can be performed, and the flexibility of the development and operation process is greatly improved.
The step S4 of writing the configuration file read by the second node into the second memory in real time specifically includes:
if the configuration file read by the second node is the updated configuration file, judging whether the configuration file to be updated corresponding to the updated configuration file is occupied in a second memory or not;
if the configuration file is occupied, writing the updated configuration file into a second memory, reserving the configuration file in the first memory, and deleting the corresponding updated configuration file in the first memory and the configuration file to be updated in the second memory after the occupied configuration file is released;
If the configuration file is not occupied, writing the updated configuration file into a second memory to replace the configuration file to be updated, and deleting the updated configuration file in the first memory.
For example, when the personalized configuration file for the storage mechanism is opened, the configuration file is still reserved in the first memory after being written into the second memory, so as to ensure that the configuration file in the first memory can be re-updated again when the updating fails.
For example, when the personalized configuration file of the storage mechanism is not opened, the configuration file is cleared in the first memory after being written into the second memory, so that the first memory space is saved, and the system efficiency is improved.
Step S5: and when a request for using the configuration file is received, reading the configuration file from the second memory.
When the newly modified configuration file data is read to the system memory (second memory), the configuration file data is the latest modified configuration file data when the configuration file data is used next time, so that the effect of updating the configuration file in real time is achieved. Thus, the system does not need to be restarted, and the modification is updated in real time.
Step S5, after the step of reading the configuration file from the second memory in real time when the configuration file is needed, further includes:
and exporting and permanently storing the updated configuration file to form a mass database so as to facilitate big data analysis.
According to the method for updating the configuration file, the preset frequency is configured according to the types of the configuration files, the configuration files are read from the first memory of the first node through the second node according to the preset frequency, the configuration files read from the second node are written into the second memory in real time, so that the configuration files in the first memory are updated to the second memory at regular time, personalized implementation of system operation is facilitated, a configuration file reading strategy can be customized, an optimal scheme is provided for different scenes, maximization of resource utilization is achieved, real-time response to production or operation problems can be achieved, system risk is greatly reduced, a system is not required to be restarted, newly modified configuration file data can be updated to the system memory in real time, and the effect of modification and real-time update of the configuration files is achieved. More personalized configuration and switch control configuration can be made, and flexibility of development and operation processes is greatly improved.
In this embodiment, the electronic device on which the method for updating the configuration file operates may receive the request through a wired connection manner or a wireless connection manner. It should be noted that the wireless connection may include, but is not limited to, 3G/4G connection, wiFi connection, bluetooth connection, wiMAX connection, zigbee connection, UWB (ultra wideband) connection, and other now known or later developed wireless connection.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored in a computer-readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. The storage medium may be a nonvolatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a random access Memory (Random Access Memory, RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, these steps are not necessarily performed in order as indicated by the arrows. The steps are not strictly limited in order and may be performed in other orders, unless explicitly stated herein. Moreover, at least some of the steps in the flowcharts of the figures may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, the order of their execution not necessarily being sequential, but may be performed in turn or alternately with other steps or at least a portion of the other steps or stages.
With further reference to fig. 2, as an implementation of the method shown in fig. 1, the present application provides an embodiment of a system for updating a configuration file, where the system embodiment corresponds to the method embodiment shown in fig. 1, and the system is particularly applicable to various electronic devices.
As shown in fig. 2, the system 2 for updating a configuration file according to the present embodiment includes:
A first writing module 201, a first configuration module 202, a first reading module 203, a second writing module 204, and a second reading module 205.
The first writing module 201 is configured to write a newly created configuration file or an updated configuration file into a first node, where a first memory for storing the configuration file is disposed in the first node. The first node may be a file json, properties, xml, for example, a configuration file generated by the vehicle insurance mobile out-list system for the first time is stored in a file json, properties, xml, for example.
The first configuration module 202 is configured to obtain a category of the configuration file, determine a level of the configuration file according to the category of the configuration file, and configure a preset frequency according to the level of the configuration file.
The first reading module 203 is configured to create a second node, and read the configuration files from the first memory of the first node according to a preset frequency corresponding to each configuration file through the second node. The second node is specifically configured to read json, properties, xml or other configuration files in the system, where the configuration files are used to configure switch data and personalized configurations.
The second writing module 204 is configured to write the configuration file read by the second node into the second memory in real time. The second memory is the system memory, i.e. the newly modified configuration file data can be updated to the system memory in real time, and the next time the configuration data is used, the newly modified data is used, so that the effect of updating the configuration file in real time is achieved. The configuration file is updated in real time, so that more personalized configuration and switch control configuration can be performed, and the flexibility of the development and operation process is greatly improved.
The second reading module 205 is configured to read the configuration file from the second memory when receiving a request for using the configuration file. When the newly modified configuration file data is read to the system memory (second memory), the configuration file data is the latest modified configuration file data when the configuration file data is used next time, so that the effect of updating the configuration file in real time is achieved. Thus, the system does not need to be restarted, and the modification is updated in real time.
In some optional implementations of this embodiment, the system 2 for updating a configuration file further includes a first setting module, where the first setting module is configured to set a new identifier for a newly created configuration file or an updated configuration file.
In some optional implementations of this embodiment, the first reading module 203 includes a first determining module and a first sub-reading module.
The first judging module is used for judging whether a new identifier exists in the configuration file of the first memory of the first node.
The first sub-reading module is used for reading a configuration file corresponding to the new identifier if the new identifier exists, acquiring a corresponding preset frequency, and reading the configuration file corresponding to the new identifier from a first memory of the first node after the preset frequency is reached;
in some optional implementations of this embodiment, the system 2 for updating a configuration file further includes a second configuration module, a second determination module, and a second setting module.
The second configuration module is used for configuring a readable attribute for the configuration file in the process of writing the newly-built configuration file or the updated configuration file into the first node, wherein the readable attribute is yes or no;
the second judging module is used for judging whether illegal data exist in the written configuration file;
The second setting module is used for setting readable attribute of the configuration file when illegal data exist in a certain configuration file when illegal data exist in the configuration file, so as to facilitate locking the configuration file, inhibit continuous updating of the configuration file and prevent errors of the system.
In some optional implementations of this embodiment, the system 2 for updating a configuration file further includes a third configuration module, a monitoring module, and a third writing module.
The third configuration module is used for configuring a switch control for a configuration file in advance to indicate the online and the offline of the configuration file;
The monitoring module is used for monitoring the operation of a user on the switch control;
and the third writing module is used for updating the online and the offline of the configuration file when the operation of the switch control by the user is monitored, and writing the updated configuration file into the first memory in the first node.
And indicating the online and offline of the configuration file through a switch control configured in the configuration file.
In some optional implementations of this embodiment, the system 2 for updating a configuration file further includes a fourth configuration module and a fifth configuration module.
The fourth configuration module is used for configuring the first address in the first node; the fifth configuration module is configured to configure a second address within the second node, the second address being configured to point to the first address.
The step of reading the configuration file from the first memory of the first node by the second node according to the preset frequency is to read the first address configured by the first node according to the direction of the second address configured by the second node so as to acquire the configuration file.
In some optional implementations of this embodiment, the system 2 for updating a configuration file further includes a third determining module, a first deleting module, and a second deleting module.
The third judging module is used for judging whether the configuration file to be updated corresponding to the updated configuration file is occupied in the second memory or not if the configuration file read by the second node is the updated configuration file;
The first deleting module is used for writing the updated configuration file into the second memory if the configuration file is occupied, reserving the configuration file in the first memory, and deleting the corresponding updated configuration file in the first memory and the configuration file to be updated in the second memory after the occupied configuration file is released;
and the second deleting module is used for writing the updated configuration file into the second memory to replace the configuration file to be updated and deleting the updated configuration file in the first memory if the configuration file is unoccupied.
The system 2 for updating the configuration file further comprises a storage module for exporting and permanently storing the updated configuration file to form a mass database so as to facilitate big data analysis.
According to the system for updating the configuration file, the preset frequency is configured according to the types of the configuration files, the configuration files are read from the first memory of the first node through the second node according to the preset frequency, the configuration files read from the second node are written into the second memory in real time, so that the configuration files in the first memory are updated to the second memory at regular time, personalized implementation of system operation is facilitated, a configuration file reading strategy can be customized, an optimal scheme is provided for different scenes, maximization of resource utilization is achieved, real-time response to production or operation problems can be achieved, system risk is greatly reduced, the system is not required to be restarted, newly modified configuration file data can be updated to the system memory in real time, and the effect of modification and real-time update of the configuration files is achieved. More personalized configuration and switch control configuration can be made, and flexibility of development and operation processes is greatly improved.
In order to solve the technical problems, the embodiment of the application also provides electronic equipment. Referring specifically to fig. 3, fig. 3 is a basic structural block diagram of the electronic device according to the present embodiment.
The electronic device 3 comprises at least one memory 301 and at least one processor 302, the memory 301 having stored therein a computer program, the processor 302 implementing the steps of the method of updating a configuration file as described above when executing the computer program. It is noted that only the electronic device 3 with components 301-302 is shown in the figures, but it is understood that not all of the illustrated components are required to be implemented and that more or fewer components may be implemented instead. It will be understood by those skilled in the art that the electronic device herein is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and its hardware includes, but is not limited to, a microprocessor, an Application SPECIFIC INTEGRATED Circuit (ASIC), a Programmable gate array (Field-Programmable GATE ARRAY, FPGA), a digital Processor (DIGITAL SIGNAL Processor, DSP), an embedded device, and the like.
The electronic equipment can be a mobile phone, a desktop computer, a notebook computer, a palm computer, a cloud server and other computing equipment. The electronic equipment can perform man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch pad or voice control equipment and the like.
The memory 301 includes at least one type of readable storage medium including flash memory, hard disk, multimedia card, card memory (e.g., SD or DX memory, etc.), random Access Memory (RAM), static Random Access Memory (SRAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), programmable Read Only Memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 301 may be an internal storage unit of the electronic device 3, such as a hard disk or a memory of the electronic device 3. In other embodiments, the memory 301 may also be an external storage device of the electronic device 3, such as a plug-in hard disk, a smart memory card (SMART MEDIA CARD, SMC), a Secure Digital (SD) card, a flash memory card (FLASH CARD) or the like, which are provided on the electronic device 3. Of course, the memory 301 may also include both an internal memory unit and an external memory device of the electronic device 3. In this embodiment, the memory 301 is generally used to store an operating system and various application software installed on the electronic device 3, such as program codes of a method for updating a configuration file. In addition, the memory 301 may be used to temporarily store various types of data that have been output or are to be output.
The processor 302 may be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor, or other data processing chip in some embodiments. The processor 302 is typically used to control the overall operation of the electronic device 3. In this embodiment, the processor 302 is configured to execute the program code stored in the memory 301 or process data, such as the program code of the method for updating the configuration file.
The present application provides yet another embodiment, namely, a computer readable storage medium storing a program for updating a profile, where the program for updating a profile is executable by at least one processor 302, so that the at least one processor 302 performs the steps of the method for updating a profile as described above.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present application.
It is apparent that the above-described embodiments are only some embodiments of the present application, but not all embodiments, and the preferred embodiments of the present application are shown in the drawings, which do not limit the scope of the patent claims. This application may be embodied in many different forms, but rather, embodiments are provided in order to provide a thorough and complete understanding of the present disclosure. Although the application has been described in detail with reference to the foregoing embodiments, it will be apparent to those skilled in the art that modifications may be made to the embodiments described in the foregoing description, or equivalents may be substituted for elements thereof. All equivalent structures made by the content of the specification and the drawings of the application are directly or indirectly applied to other related technical fields, and are also within the scope of the application.

Claims (10)

1. A method of updating a configuration file, comprising the steps of:
writing a newly built configuration file or an updated configuration file into a first node, wherein a first memory for placing the configuration file is arranged in the first node;
acquiring the types of the configuration files, determining the grades of the configuration files according to the types of the configuration files, and configuring preset frequencies according to the grades of the configuration files;
Creating a second node, and reading configuration files from a first memory of the first node through the second node according to preset frequencies corresponding to the configuration files;
Writing the configuration file read by the second node into a second memory in real time;
When a request for using the configuration file is received, reading the configuration file from a second memory;
The method specifically comprises the steps of obtaining the types of the configuration files, determining the grades of the configuration files according to the types of the configuration files, and configuring preset frequencies according to the grades of the configuration files, wherein the types of the configuration files comprise frequently changed and irregular configuration files and predictably changed and non-frequently changed configuration files, and the steps of:
If the type of the configuration file is a configuration file which is frequently changed and irregular, determining the grade of the configuration file as a primary grade, and configuring the preset frequency to be read once every first time period based on the primary grade;
If the type of the configuration file is a configuration file which can be predictably changed and is not changed frequently, determining the level of the configuration file as a secondary level, and configuring the preset frequency to be read once every second time period based on the secondary level, wherein the time length of the second time period is longer than the time length of the first time period.
2. The method for updating a configuration file according to claim 1, wherein after the step of writing the newly created configuration file or the updated configuration file into the first node, the method further comprises:
Setting a new identifier for the newly built configuration file or the updated configuration file;
The step of reading the configuration file from the first memory of the first node by the second node according to the preset frequency corresponding to each configuration file specifically includes:
Judging whether a new identifier exists in a configuration file of a first memory of the first node;
If the new identifier exists, reading a configuration file corresponding to the new identifier, acquiring a corresponding preset frequency, and reading the configuration file corresponding to the new identifier from a first memory of the first node after the preset frequency is reached.
3. The method for updating configuration files according to claim 1, wherein the step of writing the newly created configuration file or the updated configuration file into the first node, wherein the first node is provided with a first memory for storing the configuration file, specifically comprises:
in the process of writing a newly built configuration file or an updated configuration file into a first node, configuring a readable attribute for the configuration file, wherein the readable attribute is yes or no;
Judging whether illegal data exist in the written configuration file;
When illegal data exists in the configuration file, the readable attribute of the configuration file is set to be no.
4. The method for updating a configuration file according to claim 1, wherein the step of writing the newly created configuration file or the updated configuration file into the first node specifically comprises:
Configuring a switch control for a configuration file in advance to indicate the on-line and off-line states of the configuration file;
Monitoring the operation of a user on a switch control;
when the operation of the user on the switch control is monitored, the online state and the offline state of the configuration file are updated, and the updated configuration file is written into a first memory in the first node.
5. The method of updating a configuration file according to claim 1, wherein prior to the step of creating the second node, the method further comprises:
Configuring a first address within a first node;
the step of creating the second node specifically includes:
configuring a second address within the second node, the second address for pointing to the first address;
The step of reading the configuration file from the first memory of the first node by the second node according to the preset frequency is to read the first address configured by the first node according to the direction of the second address configured by the second node so as to acquire the configuration file.
6. The method for updating configuration files according to claim 1, wherein the step of writing the configuration file read by the second node into the second memory in real time specifically comprises:
if the configuration file read by the second node is an updated configuration file, judging whether the configuration file to be updated corresponding to the updated configuration file is occupied in a second memory, wherein the configuration file to be updated is stored in the second memory;
if the configuration file is occupied, writing the updated configuration file into a second memory, reserving the configuration file in the first memory, and deleting the corresponding updated configuration file in the first memory and the configuration file to be updated in the second memory after the occupied configuration file is released;
If the configuration file is not occupied, writing the updated configuration file into a second memory to replace the configuration file to be updated, and deleting the updated configuration file in the first memory.
7. The method of updating a configuration file according to any of claims 1-6, wherein the second node is a thread or a timed task.
8. A system for updating a configuration file, comprising:
The first writing module is used for writing the newly built configuration file or the updated configuration file into a first node, and a first memory for placing the configuration file is arranged in the first node;
the first configuration module is used for obtaining the types of the configuration files, determining the grades of the configuration files according to the types of the configuration files, and configuring preset frequencies according to the grades of the configuration files;
the first reading module is used for creating a second node, and reading the configuration files from the first memory of the first node through the second node according to the preset frequency corresponding to each configuration file;
the second writing module is used for writing the configuration file read by the second node into a second memory in real time;
the second reading module is used for reading the configuration file from the second memory when receiving the request for using the configuration file;
The first configuration module comprises a configuration file with frequent and irregular changes and a configuration file with predictable variation and non-frequent changes;
The first configuration module is further configured to determine that the level of the configuration file is a first level if the type of the configuration file is a configuration file that is frequently and irregularly changed, and configure the preset frequency to be read once every first time period based on the first level; if the type of the configuration file is a configuration file which can be predictably changed and is not changed frequently, determining the level of the configuration file as a secondary level, and configuring the preset frequency to be read once every second time period based on the secondary level, wherein the time length of the second time period is longer than the time length of the first time period.
9. An electronic device comprising a server and at least one terminal communicatively connected to the server, the terminal comprising at least one memory and at least one processor, the memory having stored therein a computer program, the processor executing the computer program to perform the steps of the method of updating a profile as claimed in any one of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored, which computer program, when being executed by a processor, implements the steps of the method of updating a profile according to any one of claims 1 to 7.
CN201910859956.XA 2019-09-11 Method, system, electronic device and storage medium for updating configuration file Active CN110795117B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910859956.XA CN110795117B (en) 2019-09-11 Method, system, electronic device and storage medium for updating configuration file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910859956.XA CN110795117B (en) 2019-09-11 Method, system, electronic device and storage medium for updating configuration file

Publications (2)

Publication Number Publication Date
CN110795117A CN110795117A (en) 2020-02-14
CN110795117B true CN110795117B (en) 2024-06-28

Family

ID=

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107291487A (en) * 2016-04-13 2017-10-24 平安科技(深圳)有限公司 CONFIG.SYS amending method and system
CN108121559A (en) * 2017-12-29 2018-06-05 重庆金融资产交易所有限责任公司 Configuration file method for pushing, server and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107291487A (en) * 2016-04-13 2017-10-24 平安科技(深圳)有限公司 CONFIG.SYS amending method and system
CN108121559A (en) * 2017-12-29 2018-06-05 重庆金融资产交易所有限责任公司 Configuration file method for pushing, server and storage medium

Similar Documents

Publication Publication Date Title
CN112052111B (en) Processing method, device and equipment for server abnormity early warning and storage medium
CN108449313B (en) Electronic device, Internet service system risk early warning method and storage medium
CN111782304B (en) Paging loading data logic control method, device, computer equipment and medium
CN113254445B (en) Real-time data storage method, device, computer equipment and storage medium
CN108363684A (en) List creation method, device and server
CN112631911A (en) Automatic testing method and device, computer equipment and storage medium
CN112860662A (en) Data blood relationship establishing method and device, computer equipment and storage medium
CN113312135B (en) List display method and device, computer equipment and storage medium
CN113791735A (en) Video data storage method and device, computer equipment and storage medium
CN105511914A (en) Application update method, device and system
CN108549557A (en) Using storing method, terminal and storage medium
CN111475468A (en) Log access method, device, equipment and storage medium of newly added system
CN112685115A (en) International cue language generating method, system, computer equipment and storage medium
CN112463799A (en) Data extraction method, device, equipment and storage medium
CN110795117B (en) Method, system, electronic device and storage medium for updating configuration file
CN115687826A (en) Page refreshing method and device, computer equipment and storage medium
CN114186976A (en) Workflow transfer method and device, computer equipment and storage medium
CN115004667B (en) Information pushing method, device, electronic equipment and computer readable medium
CN112632192A (en) Node maintenance method and device, computer equipment and medium
CN110795117A (en) Method, system, electronic device and storage medium for updating configuration file
CN113342502A (en) Method and device for diagnosing performance of data lake, computer equipment and storage medium
CN113254106A (en) Task execution method and device based on Flink, computer equipment and storage medium
CN112002352A (en) Random music playing method and device, computer equipment and storage medium
CN116821210A (en) Blacklist query method, blacklist query device, computer equipment and storage medium
CN112486556B (en) Method, system, terminal and storage medium for server to be compatible with BMC

Legal Events

Date Code Title Description
PB01 Publication
SE01 Entry into force of request for substantive examination
GR01 Patent grant