Method and system for updating service instance configuration based on cloud and virtual sub-device
By configuring preset files in the local controller, dynamically updating the service instance configuration of the virtual sub-device, the problem of restarting the configuration of the virtual sub-device service instance in the prior art is solved, and the update efficiency and device operation performance are improved.
Patent Information
- Application Number
- CN202411146239.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-12-13
AI Technical Summary
The prior art requires restarting the service configuration information used by the service instance when updating the service instance configuration of the virtual sub-device, which causes the update process to be time-consuming and labor-intensive and affects the operation of the device.
By receiving update configuration function instructions, parsing service instruction parameters, obtaining business configuration data and configuration file directory mounted by the service instance, updating the configuration file files of the local controller, and monitoring configuration file changes within the service instance, dynamically updating the virtual sub-device Service instance configuration to avoid restarting business configuration information.
It reduces the time and effort of the update process, improves the efficiency of equipment operation, and realizes service instance configuration updates without restart.
Smart Images

Figure CN119135527A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of virtual sub-device update technology, and in particular to a method and system for configuring update service instances based on the cloud and virtual sub-devices. Background Art
[0002] After establishing a connection between the cloud and the virtual sub-device via a controller, the configuration of the service instance of the virtual sub-device may need to be updated due to actual needs.
[0003] However, currently, updating the configuration of a service instance of a virtual sub-device requires restarting the business configuration information used by the service instance, which makes the update process time-consuming and labor-intensive, affecting device operation.
[0004] Therefore, existing technologies still need to be improved and developed. Summary of the Invention
[0005] The main objective of this invention is to provide a method, system, terminal, and computer-readable storage medium for updating service instance configuration based on cloud and virtual sub-devices. This invention aims to solve the problem in the prior art that when updating the configuration of service instances of virtual sub-devices, it is necessary to restart the business configuration information used by the service instance, which results in a time-consuming and labor-intensive update process that affects device operation.
[0006] To achieve the above objectives, the present invention provides a method for configuring update service instances based on cloud and virtual sub-devices. The method for configuring update service instances based on cloud and virtual sub-devices includes the following steps:
[0007] Receive an update configuration function instruction, wherein the update configuration function instruction includes service instruction parameters;
[0008] Parse the service command parameters to obtain the business configuration data and the configuration file directory mounted on the service instance;
[0009] Based on the business configuration data and the configuration file directory mounted on the service instance, update the configuration file of the local controller, wherein the configuration file of the local controller is stored in a preset file in the absolute directory of the local controller;
[0010] When the service instance detects a change in the local controller's configuration file, it reads the updated configuration file and updates the service instance configuration of the virtual sub-device of the local controller.
[0011] Optionally, the process of receiving the update configuration function instruction may further include:
[0012] The service configuration data is edited in the cloud and saved to the database;
[0013] The cloud retrieves the configuration file directory mounted on the service instance from the database, generates an update configuration function instruction based on the business configuration data and the configuration file directory mounted on the service instance, and sends the update configuration function instruction to the local controller.
[0014] Optionally, updating the local controller's configuration file based on the service configuration data and the configuration file directory mounted on the service instance specifically includes:
[0015] Obtain the ID of the service instance, and based on the ID and the configuration file directory mounted on the service instance, obtain the absolute directory of the configuration file;
[0016] The business configuration data is written to the path of a preset file in the absolute directory of the configuration file to obtain the updated configuration file of the local controller.
[0017] Optionally, the step of writing the business configuration data to a preset file path in the absolute directory of the configuration file to obtain the updated local controller configuration file further includes:
[0018] Determine if a preset file exists in the absolute directory of the configuration file corresponding to the current service instance;
[0019] If it does not exist, create a preset file corresponding to the current service instance in the absolute directory of the configuration file.
[0020] Optionally, the step of writing the business configuration data into a preset file path in the absolute directory of the configuration file to obtain the updated local controller configuration file specifically includes:
[0021] The business configuration data is written to a preset file path in the absolute directory of the configuration file using an overwrite update method to obtain the updated configuration file of the local controller.
[0022] Optionally, when the service instance detects a change in the local controller's configuration file, reading the updated configuration file and updating the service instance configuration of the local controller's virtual sub-device specifically includes:
[0023] The service instance constantly listens to the configuration file of the local controller. When the service instance detects that the configuration file of the local controller has changed, it reads the updated configuration file and obtains the updated configuration content.
[0024] The virtual sub-device updates the service instance configuration according to the updated configuration content.
[0025] Optionally, when the service instance detects a change in the local controller's configuration file, it reads the updated configuration file and updates the service instance configuration of the virtual sub-device of the local controller, and then further includes:
[0026] Once the service instance configuration of the virtual sub-device of the local controller is updated, it receives a query function instruction and generates query results based on the ID of the corresponding service instance.
[0027] The query results will be returned to the cloud.
[0028] Furthermore, to achieve the above objectives, the present invention also provides a system for configuring update service instances based on cloud and virtual sub-devices, wherein the system for configuring update service instances based on cloud and virtual sub-devices includes:
[0029] The information receiving module is used to receive update configuration function instructions, wherein the update configuration function instructions include service instruction parameters;
[0030] The parsing module is used to parse the service command parameters to obtain the business configuration data and the configuration file directory mounted on the service instance;
[0031] The configuration file update module is used to update the configuration file of the local controller according to the business configuration data and the configuration file directory mounted on the service instance, wherein the configuration file of the local controller is stored in a preset file in the absolute directory of the local controller.
[0032] The service instance configuration update module is used to read the updated configuration file and update the service instance configuration of the virtual sub-devices of the local controller when the service instance detects that the configuration file of the local controller has changed.
[0033] Furthermore, to achieve the above objectives, the present invention also provides a terminal, wherein the terminal includes: a memory, a processor, and a program for configuring an update service instance based on a cloud and a virtual sub-device, which is stored in the memory and can run on the processor. When the program for configuring the update service instance based on a cloud and a virtual sub-device is executed by the processor, it implements the steps of the method for configuring an update service instance based on a cloud and a virtual sub-device as described above.
[0034] Furthermore, to achieve the above objectives, the present invention also provides a computer-readable storage medium, wherein the computer-readable storage medium stores a program for configuring an update service instance based on a cloud and a virtual sub-device, and when the program for configuring the update service instance based on a cloud and a virtual sub-device is executed by a processor, it implements the steps of the method for configuring an update service instance based on a cloud and a virtual sub-device as described above.
[0035] In this invention, an update configuration function instruction is received, which includes service instruction parameters. The service instruction parameters are parsed to obtain business configuration data and the configuration file directory mounted on the service instance. Based on the business configuration data and the configuration file directory mounted on the service instance, the configuration file of the local controller is updated, wherein the configuration file of the local controller is stored in a preset file in the absolute directory of the local controller. When the service instance detects a change in the configuration file of the local controller, it reads the updated configuration file and updates the service instance configuration of the virtual sub-device of the local controller. When updating the configuration of the service instance of the virtual sub-device, this invention saves the business configuration data generated in the cloud to the path of the preset file by configuring the corresponding preset file in the controller. The corresponding service instance only needs to monitor this preset file. When the preset file changes, the service instance configuration corresponding to the service instance is dynamically updated, thus completing the update of the service instance configuration. During this process, it is not necessary to restart the business configuration information used by the service instance, thereby reducing the time and effort required for the update process and improving the efficiency of device operation. Attached Figure Description
[0036] Figure 1 This is a flowchart of a preferred embodiment of the method for configuring update service instances based on cloud and virtual sub-devices according to the present invention;
[0037] Figure 2 This is a flowchart illustrating a preferred embodiment of the method for configuring update service instances based on cloud and virtual sub-devices according to the present invention.
[0038] Figure 3 This is a structural diagram of a preferred embodiment of the system for configuring update service instances based on cloud and virtual sub-devices according to the present invention;
[0039] Figure 4 This is a structural diagram of a preferred embodiment of the terminal of the present invention. DETAILED DESCRIPTION
[0040] To make the objectives, technical solutions, and advantages of this invention clearer and more explicit, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0041] After establishing a connection between the cloud and the virtual sub-device via a controller, the configuration of the service instance of the virtual sub-device may need to be updated due to actual needs.
[0042] However, currently, updating the configuration of a service instance of a virtual sub-device requires restarting the business configuration information used by the service instance, which makes the update process time-consuming and labor-intensive, affecting device operation.
[0043] To address one or more of the aforementioned issues, this invention receives an update configuration function instruction, wherein the update configuration function instruction includes service instruction parameters; parses the service instruction parameters to obtain service configuration data and the configuration file directory mounted on the service instance; updates the configuration file of the local controller according to the service configuration data and the configuration file directory mounted on the service instance, wherein the configuration file of the local controller is stored in a preset file in the absolute directory of the local controller; when the service instance detects a change in the configuration file of the local controller, it reads the updated configuration file and updates the service instance configuration of the virtual sub-device of the local controller.
[0044] The preferred embodiment of the present invention describes a method for configuring update service instances based on cloud and virtual sub-devices, such as... Figure 1 As shown, the method for configuring update service instances based on the cloud and virtual sub-devices includes the following steps:
[0045] Step S10: Receive update configuration function instruction, wherein the update configuration function instruction includes service instruction parameters.
[0046] It should be noted that in this application, the virtual sub-device is a service instance; the service instance is created and deployed in the cloud and mounted under the controller, which is used to mount the service instance. The service instance is brought online to the cloud through the controller, and the relevant service instance status is reported to the cloud. The service instance status includes: initiation, deployment, instance error, deletion completed, Docker object created but not yet started, Docker object restarting, Docker object running, Docker object being deleted, Docker object paused, Docker object stopped and exited, and Docker object stopped and deleted.
[0047] Specifically, in this application, when updating the service instance configuration of a service instance, the cloud first performs the operation and issues the corresponding update configuration function command, which is then sent to the controller. The configuration function command includes service command parameters, which contain business configuration data and the configuration file directory mounted on the service instance. The business configuration data represents the content of the real-time service configuration update, while the configuration file directory mounted on the service instance indicates the location in the controller where the corresponding files for that service instance are stored.
[0048] Furthermore, the receiving of the configuration update function instruction also includes, prior to:
[0049] The service configuration data is edited in the cloud and saved to the database;
[0050] The cloud retrieves the configuration file directory mounted on the service instance from the database, generates an update configuration function instruction based on the business configuration data and the configuration file directory mounted on the service instance, and sends the update configuration function instruction to the local controller.
[0051] It should be noted that in this application, the database stores information related to the service instance, such as business configuration data and the configuration file directory mounted on the service instance. In a preferred embodiment of this application, the controller mentioned above is a Kaihong controller, and the service instance is a virtual sub-device with attributes, functions, and corresponding events.
[0052] Specifically, in this application, before the controller receives the update configuration function instruction, the cloud needs to generate the corresponding instruction. The cloud first edits the business configuration data according to the user's needs and saves the corresponding business configuration data to the database. In this way, when the service instance configuration needs to be updated, the cloud can retrieve the configuration file directory and business configuration data mounted on the service instance from the database, thereby generating the corresponding update configuration function instruction. The instruction includes service instruction parameters, which include business configuration data and the configuration file directory mounted on the service instance. After receiving the instruction, it is sent to the local controller.
[0053] Furthermore, in implementing the method for updating service instance configuration based on the cloud and virtual sub-devices in this application, it is necessary to first deploy the cloud and local controllers, and then mount the service instance on the local controller. The cloud first selects the service type, specific service, service version, and deployment method, then records the service instance in the database, generates a unique service instance ID, then creates the virtual sub-device corresponding to the service instance in the cloud, mounts it under the local controller, and then calls the deployment function command of the local controller to send the relevant deployment configuration to the corresponding controller, thus completing the mounting of the service instance on the controller.
[0054] Step S20: Parse the service instruction parameters to obtain the business configuration data and the configuration file directory mounted on the service instance.
[0055] Specifically, in this application, the business configuration data edited in the cloud is JSON data. JSON is an open standard file format and data exchange format that is easy to read and write, and also easy for machines to parse and generate. It has various uses in electronic data interchange, including data exchange between web applications and servers. In this application, the business configuration data edited in the cloud is in JSON format. After receiving the update configuration function instruction, the service instruction parameters in the update configuration function instruction are parsed accordingly to obtain the JSON-formatted business configuration data and the configuration file directory mounted on the service instance.
[0056] Step S30: Update the configuration file of the local controller according to the business configuration data and the configuration file directory mounted on the service instance, wherein the configuration file of the local controller is stored in a preset file in the absolute directory of the local controller.
[0057] Specifically, in this application, after the local controller obtains the service configuration data and the configuration file directory mounted on the service instance, the local controller can update the configuration file of the service instance in the local controller by obtaining the service configuration data and the configuration file directory mounted on the service instance, that is, update the configuration file in the local controller, so that the service instance can detect the change in the configuration file and update the service instance configuration in the service instance.
[0058] Furthermore, updating the local controller's configuration file based on the business configuration data and the configuration file directory mounted on the service instance specifically includes:
[0059] Obtain the ID of the service instance, and based on the ID and the configuration file directory mounted on the service instance, obtain the absolute directory of the configuration file;
[0060] The business configuration data is written to the path of a preset file in the absolute directory of the configuration file to obtain the updated configuration file of the local controller.
[0061] Specifically, in this application, the configuration file directory mounted by the service instance can be obtained as a relative path to the corresponding file. Therefore, the service instance ID is first obtained, and then matched with the configuration file directory mounted by the service instance to obtain the absolute directory of the configuration file. After obtaining the absolute directory of the configuration file, the business configuration data can be written to the path of a preset file in the absolute directory of the configuration file. The preset file after writing is the updated configuration file of the local controller.
[0062] In this application, when deploying cloud and local controllers, a pre-agreed default file is agreed upon. The service instance only needs to monitor the file at all times. When the file changes, the corresponding parameters in the service instance are updated to update the service instance configuration.
[0063] Furthermore, the step of writing the business configuration data to a preset file path in the absolute directory of the configuration file to obtain the updated local controller configuration file also includes:
[0064] Determine if a preset file exists in the absolute directory of the configuration file corresponding to the current service instance;
[0065] If it does not exist, create a preset file corresponding to the current service instance in the absolute directory of the configuration file.
[0066] It should be noted that if the corresponding file does not exist in the path of the preset file in the absolute directory of the configuration file in this application, the file should be created and the corresponding business configuration data should be written, rather than appending content; this allows the service instance in this application to focus only on the preset file in that path to complete the service instance configuration update.
[0067] Further, the step of writing the business configuration data into a preset file path in the absolute directory of the configuration file to obtain the updated local controller configuration file specifically includes:
[0068] The business configuration data is written to a preset file path in the absolute directory of the configuration file using an overwrite update method to obtain the updated configuration file of the local controller.
[0069] Specifically, in this application, when writing business configuration data to a preset file path in the absolute directory of the configuration file, the method of overwriting and updating is used to write to the preset file path in the absolute directory of the configuration file. Each time it is written, the previous data is overwritten, thereby obtaining the updated configuration file of the local controller.
[0070] In one embodiment of this application, a service instance A is installed on the controller. This application service has a parameter that needs to be dynamically adjusted. When the parameter in instance A needs to be changed, a corresponding instruction is sent to the controller. The controller receives the instruction and saves the corresponding service configuration data to a preset file path in the absolute directory of the configuration file, i.e., config.json. When the service instance mounted in the controller discovers that config.json has changed, it dynamically modifies the corresponding parameter of service instance A.
[0071] Step S40: When the service instance detects a change in the configuration file of the local controller, it reads the updated configuration file and updates the service instance configuration of the virtual sub-device of the local controller.
[0072] It should be noted that, in this application, due to prior agreement, the service instance only needs to monitor changes to the configuration file in the local controller. Therefore, when a change is detected in the configuration file, it indicates that the parameters inside the service instance, i.e., the service instance configuration, need to be modified. By reading the updated configuration file, the service instance configuration of the local controller can be updated accordingly. The configuration file is also in JSON format.
[0073] Furthermore, when the service instance detects a change in the local controller's configuration file, it reads the updated configuration file and updates the service instance configuration of the local controller's virtual sub-device, specifically including:
[0074] The service instance constantly listens to the configuration file of the local controller. When the service instance detects that the configuration file of the local controller has changed, it reads the updated configuration file and obtains the updated configuration content.
[0075] The virtual sub-device updates the service instance configuration according to the updated configuration content.
[0076] Specifically, in this application, when updating the service instance configuration of a service instance on the local controller, it is necessary to first detect a change in the local controller's configuration file. Upon detection, the updated configuration file is read to obtain the information from the initially edited business configuration data in the cloud, i.e., to obtain the updated configuration content. This updated configuration content is then used to directly update the service instance configuration in the virtual sub-device. During this process, since preset files in the absolute directory of the configuration file are pre-agreed upon, the service instance configuration can be directly updated from the configuration file obtained by updating the preset files in the pre-agreed absolute directory.
[0077] Furthermore, when the service instance detects a change in the local controller's configuration file, it reads the updated configuration file and updates the service instance configuration of the local controller's virtual sub-device. This process further includes:
[0078] Once the service instance configuration of the virtual sub-device of the local controller is updated, it receives a query function instruction and generates query results based on the ID of the corresponding service instance.
[0079] The query results will be returned to the cloud.
[0080] Specifically, in this application, after the service instance configuration of the local controller is updated, the user can query the corresponding service instance configuration. That is, in the local controller, the absolute directory of the configuration file can be obtained through the service instance ID and the configuration file directory mounted on the service instance. From this directory, the contents of preset files and other data can be retrieved, and corresponding query results are generated and returned to the cloud. The query results include the service instance ID, deployment method, configuration file, and information indicating whether the query was successful.
[0081] Furthermore, in this application, through Figure 2 This application further describes the method for configuring update service instances based on the cloud and virtual sub-devices. Figure 2In this process, the service instance configuration is updated based on the L2 OpenHong controller and the cloud. Specifically, the cloud service instance is updated first. The cloud first edits the business JSON configuration, i.e., the business configuration data, and stores it in the database (DB). Then, the L2 OpenHong controller is called to update the configuration function command and send it to the edge side, where the edge side is the L2 OpenHong controller. On the edge side, the instance function command is received, the corresponding business configuration data bizConfig is parsed to obtain the configuration file directory configPath of the service instance, and bizConfig is written to the path of the preset file in the configuration file directory of the service instance. After writing, the result of writing is reported to the cloud. Then, the service instance listens to the corresponding preset file. When the configuration file changes, it reads and parses the configuration file, updates the service instance configuration accordingly, and runs the corresponding service instance with the latest service instance configuration.
[0082] This invention receives an update configuration function instruction, which includes service instruction parameters; parses the service instruction parameters to obtain business configuration data and the configuration file directory mounted on the service instance; updates the configuration file of the local controller according to the business configuration data and the configuration file directory mounted on the service instance, wherein the configuration file of the local controller is stored in a preset file in the absolute directory of the local controller; when the service instance detects a change in the configuration file of the local controller, it reads the updated configuration file and updates the service instance configuration of the virtual sub-device of the local controller. When updating the configuration of the service instance of the virtual sub-device, this invention saves the business configuration data generated in the cloud to the path of the preset file by configuring the corresponding preset file in the controller. The corresponding service instance only needs to monitor the preset file. When the preset file changes, the corresponding service instance configuration is dynamically updated, thus completing the update of the service instance configuration. This process does not require restarting the business configuration information used by the service instance, thereby reducing the time and effort required for the update process and improving the efficiency of device operation.
[0083] Furthermore, if Figure 3 As shown, based on the above-described method for configuring update service instances based on cloud and virtual sub-devices, the present invention also provides a system for configuring update service instances based on cloud and virtual sub-devices, wherein the system for configuring update service instances based on cloud and virtual sub-devices includes:
[0084] Information receiving module 31 is used to receive update configuration function instructions, wherein the update configuration function instructions include service instruction parameters;
[0085] Parsing module 32 is used to parse the service instruction parameters to obtain business configuration data and the configuration file directory mounted on the service instance;
[0086] The configuration file update module 33 is used to update the configuration file of the local controller according to the business configuration data and the configuration file directory mounted on the service instance, wherein the configuration file of the local controller is stored in a preset file in the absolute directory of the local controller.
[0087] The service instance configuration update module 34 is used to read the updated configuration file and update the service instance configuration of the virtual sub-device of the local controller when the service instance detects that the configuration file of the local controller has changed.
[0088] Furthermore, if Figure 4 As shown, based on the above-described method and system for configuring update service instances based on the cloud and virtual sub-devices, the present invention also provides a terminal, which includes a processor 10, a memory 20, and a display 30. Figure 4 Only some of the terminal components are shown; however, it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0089] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory. In other embodiments, the memory 20 may be an external storage device of the terminal, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc. Further, the memory 20 may include both internal and external storage devices. The memory 20 is used to store application software and various types of data installed on the terminal, such as the program code installed on the terminal. The memory 20 can also be used to temporarily store data that has been output or will be output. In one embodiment, the memory 20 stores a program 40 for configuring update service instances based on cloud and virtual sub-devices. This program 40 can be executed by the processor 10 to implement the method for configuring update service instances based on cloud and virtual sub-devices in this application.
[0090] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor, or other data processing chip, used to run program code stored in the memory 20 or process data, such as executing the method for configuring the update service instance based on the cloud and virtual sub-device.
[0091] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. The display 30 is used to display information on the terminal and to display a visual user interface. The components 10-30 of the terminal communicate with each other via a system bus.
[0092] In one embodiment, the steps in the above-described method for configuring update service instances based on cloud and virtual sub-devices are implemented when the processor 10 executes the program 40 for configuring update service instances based on cloud and virtual sub-devices in the memory 20.
[0093] The present invention also provides a computer-readable storage medium storing a program for configuring an update service instance based on a cloud and a virtual sub-device. When executed by a processor, the program for configuring an update service instance based on a cloud and a virtual sub-device implements the steps of the following method for configuring an update service instance based on a cloud and a virtual sub-device:
[0094] Receive an update configuration function instruction, wherein the update configuration function instruction includes service instruction parameters;
[0095] Parse the service command parameters to obtain the business configuration data and the configuration file directory mounted on the service instance;
[0096] Based on the business configuration data and the configuration file directory mounted on the service instance, update the configuration file of the local controller, wherein the configuration file of the local controller is stored in a preset file in the absolute directory of the local controller;
[0097] When the service instance detects a change in the local controller's configuration file, it reads the updated configuration file and updates the service instance configuration of the virtual sub-device of the local controller.
[0098] The method of receiving the configuration update function instruction also includes, prior to:
[0099] The service configuration data is edited in the cloud and saved to the database;
[0100] The cloud retrieves the configuration file directory mounted on the service instance from the database, generates an update configuration function instruction based on the business configuration data and the configuration file directory mounted on the service instance, and sends the update configuration function instruction to the local controller.
[0101] Specifically, updating the local controller's configuration file based on the business configuration data and the configuration file directory mounted on the service instance includes:
[0102] Obtain the ID of the service instance, and based on the ID and the configuration file directory mounted on the service instance, obtain the absolute directory of the configuration file;
[0103] The business configuration data is written to the path of a preset file in the absolute directory of the configuration file to obtain the updated configuration file of the local controller.
[0104] The step of writing the business configuration data to a preset file path in the absolute directory of the configuration file to obtain the updated local controller configuration file also includes:
[0105] Determine if a preset file exists in the absolute directory of the configuration file corresponding to the current service instance;
[0106] If it does not exist, create a preset file corresponding to the current service instance in the absolute directory of the configuration file.
[0107] Specifically, writing the business configuration data into a preset file path in the absolute directory of the configuration file to obtain the updated local controller configuration file includes:
[0108] The business configuration data is written to a preset file path in the absolute directory of the configuration file using an overwrite update method to obtain the updated configuration file of the local controller.
[0109] Specifically, when the service instance detects a change in the local controller's configuration file, it reads the updated configuration file and updates the service instance configuration of the local controller's virtual sub-device.
[0110] The service instance constantly listens to the configuration file of the local controller. When the service instance detects that the configuration file of the local controller has changed, it reads the updated configuration file and obtains the updated configuration content.
[0111] The virtual sub-device updates the service instance configuration according to the updated configuration content.
[0112] The step of reading the updated configuration file and updating the service instance configuration of the virtual sub-device of the local controller when the service instance detects a change in the local controller's configuration file, and then further includes:
[0113] Once the service instance configuration of the virtual sub-device of the local controller is updated, it receives a query function instruction and generates query results based on the ID of the corresponding service instance.
[0114] The query results will be returned to the cloud.
[0115] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal that includes that element.
[0116] Of course, those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware (such as a processor, controller, etc.). The program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The computer-readable storage medium can be a memory, magnetic disk, optical disk, etc.
[0117] It should be understood that the application of the present invention is not limited to the above examples. For those skilled in the art, improvements or changes can be made based on the above description. All these improvements and changes should fall within the scope of protection of the claims attached to the present invention.
Claims
1. A method for updating service instance configuration based on cloud and virtual sub-device, characterized in that: The method for updating the service instance configuration based on the cloud and the virtual sub-device includes: receiving an update configuration function instruction, wherein the update configuration function instruction includes a service instruction parameter; Parse the service instruction parameters to obtain business configuration data and a configuration file directory mounted on the service instance; According to the business configuration data and the configuration file directory mounted by the service instance, updating the configuration file of the local controller, wherein the configuration file of the local controller is stored in a preset file in the absolute directory of the local controller; When the service instance monitors that the configuration file of the local controller has changed, it reads the updated configuration file and updates the service instance configuration of the virtual sub-device of the local controller.
2. The method for updating service instance configuration based on cloud and virtual sub-device according to claim 1, characterized in that: The receiving of the update configuration function instruction also includes: Editing the service configuration data in the cloud and saving the service configuration data in a database; The cloud obtains the configuration file directory mounted on the service instance according to the database, generates an update configuration function instruction according to the business configuration data and the configuration file directory mounted on the service instance, and sends the update configuration function instruction to the local controller.
3. The method for updating service instance configuration based on cloud and virtual sub-device according to claim 1, characterized in that: The updating of the configuration file of the local controller according to the business configuration data and the configuration file directory mounted by the service instance specifically includes: Obtain the ID of the service instance, and obtain the absolute directory of the configuration file according to the ID and the directory of the configuration file mounted by the service instance; The service configuration data is written into the path of the preset file in the absolute directory of the configuration file to obtain an updated configuration file of the local controller.
4. The method for updating service instance configuration based on cloud and virtual sub-device according to claim 3, characterized in that: The process of writing the service configuration data into the path of the preset file in the absolute directory of the configuration file to obtain the updated configuration file of the local controller also includes: Determine whether there is a preset file in the absolute directory of the configuration file corresponding to the current service instance; If it does not exist, create a preset file corresponding to the current service instance in the absolute directory of the configuration file.
5. The method for updating service instance configuration based on cloud and virtual sub-device according to claim 3, characterized in that: The step of writing the service configuration data into a preset file path in the absolute directory of the configuration file to obtain an updated configuration file of the local controller specifically includes: The service configuration data is written into a preset file path in the absolute directory of the configuration file in an overwriting update manner to obtain an updated configuration file of the local controller.
6. The method for updating service instance configuration based on cloud and virtual sub-device according to claim 1, characterized in that: When the service instance monitors that the configuration file of the local controller has changed, the updated configuration file is read and the service instance configuration of the virtual sub-device of the local controller is updated, which specifically includes: The service instance always monitors the configuration file of the local controller. When the service instance detects changes in the configuration file of the local controller, it reads the updated configuration file and obtains the updated configuration content. The virtual sub-device updates the service instance configuration according to the updated configuration content.
7. The method for updating service instance configuration based on cloud and virtual sub-device according to claim 1, characterized in that: When the service instance monitors that the configuration file of the local controller has changed, the updated configuration file is read and the service instance configuration of the virtual sub-device of the local controller is updated, and then the following is further included: When the service instance configuration of the virtual sub-device of the local controller is updated, a query function instruction is received, and a query result is generated according to the ID of the corresponding service instance; The query result is returned to the cloud.
8. A system for updating service instance configuration based on cloud and virtual sub-devices, characterized in that: The system for updating service instance configuration based on cloud and virtual sub-devices includes: An information receiving module, used for receiving an update configuration function instruction, wherein the update configuration function instruction includes a service instruction parameter; A parsing module, used to parse the service instruction parameters to obtain business configuration data and a configuration file directory mounted on the service instance; A configuration file updating module, used to update the configuration file of the local controller according to the business configuration data and the configuration file directory mounted by the service instance, wherein the configuration file of the local controller is stored in a preset file in the absolute directory of the local controller; The service instance configuration update module is used to read the updated configuration file and update the service instance configuration of the virtual sub-device of the local controller when the service instance monitors changes in the configuration file of the local controller.
9. A terminal, characterized in that: The terminal includes: a memory, a processor, and a program for updating service instance configuration based on the cloud and virtual sub-devices stored in the memory and executable on the processor. When the program for updating service instance configuration based on the cloud and virtual sub-devices is executed by the processor, the steps of the method for updating service instance configuration based on the cloud and virtual sub-devices as described in any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a program for updating service instance configuration based on the cloud and virtual sub-devices. When the program for updating service instance configuration based on the cloud and virtual sub-devices is executed by a processor, the steps of the method for updating service instance configuration based on the cloud and virtual sub-devices as described in any one of claims 1-7 are implemented.
