CN112732412B - Service configuration file processing method and device, storage medium and electronic equipment - Google Patents

Service configuration file processing method and device, storage medium and electronic equipment Download PDF

Info

Publication number
CN112732412B
CN112732412B CN202110364580.2A CN202110364580A CN112732412B CN 112732412 B CN112732412 B CN 112732412B CN 202110364580 A CN202110364580 A CN 202110364580A CN 112732412 B CN112732412 B CN 112732412B
Authority
CN
China
Prior art keywords
container
configuration file
started
service
file
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
CN202110364580.2A
Other languages
Chinese (zh)
Other versions
CN112732412A (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.)
Zhejiang Huachuang Video Signal Technology Co Ltd
Original Assignee
Zhejiang Huachuang Video Signal 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 Zhejiang Huachuang Video Signal Technology Co Ltd filed Critical Zhejiang Huachuang Video Signal Technology Co Ltd
Priority to CN202110364580.2A priority Critical patent/CN112732412B/en
Publication of CN112732412A publication Critical patent/CN112732412A/en
Application granted granted Critical
Publication of CN112732412B publication Critical patent/CN112732412B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45575Starting, stopping, suspending or resuming virtual machine instances

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a service configuration file processing method, a device, a storage medium and electronic equipment, which respond to a container starting request by detecting the container starting request of a container to be started, send a file acquiring request for acquiring a configuration file of the container to be started, receive response information responding to the file acquiring request, wherein the response information is used for showing an acquiring result of the configuration file of the container to be started, judge a starting result of the container to be started according to the response information, update the service configuration file of the container under the condition that the starting result shows that the container to be started is successfully started, and upload the updated service configuration file so as to solidify the service configuration file. Therefore, cloud native deployment can be achieved, meanwhile, configuration access can be safely and reliably carried out across machines without exposing any connecting port, main business application programs in containers of business nodes do not need to be modified, and efficient real-time configuration file synchronous storage is achieved.

Description

Service configuration file processing method and device, storage medium and electronic equipment
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and an apparatus for processing a service profile, a storage medium, and an electronic device.
Background
For deployment of application programs, the traditional way is to install the application through a plug-in or script. The disadvantage of this is that the running, configuration, management, all life cycles of the application will be bound with the current operating system, which is not beneficial to the upgrade, update, rollback and other operations of the application. Thus, a method of deploying an application by creating a virtual machine has been proposed, but the portability of the virtual machine is very poor.
The containerization technology arises when neither the traditional application deployment approach nor the virtual machine can meet the requirements. The container occupies less resources and is deployed quickly, and the method is widely applied in the deployment process of the application program. Kubernetes is a container orchestration engine for Google open sources that supports multi-machine clustering, automated deployment, large-scale scalable management, and provides sophisticated management tools. Therefore, the Kubernetes-based clustering scheme has become one of the mainstream schemes in cloud-native.
Disclosure of Invention
The embodiment of the invention provides a service configuration file processing method, a service configuration file processing device, a storage medium and electronic equipment.
According to a first aspect of the present invention, there is provided a service profile processing method, the method comprising: detecting a container starting request of a container to be started; responding to the container starting request, and sending a file acquisition request for acquiring the configuration file of the container to be started; receiving response information responding to the file acquisition request, wherein the response information is used for showing an acquisition result of the configuration file of the container to be started; judging the starting result of the container to be started according to the response information; updating the service configuration file of the container under the condition that the starting result shows that the container to be started is successfully started; and uploading the updated service configuration file to solidify the service configuration file.
According to an embodiment of the present invention, the determining the starting result of the container to be started according to the response information includes: determining that the container to be started is started successfully if the response information shows one of the following: the service configuration file of the container to be started is successfully obtained; and the service configuration file of the container to be started is empty.
According to an embodiment of the present invention, when the response information shows that the service configuration file of the container to be started is successfully obtained, the response information further includes the service configuration file of the container to be started.
According to an embodiment of the present invention, in the case that the start result shows that the container to be started is successfully started, the updating the service configuration file of the container includes: monitoring the change of the service configuration file of the container; and uploading the latest service configuration file of the container to update the service configuration file of the container under the condition that the change of the service configuration file of the container is monitored.
According to an embodiment of the present invention, in the case that the start result shows that the container to be started is successfully started, the updating the service configuration file of the container further includes: detecting the application program running condition of the container; and uploading the latest configuration file of the container to update the service configuration file of the container under the condition that the application program exits.
According to an embodiment of the invention, the method further comprises: and after the application program exits, setting time at intervals, and finishing the operation of the container.
According to an embodiment of the present invention, in a case that the response information shows that the service profile of the to-be-started container is successfully obtained, before monitoring a change of the service profile of the container, the updating the service profile of the to-be-started container according to the response information further includes: and extracting a service configuration file from the response information so as to cover the default configuration file of the container to be started.
According to an embodiment of the present invention, the determining the starting result of the container to be started according to the response information includes: determining that the container to be started fails to start in a case where the response information shows one of: the service configuration file of the container to be started fails to acquire the connection in the process; and the service configuration file of the container to be started is in a connection error in the acquisition process.
According to an embodiment of the present invention, the method further comprises: and restarting the container to be started under the condition that the container to be started is judged to be failed to be started.
According to the second aspect of the present invention, there is also provided a service profile processing apparatus, the apparatus including: the starting detection module is used for detecting a container starting request of a container to be started; the file acquisition module is used for responding to the container starting request and sending a file acquisition request for acquiring the configuration file of the container to be started; a receiving module, configured to receive response information in response to the file obtaining request, where the response information is used to show a result of obtaining a configuration file of the container to be started; the starting judgment module is used for judging the starting result of the container to be started according to the response information; the updating module is used for updating the service configuration file of the container under the condition that the starting result shows that the container to be started is successfully started; and the curing module is used for uploading the updated service configuration file so as to cure the service configuration file.
According to a third aspect of the present invention, there is also provided a computer-readable storage medium comprising a set of computer-executable instructions which, when executed, are adapted to perform the above-mentioned service profile handling method.
According to the fourth aspect of the present invention, there is also provided an electronic device, comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete communication with each other through the communication bus; a memory for storing a computer program; and the processor is used for realizing the service configuration file processing method when executing the program stored in the memory.
The embodiment of the invention provides a service configuration file processing method, a device, a computer readable storage medium and an electronic device, wherein a container starting request of a container to be started is detected, a file obtaining request for obtaining a configuration file of the container to be started is sent in response to the container starting request, response information in response to the file obtaining request is received, the response information is used for showing an obtaining result of the configuration file of the container to be started, a starting result of the container to be started is judged according to the response information, the service configuration file of the container is updated under the condition that the starting result shows that the container to be started is started successfully, and the updated service configuration file is uploaded to solidify the service configuration file. Therefore, a cloud file storage service can be deployed, cloud native privatization deployment is achieved, and when the business node detects a container starting request, a service configuration file is obtained from the file storage service. Therefore, cloud native deployment can be achieved, meanwhile, configuration access can be safely and reliably carried out across machines without exposing any connecting port, main business application programs in containers of business nodes do not need to be modified, and efficient real-time configuration file synchronous storage is achieved. In addition, the method can also realize multi-machine backup of the service configuration file through a main/standby mechanism, thereby effectively ensuring data security.
It is to be understood that the teachings of the present invention need not achieve all of the above-described benefits, but rather that specific embodiments may achieve specific technical results, and that other embodiments of the present invention may achieve benefits not mentioned above.
Drawings
The above and other objects, features and advantages of exemplary embodiments of the present invention will become readily apparent from the following detailed description read in conjunction with the accompanying drawings. Several embodiments of the invention are illustrated by way of example, and not by way of limitation, in the figures of the accompanying drawings and in which:
in the drawings, the same or corresponding reference numerals indicate the same or corresponding parts.
Fig. 1 is a schematic diagram illustrating an application scenario of a service profile processing method according to an embodiment of the present invention;
FIG. 2 is a first flowchart illustrating an implementation of a service profile processing method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating a second implementation flow of the service profile processing method according to the embodiment of the present invention;
fig. 4 is a schematic diagram illustrating an implementation flow of a specific application example of the service profile processing method according to the embodiment of the present invention;
FIG. 5 is a schematic diagram illustrating a component structure of a service profile processing apparatus according to an embodiment of the present invention;
fig. 6 is a schematic diagram showing a composition structure of an electronic device according to an embodiment of the present invention.
Detailed Description
The principles and spirit of the present invention will be described with reference to a number of exemplary embodiments. It is understood that these embodiments are given only to enable those skilled in the art to better understand and to implement the present invention, and do not limit the scope of the present invention in any way. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
The technical solution of the present invention is further elaborated below with reference to the drawings and the specific embodiments.
Fig. 1 is a schematic diagram illustrating an application scenario of a service profile processing method according to an embodiment of the present invention. The service configuration file processing method of the embodiment of the invention is applied to the system architecture shown in fig. 1. As shown in fig. 1, a file storage service based on HTTP (Hypertext Transfer Protocol) is established, and supports upload and download operations, and configures a data volume for the file storage service. The business service does not directly mount the data volume, but realizes the storage and the acquisition of the file through HTTP request. Therefore, the business service is effectively prevented from being limited and influenced by the locally stored host, and the business service can freely run on any node in the Kubemeters cluster.
When the service container "POD-service 1" performs the container start operation, the service container "POD-file storage service" may first request the file storage service container "POD-file storage service" to acquire the configuration file through HTTP. If the request is successful, the file storage service returns a message including an identifier that the configuration file was successfully obtained, for example: and 200 OK, and carrying the content of the configuration file in the message. The business service container replaces the corresponding configuration file. If the configuration file of the business service container does not exist, the file storage service container returns a message including an identifier that the configuration file is empty, for example: "404 Not Found", at which point the business service container may determine that the configuration file for the container has Not been archived and continue to perform the startup process. And if the file storage service container returns a message which comprises other abnormal error reports or the service cannot be normally connected with the file storage service, the service is considered to be failed to start, the service container is in an operation ending state, the container is restarted after the Kubernets, and the acquisition of the configuration file is requested again.
After the business service container is successfully started, events such as creation and modification of a specified application program file can be monitored through an inotify (Linux characteristic, monitoring file system operation) mechanism of a Linux (operating system name) system. When the event is triggered, the Linux operating system gives a callback on a kernel level; and after receiving the callback, the business service container triggers the operation of uploading the latest configuration file to the file service container through HTTP.
When the application program is finished, the latest configuration file can be synchronized to the file storage service container each time according to the actual business scenario, or the application program waits for a specified time after finishing, for example: 1-2 seconds to ensure that the configuration files that may be generated before the application exits are synchronized.
Therefore, the whole process of processing the service configuration file by the service container can realize the operation of solidifying and reading the service configuration file by depending on the peripheral script or application of the application program without modifying the operation executed by the application program.
The specific service profile processing flow is described in more detail below with reference to fig. 2-4, and is not described herein again.
It should be noted that fig. 1 is only an example of an application scenario of the service profile processing method according to the embodiment of the present invention, and is not limited to the application scenario of the service profile processing method according to the present invention, and the service profile processing method according to the present invention may also be applied to other applicable scenarios.
In addition, when configuring the workload of the file storage service, the following criteria should be met:
1) when the business service is privatized, a local mode is mainly adopted, namely, the service configuration file is solidified on a writable area of a physical machine. As only NFS (Net File System, network File service) is deployed, an external port is generated, and the security risk of using NFS is high in a privatized deployment environment where service update is slow.
However, if there is a professional team to continuously maintain or use the storage service of the public cloud rental specialty, a wider variety of services can be provided using the NFS service. At the moment, the business service does not need to pay attention to the actual storage type of the configuration file, the storage process of the configuration file of the business service can be effectively simplified, the calculation power is effectively improved, and the calculation and storage resources are saved.
2) When network deployment is carried out on business services, a HOST network (HOST) mode is avoided, and therefore potential safety hazards caused by the fact that communication ports are exposed to the outside are effectively avoided. However, according to the mechanism of kubernets, a non-HOST mode is used, the default configuration is that the monitoring port does not expose and monitor outside, and only can be connected in the kubernets cluster.
3) For other cases than NFS, the number of Pod(s) of the file storage service should not be greater than 1. In the case of a very large cluster with the kubernets mechanism, one or more file storage services may be deployed to achieve load balancing.
4) If the storage type of the file storage service is NFS, the file storage service may mount a PVC (Persistent Volume Claim) having a plurality of PVCs (Persistent Volume claims) actually pointing to different PVs (Persistent volumes) to ensure the security of the service profile. And setting a master-backup file storage service, namely actually synchronously storing different physical nodes by the configuration files.
5) The kubemeters system is configured by adopting the configuration modes such as the service, the file storage service, the virtualization network and the like shown in fig. 1, when the storage device of the main node is abnormal, the service container of the main node cannot be started because the start requirement is not met. The operation and maintenance personnel only need to switch the binding PVC of the service configuration path of the main node from the original main PVC to the backup PVC and remove the volume mapping relation of the backup configuration path, and then the storage service can be ensured to continue to normally operate, so that the service can be ensured to normally operate.
After the configuration of the workload of the file storage service is finished, service discovery needs to be configured for the file storage service, wherein the service discovery means that a domain name record is added in a virtualization network and a preset name is pointed to the workload of the file storage service. The scope of service discovery is limited to clusters; when the number of Pod corresponding to the workload is greater than 1, the service discovery can also play a role in load balancing.
Assume that the service discovery name of the file storage service workload is configsvr. When a stateless business service request named business obtains its configuration file config.ini, the address of the business service request may be http:// configsvr/business/config.ini. I.e. the storage can be configured according to the following rules: http:// service discovery name of file storage service/workload name of business service/configuration file name. If the business service is a single-instance job, the writing operation can be performed by using the above rule.
If the service is a multi-instance working service, load balancing operation is required, the service can be changed into a stateless service with the Pod number larger than 1 after the cloud is subjected to original biochemical treatment, a scheduling service is usually used for performing telescopic calculation, all configuration files are written by the scheduling service, or communication is completed through a signaling protocol on the service after the stateless service is started; when the working service runs, the change of the local configuration file is not monitored any more, and the working service is pulled again to complete synchronization by restarting the working service or adding a protocol.
In some scenarios, for example: a certain platform accesses the gateway service, needs to connect different external host nodes, and configures information such as IP, account, password and the like of the external host for each Pod independently. Therefore, the mode of the service needs to be set as stateful service, and different nodes are distinguished by using the fixed Pod name of the stateful service; taking a business service named as business as an example, the first Pod instance is named as business-0, and the second Pod instance is named as business-1. The address corresponding to the configuration file config.ini of the first Pod is http:// configsvr/bussiness-0/config.ini, that is, the configuration storage is performed according to the following rule: the http:// the service discovery name of the file storage service/the workload name of the service/the Pod name/the configuration file name, and the requirements of different Pod independent configuration files are met.
Fig. 2 is a first schematic flow chart illustrating an implementation of the service profile processing method according to the embodiment of the present invention. Referring to fig. 2, the method for processing a service profile according to this embodiment of the present invention at least includes the following operation flows: operation 201, detecting a container starting request of a container to be started; operation 202, in response to the container start request, sending a file acquisition request for acquiring a configuration file of the container to be started; operation 203, receiving response information in response to the file obtaining request, where the response information is used to show a obtaining result of the configuration file of the container to be started; operation 204, judging a starting result of the container to be started according to the response information; operation 205, in the case that the start result shows that the container to be started is successfully started, updating the service configuration file of the container; at operation 206, the updated service profile is uploaded to solidify the service profile.
In operation 201, a container activation request for a container to be activated is detected.
In this embodiment of the present invention, the service automatically detects its own initiation request at set intervals. For example: the POD-service 1 of the node 1 automatically detects its container initiation request. The interval time can be set according to actual conditions, and real-time detection can also be set.
In operation 202, in response to the container start request, a file acquisition request for acquiring a configuration file of the container to be started is sent.
In this embodiment of the present invention, when the service container detects its own container start request, it attempts to acquire the current and latest service profile from the file storage service. Thus, the business service will send a file acquisition request for the configuration file of the container to the file storage service. The file name may be carried in the file acquisition request.
In operation 203, response information in response to the file obtaining request is received, where the response information is used to show a obtaining result of the configuration file of the container to be started.
In this embodiment of the present invention, the response information may include an acquisition result identifier showing one of: successfully acquiring the service configuration file of the container to be started; the service configuration file of the container to be started is empty; the service configuration file of the container to be started fails to acquire the connection in the process; and the service configuration file acquisition process of the container to be started is connected wrongly.
And operation 204, judging the starting result of the container to be started according to the response information.
In this embodiment of the present invention, it may be determined that the container to be started is started successfully in a case where the response information shows one of: successfully acquiring the service configuration file of the container to be started; the service profile of the container to be started is empty.
In this embodiment of the present invention, it may be determined that the start-up of the container to be started has failed in a case where the response information shows one of: the service configuration file of the container to be started fails to acquire the connection in the process; and the service configuration file acquisition process of the container to be started is connected wrongly.
The identifier included in the response information and used for showing the service profile obtaining result may show various situations for judging the success or failure of starting the container to be started. For example: the file storage service sends the response information to the service in a message form, the information of the set position of the message is an identifier of the service configuration file acquisition result, the identifier "200 OK" can be used to indicate that the service configuration file of the container to be started is successfully acquired, and the identifier "404 Not Found" indicates that the corresponding service configuration file is Not Found, that is, the service configuration file of the container to be started is empty.
In operation 205, in case that the start result shows that the container to be started is successfully started, the service configuration file of the container is updated.
In case of a successful start of a business service container, for example: the "POD-service 1" shown in fig. 1 requires updating of the service profile of the container according to the change of the profile of the container. For example: the business service can upload the latest service configuration file of the container to update the service configuration file of the container by monitoring the change of the service configuration file of the container under the condition that the change of the service configuration file of the container is monitored.
In this embodiment of the present invention, when the response information shows that the service profile of the container to be started is successfully obtained, the response information further includes the service profile of the container to be started. In this case, before listening for changes in the service profile of the container, the service profile is also extracted from the response information to override the default profile of the container to be started.
In another embodiment of the present invention, in a case that the start result shows that the container to be started is successfully started, the application running condition of the container may be detected, and in a case that the application exits, the latest configuration file of the container may be uploaded to update the service configuration file of the container.
Here, the exit of the application includes a normal exit and an abnormal exit when the application has an error.
In order to ensure that the service configuration file can be updated and uploaded after the application program exits, the operation of the container can be finished after the application program exits at a set time interval.
At operation 206, the updated service profile is uploaded to solidify the service profile.
In this embodiment of the invention, the updated configuration file is uploaded to a file storage service. Therefore, the requirement of the business service on the deployment environment is effectively reduced, and the high portability of the business service and the file storage service is realized. Therefore, no matter the scheme is based on the private deployment, the public deployment or the traditional non-containerized deployment of the container, the main program of the business service can adapt to different physical storage positions and storage modes of the service configuration file. The usability and the safety of the service configuration file processing method are effectively improved.
In an embodiment of the present invention, in a case where it is determined that the starting of the container to be started fails, the current container operation is terminated, and kubemetes is waited to restart the container to be started.
Fig. 3 is a schematic diagram illustrating an implementation flow of the service profile processing method according to the embodiment of the present invention. Referring to fig. 3, the method for processing a service profile according to this embodiment of the present invention at least includes the following operation flows:
in operation 301, the container is started.
For example, the service container automatically detects its own activation.
At operation 302, a request is made to obtain a configuration file for a container.
When the business service container executes the starting operation, the current configuration file of the container is requested to be acquired from the file storage service container. The request for obtaining the configuration file of the container sent by the service container may carry a file name.
In operation 3031, response information including the successful configuration file acquisition identifier and the service configuration file is returned, and operation 304 is performed.
The file storage service container receives the request for obtaining the configuration file of the container, and can return a message to the service container. The message content can show whether the configuration file is successfully acquired, and when the file is successfully acquired, the message content also comprises the current latest configuration file of the service container.
In operation 3032, response information including an identifier that the configuration file is empty is returned, and operation 305 is performed.
The file storage service container returns a configuration file null flag to the business service container, then operation 305 is performed.
Operation 3033 returns response information including connection failure in the service configuration file acquisition process, terminates container operation, and waits for restart.
And the file storage service container returns a service configuration file to the service container, the connection is failed in the process of obtaining the service configuration file, the container is stopped to run, and the restart is waited.
Operation 3034 returns response information including connection errors in the service configuration file acquisition process, terminates the container operation, and waits for restart.
And the file storage service container returns response information of the service configuration file acquisition process connection error to the service container, terminates the operation of the container and waits for restarting.
Operation 304 extracts the service profile from the response message to override the default profile of the container to be started.
Operation 305 listens for a change to the service profile of the container.
In operation 306, in case of monitoring the change of the service profile of the container, the latest service profile of the container is uploaded to update the service profile of the container.
At operation 307, the application run of the container is detected.
At operation 308, in the event the application exits, the latest configuration file for the container is uploaded to update the service configuration file for the container.
In operation 309, after the application exits, the container operation is ended at a set time interval.
Fig. 4 is a schematic implementation flow diagram of a specific application example of the service profile processing method according to the embodiment of the present invention. Referring to fig. 4, a specific application example of the service profile processing method according to this embodiment of the present invention at least includes the following operation flows:
in operation 401, the container is started.
Specifically, the service container performs a start operation.
At operation 402, a get profile request is sent.
Specifically, the service container sends a request for obtaining a configuration file to the file storage service.
At operation 403, a return value for the profile request is determined.
Specifically, the file service container sends a return value to the business service container in response to the configuration file request. And the business service container judges according to the return value to determine the subsequent operation.
If the return value is "200 OK", then operation 404 is performed; if the return value is "400 Not Found", then operation 405 is performed; if the return value shows "failure of connection of the service container to the file storage service container or other error", the container start operation is terminated, and in the case of kubernets restart of the container, operation 401 is returned to.
Operation 404 overrides the default configuration file.
Specifically, if the return value is "200 OK", it is described that the file storage service container includes the current latest service configuration file of the service container to be started, and the file storage service sends the current latest service configuration file to the service container while returning "200 OK". And when the business service container receives the current latest service configuration file, the current latest service configuration file is used for covering the default configuration file of the application program of the business service container.
At operation 405, a configuration file is listened to.
Specifically, if the return value is "400 Not Found", it is stated that the current latest service configuration file of the service container to be started is Not Found in the file storage service container, and the service configuration file of the service container to be started is Not archived in the file storage service container. However, the business service container can be started normally, and the application programs included in the business service container can run normally. At this time, the configuration file of the business service container may be monitored, and when the configuration file changes, operation 406 is performed. The monitoring operation can be realized through an inotify mechanism of the Linux system, and other applicable modes can also be adopted. The present invention is not particularly limited in this regard.
At operation 406, the latest configuration file is uploaded.
Specifically, when monitoring the change of the service configuration file, the service container uploads the latest configuration file to the file storage service.
At operation 407, the application is launched.
For example, after the service container is successfully started, the application program included in the service container may be started.
At operation 408, an application run state is detected.
Specifically, the business service container detects the running state of the application program.
In operation 409, in case the application program exits, the latest configuration file is uploaded or a set time is waited for.
Specifically, the exit of the application includes the abnormal exit in the case of normal exit of the application and an error of the application, and in the case of exit of the application, in order to ensure that the latest configuration file of the business service container can be uploaded to the file storage service. There is a need to perform operation 410 after confirming that the uploading of the latest configuration file is completed, and the container operation is ended. Typically, the profile is uploaded in the order of milliseconds, where the wait set time can be set to 1s, 1.5s, 2s, etc.
At operation 410, the container run ends. In the case of a kubernets restart of the container, return is made to operation 401.
For other specific implementation processes of the operations 401 and 411, reference may be made to corresponding specific implementation processes in the embodiments shown in fig. 1 to 3, which are not described herein again.
The embodiment of the invention provides a service configuration file processing method, a device, a computer readable storage medium and an electronic device, wherein a container starting request of a container to be started is detected, a file obtaining request for obtaining a configuration file of the container to be started is sent in response to the container starting request, response information in response to the file obtaining request is received, the response information is used for showing an obtaining result of the configuration file of the container to be started, a starting result of the container to be started is judged according to the response information, the service configuration file of the container is updated under the condition that the starting result shows that the container to be started is started successfully, and the updated service configuration file is uploaded to solidify the service configuration file. Therefore, a cloud file storage service can be deployed, cloud native privatization deployment is achieved, and when the business node detects a container starting request, a service configuration file is obtained from the file storage service. Therefore, cloud native deployment can be achieved, meanwhile, configuration access can be safely and reliably carried out across machines without exposing any connecting port, main business application programs in containers of business nodes do not need to be modified, and efficient real-time configuration file synchronous storage is achieved. In addition, the method can also realize multi-machine backup of the service configuration file through a main/standby mechanism, thereby effectively ensuring data security.
Similarly, based on the above service profile processing method, an embodiment of the present invention further provides a computer-readable storage medium, where a program is stored, and when the program is executed by a processor, the processor is caused to perform at least the following operation steps: operation 201, detecting a container starting request of a container to be started; operation 202, in response to the container start request, sending a file acquisition request for acquiring a configuration file of the container to be started; operation 203, receiving response information in response to the file obtaining request, where the response information is used to show a obtaining result of the configuration file of the container to be started; operation 204, judging a starting result of the container to be started according to the response information; operation 205, in the case that the start result shows that the container to be started is successfully started, updating the service configuration file of the container; at operation 206, the updated service profile is uploaded to solidify the service profile.
Further, based on the above service profile processing method, an embodiment of the present invention further provides a service profile processing apparatus, as shown in fig. 5, where the apparatus 50 includes: a start detection module 501, configured to detect a container start request of a container to be started; a file obtaining module 502, configured to send, in response to a container starting request, a file obtaining request for obtaining a configuration file of a container to be started; a receiving module 503, configured to receive response information in response to the file obtaining request, where the response information is used to show a result of obtaining a configuration file of the container to be started; a starting judgment module 504, configured to judge a starting result of the container to be started according to the response information; an updating module 505, configured to update the service configuration file of the container when the start result shows that the container to be started is successfully started; and a solidifying module 506, configured to upload the updated service profile to solidify the service profile.
According to an embodiment of the present invention, the start determining module 504 includes: the first judgment submodule is used for judging that the container to be started is started successfully under the condition that the response information shows one of the following conditions: successfully acquiring the service configuration file of the container to be started; the service profile of the container to be started is empty.
According to an embodiment of the present invention, in a case that the response information shows that the service configuration file of the container to be started is successfully obtained, the response information further includes the service configuration file of the container to be started.
According to an embodiment of the present invention, the update module 505 comprises: the monitoring submodule is used for monitoring the change of the service configuration file of the container; and the first updating submodule is used for uploading the latest service configuration file of the container under the condition that the change of the service configuration file of the container is monitored so as to update the service configuration file of the container.
According to an embodiment of the present invention, the update module 505 further includes: the detection submodule is used for detecting the application program running condition of the container; and the second updating submodule is used for uploading the latest configuration file of the container to update the service configuration file of the container under the condition that the application program exits.
According to an embodiment of the invention, the apparatus 50 further comprises: and the container ending module is used for ending the container operation at intervals of set time after the application program exits.
According to an embodiment of the present invention, the update module 505 further includes: and the replacing submodule is used for extracting the service configuration file from the response information to cover the default configuration file of the container to be started before monitoring the change of the service configuration file of the container under the condition that the response information shows that the service configuration file of the container to be started is successfully obtained.
According to an embodiment of the present invention, the start determining module 504 further includes: a second judgment submodule, configured to judge that the start of the container to be started fails if the response information shows one of: the service configuration file of the container to be started fails to acquire the connection in the process; and the service configuration file acquisition process of the container to be started is connected wrongly.
According to an embodiment of the invention, the apparatus 50 further comprises: and the restarting module is used for restarting the container to be started under the condition that the starting of the container to be started is judged to fail.
Further, based on the above service profile processing method, an embodiment of the present invention further provides an electronic device, as shown in fig. 6, where the electronic device 60 includes: the system comprises a processor 601, a communication interface 602, a memory 603 and a communication bus 604, wherein the processor 601, the communication interface 602 and the memory 603 complete mutual communication through the communication bus 604; a memory 603 for storing a computer program; the processor 601 is configured to implement the service profile processing method when executing the program stored in the memory 603.
Here, it should be noted that: the above description of the service profile processing apparatus and the embodiment of the electronic device is similar to the description of the method embodiment shown in fig. 1 to 4, and has similar beneficial effects to the method embodiment shown in fig. 1 to 4, and therefore, the description is omitted. For technical details not disclosed in the embodiment of the service profile processing apparatus of the present invention, please refer to the description of the method embodiment shown in fig. 1 to 4 of the present invention for understanding, and therefore, for brevity, will not be described again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described device embodiments are merely illustrative, for example, the division of a unit is only one logical function division, and there may be other division ways in actual implementation, such as: multiple units or components may be combined, or may be integrated into another system, or some features may be omitted, or not implemented. In addition, the coupling, direct coupling or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection between the devices or units may be electrical, mechanical or other forms.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units; can be located in one place or distributed on a plurality of network units; some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, all the functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may be separately regarded as one unit, or two or more units may be integrated into one unit; the integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
Those of ordinary skill in the art will understand that: all or part of the steps for realizing the method embodiments can be completed by hardware related to program instructions, the program can be stored in a computer readable storage medium, and the program executes the steps comprising the method embodiments when executed; and the aforementioned storage medium includes: various media that can store program codes, such as a removable Memory device, a Read Only Memory (ROM), a magnetic disk, or an optical disk.
Alternatively, the integrated unit of the present invention may be stored in a computer-readable storage medium if it is implemented in the form of a software functional module and sold or used as a separate product. Based on such understanding, the technical solutions of the embodiments of the present invention may be essentially implemented or a part contributing to the prior art may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the methods of the embodiments of the present invention. And the aforementioned storage medium includes: a removable storage device, a ROM, a magnetic or optical disk, or other various media that can store program code.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims (10)

1. A service configuration file processing method is applied to business services, and the method comprises the following steps:
detecting a container starting request of a container to be started;
responding to the container starting request, and sending a file acquisition request for acquiring the configuration file of the container to be started to a file storage service;
receiving response information of the file storage service responding to the file acquisition request, wherein the response information is used for showing an acquisition result of the configuration file of the container to be started;
judging the starting result of the container to be started according to the response information;
updating the service configuration file of the container under the condition that the starting result shows that the container to be started is successfully started;
uploading the updated service configuration file to a file storage service to solidify the service configuration file;
wherein, under the condition that the starting result shows that the container to be started is successfully started, updating the service configuration file of the container comprises:
monitoring the change of the service configuration file of the container through an inotify mechanism of the Linux system;
uploading the latest service configuration file of the container to update the service configuration file of the container under the condition that the change of the service configuration file of the container is monitored;
detecting the application program running condition of the container;
and uploading the latest configuration file of the container to update the service configuration file of the container under the condition that the application program exits.
2. The method according to claim 1, wherein the determining the starting result of the container to be started according to the response information comprises:
determining that the container to be started is started successfully if the response information shows one of the following:
the service configuration file of the container to be started is successfully obtained;
and the service configuration file of the container to be started is empty.
3. The method according to claim 2, wherein in a case that the response information shows that the service profile of the container to be started is successfully obtained, the response information further includes the service profile of the container to be started.
4. The method of claim 1, further comprising:
and after the application program exits, setting time at intervals, and finishing the operation of the container.
5. The method according to claim 1, wherein in case that the response message shows that the service profile of the container to be started is successfully obtained,
before monitoring the change of the service configuration file of the container, updating the service configuration file of the container to be started according to the response information, and further comprising:
and extracting a service configuration file from the response information so as to cover the default configuration file of the container to be started.
6. The method according to claim 1, wherein the determining the starting result of the container to be started according to the response information comprises:
determining that the container to be started fails to start in a case where the response information shows one of:
the service configuration file of the container to be started fails to acquire the connection in the process;
and the service configuration file of the container to be started is in a connection error in the acquisition process.
7. The method of claim 6, further comprising:
and restarting the container to be started under the condition that the container to be started is judged to be failed to be started.
8. A service profile processing apparatus, applied to a business service, the apparatus comprising:
the starting detection module is used for detecting a container starting request of a container to be started;
the file acquisition module is used for responding to the container starting request and sending a file acquisition request for acquiring the configuration file of the container to be started to a file storage service;
a receiving module, configured to receive response information of the file storage service in response to the file acquisition request, where the response information is used to show an acquisition result of the configuration file of the container to be started;
the starting judgment module is used for judging the starting result of the container to be started according to the response information;
the updating module is used for updating the service configuration file of the container under the condition that the starting result shows that the container to be started is successfully started;
the curing module is used for uploading the updated service configuration file to a file storage service so as to cure the service configuration file;
wherein the update module comprises:
the monitoring submodule is used for monitoring the change of the service configuration file of the container through an inotify mechanism of the Linux system;
the first updating submodule is used for uploading the latest service configuration file of the container under the condition that the change of the service configuration file of the container is monitored so as to update the service configuration file of the container;
the detection submodule is used for detecting the application program running condition of the container;
and the second updating submodule is used for uploading the latest configuration file of the container to update the service configuration file of the container under the condition that the application program exits.
9. A computer-readable storage medium comprising a set of computer-executable instructions that, when executed, perform the service profile handling method of any of claims 1-7.
10. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus; a memory for storing a computer program; a processor for implementing the service profile processing method of any one of claims 1 to 7 when executing the program stored in the memory.
CN202110364580.2A 2021-04-06 2021-04-06 Service configuration file processing method and device, storage medium and electronic equipment Active CN112732412B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110364580.2A CN112732412B (en) 2021-04-06 2021-04-06 Service configuration file processing method and device, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110364580.2A CN112732412B (en) 2021-04-06 2021-04-06 Service configuration file processing method and device, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN112732412A CN112732412A (en) 2021-04-30
CN112732412B true CN112732412B (en) 2021-08-03

Family

ID=75596409

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110364580.2A Active CN112732412B (en) 2021-04-06 2021-04-06 Service configuration file processing method and device, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN112732412B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113687854A (en) * 2021-10-26 2021-11-23 北京溪塔科技有限公司 Parameter updating method and device compatible with cloud native application
CN114363168B (en) * 2021-12-21 2024-06-14 上海众源网络有限公司 In-container service configuration modification method and device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106027328A (en) * 2016-05-13 2016-10-12 深圳市中润四方信息技术有限公司 Cluster monitoring method and system based on application container deployment
CN108600029A (en) * 2018-05-09 2018-09-28 深圳壹账通智能科技有限公司 A kind of configuration file update method, device, terminal device and storage medium
CN111736956A (en) * 2020-06-29 2020-10-02 苏州浪潮智能科技有限公司 Container service deployment method, device, equipment and readable storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105893083B (en) * 2016-03-29 2019-06-11 华中科技大学 Mobile code unloading support system and its discharging method under cloud environment based on container
CN112099836A (en) * 2019-05-31 2020-12-18 北京金山云网络技术有限公司 Configuration file updating method, configuration server, version control server and system
CN110413346B (en) * 2019-07-30 2022-09-20 中国工商银行股份有限公司 Parameter updating method and device
CN110750332A (en) * 2019-10-23 2020-02-04 广西梯度科技有限公司 Method for setting static IP (Internet protocol) in Pod in Kubernetes
CN112181606B (en) * 2020-11-04 2024-05-24 石化盈科信息技术有限责任公司 Container configuration updating method, device, system, storage medium and electronic equipment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106027328A (en) * 2016-05-13 2016-10-12 深圳市中润四方信息技术有限公司 Cluster monitoring method and system based on application container deployment
CN108600029A (en) * 2018-05-09 2018-09-28 深圳壹账通智能科技有限公司 A kind of configuration file update method, device, terminal device and storage medium
CN111736956A (en) * 2020-06-29 2020-10-02 苏州浪潮智能科技有限公司 Container service deployment method, device, equipment and readable storage medium

Also Published As

Publication number Publication date
CN112732412A (en) 2021-04-30

Similar Documents

Publication Publication Date Title
US10901858B2 (en) Automated disaster recovery system and method
KR102047216B1 (en) Replaying jobs at a secondary location of a service
EP2539820B1 (en) System and method for failing over cluster unaware applications in a clustered system
CN111989681A (en) Automatically deployed Information Technology (IT) system and method
US9348706B2 (en) Maintaining a cluster of virtual machines
US11706080B2 (en) Providing dynamic serviceability for software-defined data centers
CN112732412B (en) Service configuration file processing method and device, storage medium and electronic equipment
JP2011118557A (en) Migration management method for virtual machine, computer using the same, virtualization mechanism using the same and computer system using the same
CN113032085A (en) Management method, device, server, management system and medium of cloud operating system
CN111552489B (en) User mode file system hot upgrading method, device, server and medium
JPWO2014076838A1 (en) Virtual machine synchronization system
US8990608B1 (en) Failover of applications between isolated user space instances on a single instance of an operating system
CN113934443A (en) Software upgrading system
CN114598604A (en) Monitoring method, monitoring device and terminal for virtual network function instance information
CN111124428A (en) Application automatic publishing method based on middleware creating and related device
CN112035295A (en) Virtual machine crash event processing method, system, terminal and storage medium
WO2016046951A1 (en) Computer system and file management method therefor
WO2023228233A1 (en) Network management for automatic recovery in event of failure
CN117389713B (en) Storage system application service data migration method, device, equipment and medium
US11687547B1 (en) System and methods for an automated core dump to a Java heap dump conversion
CN108268367B (en) Application program affinity judgment method and related application program
CN106970794B (en) Server cluster and starting method thereof
CN117271214A (en) Energy storage multi-machine system software upgrading method and device, storage medium and electronic equipment
CN114048074A (en) Data recovery method and system for super-fusion host, electronic equipment and storage medium
CN117149350A (en) Deployment method of k8s cluster, generation method and equipment of cluster snapshot

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