Running environment deployment method and device, equipment, storage medium and program product
By preconfiguring and injecting environment identifiers, it solves the complexity and isolation problems of multiple operating environment deployments in distributed systems, improves deployment efficiency and isolation, and ensures the correct operation of distributed systems.
Patent Information
- Application Number
- CN202410234499.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-29
- Publication Date
- 2024-09-17
AI Technical Summary
In distributed systems, the process of deploying multiple operating environments is complex and error-prone, resulting in resource waste and low deployment efficiency, and there is a lack of isolation mechanism between different environments.
By pre-configuring basic configuration data and component configuration data, injecting environment identifiers to configure components, component reuse and isolation of multiple sets of operating environments are achieved, and environment identifiers are injected when the distributed system is started to ensure correct access.
It reduces the complexity and workload of environment deployment, improves deployment efficiency, achieves isolation between multiple operating environments, and ensures the correct operation of distributed systems.
Smart Images

Figure CN118656291A
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment, storage medium and program product for deploying an operating environment. Background Art
[0002] With the popularity of microservice architecture, current distributed systems are split into multiple independently deployed and independently running processes. During the development process of distributed systems, multiple operating environments are usually deployed to meet development and testing requirements. These operating environments involve a large number of components, so the operations involved in environment deployment are cumbersome and require a lot of configuration.
[0003] Therefore, how to deploy the operating environment efficiently and conveniently is a very important and arduous task that requires an effective solution. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide an operating environment deployment method, apparatus, equipment, storage medium and program product, which are used to simplify the deployment complexity of the operating environment, reduce the deployment failure rate and error rate, and achieve data isolation between multiple operating environments.
[0005] In order to achieve the above objectives, the present application embodiment adopts the following technical solutions:
[0006] In a first aspect, an embodiment of the present application provides a method for deploying an operating environment, including:
[0007] Acquire basic configuration data and component configuration data, wherein the basic configuration data includes an environment identifier of a target operating environment, and the component configuration data is used to configure components involved in the target operating environment;
[0008] After injecting the environment identifier into the component, the component is configured based on the component configuration data to obtain a target component suitable for the target operating environment;
[0009] The distributed system is started, and during the startup of the distributed system, the environment identifier is injected into the access data of the distributed system to the target component.
[0010] In a second aspect, an embodiment of the present application provides an operating environment deployment device, including:
[0011] An acquisition unit, configured to acquire basic configuration data and component configuration data, wherein the basic configuration data includes an environment identifier of a target operating environment, and the component configuration data is used to configure components involved in the target operating environment;
[0012] A configuration unit, configured to inject the environment identifier into the component and then configure the component based on the component configuration data to obtain a target component suitable for the target operating environment;
[0013] The injection unit is used to start the distributed system and, during the startup process of the distributed system, inject the environment identifier into the access data of the distributed system to the target component.
[0014] In a third aspect, an embodiment of the present application provides an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the operating environment deployment method as described in the first aspect.
[0015] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute the operating environment deployment method described in the first aspect.
[0016] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute some or all of the steps in the method described in the first aspect.
[0017] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects:
[0018] By pre-configuring basic configuration data, the environment identifier of the target operating environment is introduced into the basic configuration data, so that the target operating environment is used as the operating environment to be deployed. By pre-configuring component configuration data for updating components required by the distributed system, the environment identifier of the target operating environment is injected into the component to indicate that the component is used in the target operating environment; the component after the environment identifier is injected is configured based on the component configuration data, which plays the role of configuring the component in the target operating environment. In this way, when multiple operating environments need to be deployed, a set of components can be reused in multiple operating environments, so that developers do not need to configure components separately for each operating environment, thereby reducing resource usage, reducing the complexity and workload of environment deployment, and improving deployment efficiency. In addition, since the component configuration data in different operating environments are distinguished by injecting different environment identifiers, isolation between multiple operating environments is achieved. In addition, during the startup process of the distributed system, the environment identifier is injected into the access data of the distributed system to the target component, which can ensure that the distributed system correctly accesses the target component, thereby realizing the deployment of the target operating environment. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0020] Figure 1 A flowchart of a method for deploying an operating environment provided by an embodiment of the present application;
[0021] Figure 2 A flowchart of an operating environment deployment method provided for another embodiment of the present application;
[0022] Figure 3 A schematic diagram of an environment backup process provided for an embodiment of the present application;
[0023] Figure 4 A flowchart of a method for deploying an operating environment provided in yet another embodiment of the present application;
[0024] Figure 5 A schematic diagram of the structure of an operating environment deployment device provided for an embodiment of the present application;
[0025] Figure 6 A schematic diagram of the structure of an electronic device provided for one embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0027] The terms "first", "second", etc. in this specification and claims are used to distinguish similar objects, and are not used to describe a particular order or precedence. It should be understood that the terms used in this way can be interchanged where appropriate so that the embodiments of the present application are implemented in a sequence other than those illustrated or described herein. In addition, "and / or" in this specification and claims means at least one of the connected objects, and the character " / " generally means that the objects associated with each other are in an "or" relationship.
[0028] Related concept description:
[0029] Middleware: refers to some basic functions required by distributed systems, such as MySQL database, Redis cache, Kafka message queue, etc.
[0030] Infrastructure: refers to the management, scheduling, monitoring and other facilities formed around the cycle of distributed systems by a company in order to simplify and ensure development and operation work, such as log collection and analysis systems, monitoring and alarm systems, etc.
[0031] Dynamic proxy: is a technology that dynamically generates proxy objects at runtime, which can enhance or modify the functions of the proxied module.
[0032] During the development process of a distributed system, it is usually necessary to deploy multiple operating environments to meet development and testing requirements. These operating environments involve a large number of components, and it is difficult to debug operating environment deployment errors under the distributed characteristics, and the cost of troubleshooting is high.
[0033] In the related art, the operating environment is usually deployed manually, or based on the overall deployment of containers, that is, the components involved in the operating environment are made into images, and the relationship between services and components in the distributed system is specified, so as to deploy the distributed system into the operating environment. However, the manual deployment method involves heavy operations, many configurations, and is prone to errors. The overall deployment method based on containers consumes a large amount of machine resources, takes a long time for each deployment, and relies on complete cloud publishing capabilities, especially when multiple operating environments need to be deployed or the number of components required for the distributed system is large.
[0034] To this end, the embodiment of the present application provides a method for deploying an operating environment, by pre-configuring basic configuration data, introducing the environment identifier of the target operating environment in the basic configuration data, so as to use the target operating environment as the operating environment to be deployed. By pre-configuring the component configuration data for updating the components required by the distributed system, the environment identifier of the target operating environment is injected into the component to indicate that the component is used in the target operating environment; the component after the environment identifier is injected is configured based on the component configuration data, which plays the role of configuring the component in the target operating environment. In this way, when multiple operating environments need to be deployed, a set of components can be reused in multiple operating environments, so that developers do not need to configure components separately for each operating environment, thereby reducing resource usage, reducing the complexity and workload of environment deployment, and improving deployment efficiency. Moreover, since the component configuration data in different operating environments are distinguished by injecting different environment identifiers, isolation between multiple operating environments is achieved. In addition, during the startup process of the distributed system, the environment identifier is injected into the access data of the distributed system to the target component, which can ensure that the distributed system correctly accesses the target component, thereby realizing the deployment of the target operating environment.
[0035] It should be understood that the operating environment deployment method provided in the embodiment of the present application can be executed by an electronic device, specifically by software in the electronic device. The electronic device can be a terminal device, such as a smart phone, a tablet computer, a laptop computer, a desktop computer, an intelligent voice interaction device, a smart home appliance, a smart watch, a vehicle terminal, an aircraft, etc.; or, the electronic device can also be a server, such as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services.
[0036] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0037] See also Figure 1 , is a flow chart of a method for deploying an operating environment provided by an embodiment of the present application, the method comprising the following steps:
[0038] S102, obtaining basic configuration data and component configuration data.
[0039] The basic configuration data is used to configure the basic parameters related to the operating environment. The basic configuration data includes the environment identifier of the target operating environment. The environment identifier may include any data that can uniquely identify the target operating environment, such as but not limited to the environment name. In addition, the basic configuration data may also include at least one of the following data: the version identifier of the component configuration data, the correspondence between the component identifier and the execution address of the component required by the distributed system, the code warehouse address and account of the distributed system, the code address of all services contained in the distributed system, the component identifier of the component that needs to be injected with the environment identifier, the startup order of all service nodes contained in the distributed system, the name of the backup data table, etc. Among them, the backup data table refers to the data table in the historical version library for backing up the relevant data of the operating environment. In practical applications, the basic configuration data can be recorded in a json format file in the form of a key-value pair. The basic configuration data can be pre-configured and submitted to the code warehouse for storage, and then when the target operating environment needs to be deployed, the basic configuration data is pulled from the code warehouse.
[0040] The component configuration data is used to configure the components involved in the target operating environment, where the components include but are not limited to middleware and infrastructure. As an example, the component configuration data includes the component parameters to be configured for the corresponding components and the types of configuration operations performed on the component parameters, such as adding component parameter 1, deleting component parameter 2, and modifying component parameter 3. In actual applications, the component configuration data corresponds to the component one-to-one, that is, when the target operating environment involves multiple components, each component has corresponding component configuration data. In addition, the component configuration data of each component can be recorded in a json format file in a preset form, and the file is named in the form of the component identifier (such as component name) and the generation date (accurate to seconds), such as component name_generation date.json. The component configuration data of each component can be pre-configured and submitted to the code repository for storage, and then when the target operating environment needs to be deployed, the basic configuration data is pulled from the code repository.
[0041] In order to reduce the probability of configuration errors, component configuration data can be obtained in an incremental manner, which specifically includes the following steps: monitoring configuration operations on component parameters of components; each time a configuration operation on component parameters of a component is monitored, based on the currently monitored configuration operation, generating incremental configuration data of a version corresponding to the configuration operation. In this case, the component configuration data includes n versions of incremental configuration data, and each version of the incremental configuration data is used to describe the configuration operation information performed on the component parameters of the component. Furthermore, configuring the components in accordance with n versions of incremental configuration data in sequence can ensure that the configured components are up to date and complete.
[0042] For example, if a configuration operation of the component parameters of the newly added component redis is monitored at 18:03 on November 17, 2023, a version of incremental configuration data redis_202311171803.json is generated, and the configuration operation information described is the component parameters of the newly added redis. Then, if a configuration operation of modifying the component parameters of the component redis is monitored at 18:03 on November 18, 2023, another version of incremental configuration data redis_202311181803.json is generated, and the configuration operation information described is the modification of the component parameters of redis. At this point, the obtained component configuration data includes two versions of incremental configuration data.
[0043] In another embodiment, in order to reduce the probability of environmental deployment errors, after obtaining the above S102, the basic configuration data and component configuration data are also subjected to a normative check, such as checking whether the basic configuration data and component configuration data conform to a preset data format, etc.; if the basic configuration data or the component configuration data fails the normative check, a prompt message is output; if both the basic configuration data and the component configuration data pass the normative check, S104 to S106 are executed.
[0044] S104, after injecting the environment identifier into the component, the component is configured based on the component configuration data to obtain a target component suitable for the target operating environment.
[0045] By injecting the environment identifier of the target operating environment into the component to indicate that the component is used in the target operating environment, the component with the injected environment identifier is configured based on the component configuration data, thereby playing the role of configuring the component in the target operating environment. Therefore, in the case where there are multiple sets of target operating environments, the environment identifier of the target operating environment can be injected into the component for each target operating environment, so that multiple sets of target operating environments reuse one set of components, thereby making it unnecessary for developers to configure components separately for each target operating environment. The layout can reduce resource usage, and can also reduce the complexity and workload of environment deployment, thereby improving deployment efficiency. In addition, since the component configuration data in different target operating environments are distinguished by the injection of different environment identifiers, isolation between multiple sets of target operating environments is achieved.
[0046] In the above S104, the environment identifier can be injected into the component in combination with the characteristics of the component parameters to indicate that the component is used in the target operating environment. As an example, if the component parameters of the component are not in the form of key-value pairs, the environment identifier is added to the component name or execution address of the component. For example, if the component is a database, the environment identifier is added to the end of the data table name in the database; if the component is a message queue, the environment identifier is added to the topic name of the message queue; if the component is a task scheduler, the environment identifier is added to the execution address of the task scheduler.
[0047] As another example, if the component parameters of the component are in the form of key-value pairs, a new field is added to the component parameters, and the environment identifier is used as the value of the field.
[0048] In the above S104, the component with the injected environment identifier is configured based on the component configuration data to obtain the target component suitable for the target operating environment. This can be achieved in various ways, which are not limited in the embodiments of the present application.
[0049] In one implementation, the component into which the environment identifier is injected may be configured directly based on the component configuration data to obtain the target component.
[0050] Considering that when there is a lot of component configuration data, it is a lot of work to configure the components using the above implementation method, especially with the continuous upgrade of the target operating environment. In this way, the components need to be configured from scratch each time. To this end, in another implementation method, the component injected with the environment identifier is configured based on the component configuration data to obtain the target component suitable for the target operating environment, including the following steps: Step A1, based on the version identifier, obtain the historical component configuration data of the previous version of the component configuration data from the historical version library; Step A2, based on the historical component configuration data, configure the component to obtain a candidate component; Step A3, based on the component configuration data, update the current component parameters of the candidate component to obtain the target component.
[0051] The historical version library is used to store the historical component configuration data of each version of the target operating environment. Of course, the historical version library can also store the basic configuration data and code warehouse nodes of each version of the target operating environment.
[0052] For example, the version identifier of the component configuration data of the component redis obtained from the basic configuration data is 202311181803. Based on the version identifier, the previous version identifier of the component configuration data in the target running environment is queried from the historical version library as 202311171803, then the historical component configuration data of the version identifier is obtained, and redis is configured based on the historical component configuration data to obtain the candidate redis; then, based on the component configuration data with version identifier 202311181803, further updates are performed on the basis of the candidate component to obtain the target component.
[0053] In this implementation, the components are first configured in the target operating environment using the historical component configuration data of the previous version. On this basis, the configured components are further updated using the latest version of the component configuration data. Only the component parameters that differ from the historical component configuration data need to be updated, without configuring all component parameters. In the case of a large number of component parameters, the configuration efficiency can be significantly improved. In addition, this method is better suited for situations where component configuration data is generated in an incremental manner. In the incremental generation method, it is possible to avoid configuring the complete component configuration data from scratch each time, further reducing the deployment workload and improving deployment efficiency.
[0054] In order to further improve the efficiency of component configuration and thus improve the efficiency of environmental deployment, in step A3, the target component parameters are determined based on the component configuration data; based on the comparison result between the target component parameters and the current component parameters of the candidate component, update operation information for the candidate component is generated; based on the update operation information, the current component parameters of the candidate component are updated to obtain the target component.
[0055] As an example, if a component parameter exists in the current component parameters of the candidate component but does not exist in the target component parameters, update operation information for deleting the component parameter is generated. If a component parameter does not exist in the candidate component parameters but exists in the target component parameters, update operation information for adding the component parameter is generated. If a component parameter exists in both the current component parameters of the candidate component and the target component parameters, update operation information for updating the component parameter is generated.
[0056] For example, the component configuration parameter of the component redis indicates adding component parameter 1 to redis and assigning the value test1, changing the value of component parameter 2 of redis to testa2, and deleting component parameter 3. Then, the target component parameters can be determined as: component parameter 1, component parameter 2—test2. The current component parameters of the candidate component redis are: component parameter 2—testb2, component parameter 3—test3. By comparing the target component parameters and the current component parameters of the candidate component redis, it is determined that the update operation information for the candidate component redis is: adding component parameter 1 to the candidate component redis and assigning the value test1, changing the value of component parameter 2 of the candidate component redis from testa2 to testb2, and deleting component parameter 3 of the candidate component redis. Further, based on the update operation information, an update operation is performed on the candidate component redis to obtain the target component redis suitable for the target operating environment.
[0057] Of course, if the previous version of historical component configuration data is not obtained, for example, the target operating environment is deployed for the first time, that is, the version of the component configuration data obtained through S102 is the first version, then the component with the injected environment identifier is configured based on the component configuration data to obtain the target component of the target operating environment.
[0058] In another embodiment, considering that when the component configuration data is generated in an incremental manner, the component configuration data includes n versions of incremental configuration data and n is greater than 1, at this time, if the configuration operation is performed on the component with the injected environment identifier based on each version of incremental configuration data in turn, the configuration time will be increased. Therefore, in order to further improve the configuration efficiency, the target component can be configured by configuring the component in the following manner: based on the configuration operation information described by the n versions of incremental configuration data and the generation time of the n versions of incremental configuration data, the n versions of incremental configuration data are merged to obtain the target component configuration data; the component is configured based on the target component configuration data to obtain the target component.
[0059] For example, taking one of the components as an example, the configuration operation information described by the incremental configuration data of version 1 includes: adding two component parameters "test:1" and "testb:10", the configuration operation information described by the incremental configuration data of version 2 includes: changing the component parameter "test:1" to "test:2", and the configuration operation information described by the incremental configuration data of version 3 includes: deleting the component parameter "testb" and adding the component parameter "testc:2". After merging the incremental configuration data of the three versions according to the generation time, the target component configuration data obtained includes: adding the component parameter "test:2" and adding the component parameter "testc:2".
[0060] In this embodiment, after obtaining the target component configuration data of each component involved in the target operating environment through the merging method of this embodiment, the target component parameters can also be determined based on the target component configuration data; based on the comparison result between the target component parameters and the current component parameters of the candidate component, update operation information for the candidate component is generated; based on the update operation information, the current component parameters of the candidate component are updated to obtain the target component.
[0061] The embodiment of the present application shows some implementation methods of the above S104. Of course, it should be understood that the above S104 can also be implemented in other ways, and the embodiment of the present application does not limit this.
[0062] S106, starting the distributed system, and during the process of starting the distributed system, injecting the environment identifier into the access data of the distributed system to the target component.
[0063] Since the distributed system includes multiple service nodes, in order to ensure that each service node can correctly access the target component in the target operating environment during the startup process, thereby ensuring that the distributed system can operate normally in the target operating environment, in one embodiment, the above S106 may include the following steps: Step B1, obtaining the startup sequence of the service nodes in the distributed system from the basic configuration data; Step B2, starting the service nodes in the distributed system based on the startup sequence; Step B3, during the startup process of the service node, injecting the environment identifier into the access data of the service node for the target component.
[0064] The access data includes the running context associated with the service node, such as but not limited to cache access keys, external access links, message queue topics, etc.
[0065] In the above step B3, the access request of the service node for the target component can be intercepted, access data can be obtained from the access request, and the environment identifier can be injected into the access data. Since the dynamic proxy allows the object to be enhanced without modifying the original object, in the embodiment of the present application, the dynamic proxy is used to inject the environment identifier into the access data, so that the service node can access the target component in the target operating environment without modifying the access data.
[0066] Among them, intercepting the access request can be implemented by various interception technologies, such as dynamic proxy, pre-developed interceptor, etc., which is not limited in the embodiments of the present application.
[0067] For example, a distributed system includes service nodes 1 to 3, and the startup order between these service nodes is service node 1->service node 3->service node 2, and these service nodes are started in sequence according to this startup order. During the startup process of service node 1, if an access request to a target component of service node 1 is intercepted, the access request is intercepted by a dynamic proxy, and access data is obtained and an environment identifier is injected, so that the access data points to the target operating environment, and then the target component in the target operating environment can be correctly accessed based on the access data. After service node 1 is started, the next service node is started according to the above startup order, and the above operation of injecting the environment identifier is repeated until all service nodes are started.
[0068] The embodiment of the present application shows some implementation methods of the above S106. Of course, it should be understood that the above S106 can also be implemented in other ways, such as starting all service nodes in the distributed system at the same time, and monitoring, intercepting and injecting environment identifiers for access requests to the target component for each service node, so as to ensure that all service nodes can correctly access the target component in the target operating environment.
[0069] The operating environment deployment method provided by the embodiment of the present application, by pre-configuring basic configuration data, introduces the environment identifier of the target operating environment in the basic configuration data, so as to use the target operating environment as the operating environment to be deployed. By pre-configuring the component configuration data for updating the components required by the distributed system, the environment identifier of the target operating environment is injected into the component to indicate that the component is used in the target operating environment; the component after the environment identifier is injected is configured based on the component configuration data, which plays the role of configuring the component in the target operating environment. In this way, when multiple operating environments need to be deployed, a set of components can be reused in multiple operating environments, so that developers do not need to configure components separately for each operating environment, thereby reducing resource usage, reducing the complexity and workload of environment deployment, and improving deployment efficiency. Moreover, since the component configuration data in different operating environments are distinguished by injecting different environment identifiers, isolation between multiple operating environments is achieved. In addition, during the startup process of the distributed system, the environment identifier is injected into the access data of the distributed system to the target component, which can ensure that the distributed system correctly accesses the target component, thereby realizing the deployment of the target operating environment.
[0070] The operating environment deployment method provided in the embodiment of the present application is applicable to the scenario of first deploying the operating environment, and is also applicable to the scenario of upgrading the deployed operating environment. Figures 2 to 4 , describes the deployment and upgrade process of the operating environment.
[0071] like Figure 2 As shown, according to the configuration operations performed by the developer on the configuration interface, basic configuration data is generated, and corresponding component configuration data is configured for the components involved in each operating environment, and the basic configuration data and component configuration data are submitted to the code repository for storage.
[0072] In response to the environment deployment instruction for the target operating environment, the relevant basic configuration data and the component configuration data of the components involved in the target operating environment are obtained from the code repository. Then, the obtained configuration data is parsed, the environment identifier of the target operating environment is obtained from the basic configuration data, and the environment identifier is injected into the component, and the component with the injected environment identifier is configured based on the component configuration data, such as configuring the scheduled task scheduler, message queue, cache, database, etc., to obtain the target component suitable for the target operating environment.
[0073] After that, the distributed system is started. During the startup of the distributed system, the environment identifier is injected into the access data of the distributed system to the target component. After the distributed system is started, the first deployment of the target operating environment is completed.
[0074] like Figure 3As shown, after the first deployment of the target operating environment is completed, in response to the backup instruction of the target operating environment, the basic configuration data and component configuration data are backed up to obtain backup data. A corresponding version identifier is generated for the backup data, and the backup data is stored in the historical version library for subsequent use in the upgrade and operation and maintenance of the target operating environment.
[0075] like Figure 4 As shown, in response to the upgrade instruction for the target operating environment, the latest basic configuration data and the latest component configuration data for the target operating environment are obtained from the code repository, and these configuration data are checked for compliance. If the check result is not passed, a prompt message is output to prompt the developer to correct these configuration data. If the check result is passed, these configuration data are parsed, the environment identifier of the target operating environment is obtained from the basic configuration data, and the environment identifier is injected into the component.
[0076] At the same time, the previous version of the historical component configuration data is obtained from the historical version library, and the component injected with the environment identifier is configured by combining the historical component configuration data and the latest component configuration data to obtain the target component suitable for the target operating environment.
[0077] After that, the distributed system is started. During the startup of the distributed system, the environment identifier is injected into the access data of the distributed system to the target component. After the distributed system is started, the upgrade of the target operating environment is completed.
[0078] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0079] Based on the same inventive concept, the present application embodiment also provides an operating environment deployment device. Figure 5 , is a structural diagram of an operating environment deployment device 500 provided in an embodiment of the present application, and the device 500 includes: an acquisition unit 510, a configuration unit 520 and an injection unit 530.
[0080] The acquisition unit 510 is used to acquire basic configuration data and component configuration data, wherein the basic configuration data includes an environment identifier of a target operating environment, and the component configuration data is used to configure components involved in the target operating environment.
[0081] The configuration unit 520 is used to inject the environment identifier into the component and then configure the component based on the component configuration data to obtain a target component suitable for the target operating environment.
[0082] The injection unit 530 is used to start the distributed system, and during the startup process of the distributed system, inject the environment identifier into the access data of the distributed system to the target component.
[0083] In another embodiment, the basic configuration data further includes a version identifier of the component configuration data;
[0084] The configuration unit is used to:
[0085] Based on the version identifier, acquiring the historical component configuration data of the previous version of the component configuration data from a historical version library;
[0086] Based on the historical component configuration data, the component is configured to obtain a candidate component;
[0087] The current component parameters of the candidate component are updated based on the component configuration data to obtain the target component.
[0088] In another embodiment, when the configuration unit updates the current component parameters of the candidate component based on the component configuration data to obtain the target component, the configuration unit performs the following steps:
[0089] Determining target component parameters based on the component configuration data;
[0090] Based on the comparison result between the target component parameters and the current component parameters of the candidate component, generating update operation information for the candidate component;
[0091] Based on the update operation information, the current component parameters of the candidate component are updated to obtain the target component.
[0092] In another embodiment, the component configuration data includes n versions of incremental configuration data, the incremental configuration data is used to describe configuration operation information performed on component parameters of the component, and n is an integer greater than 1;
[0093] The configuration unit is used to:
[0094] Based on the configuration operation information described in the n versions of the incremental configuration data and the generation time of the n versions of the incremental configuration data, the n versions of the incremental configuration data are merged to obtain the target component configuration data;
[0095] The component is configured based on the target component configuration data to obtain the target component.
[0096] In another embodiment, the component configuration data is obtained by:
[0097] Listening for configuration operations of component parameters of the component;
[0098] Whenever a configuration operation on a component parameter of the component is monitored, incremental configuration data of a version corresponding to the configuration operation is generated based on the currently monitored configuration operation.
[0099] In another embodiment, the basic configuration data also includes a startup sequence of service nodes in the distributed system;
[0100] The injection unit is used for:
[0101] Based on the startup sequence, starting the service node in the distributed system;
[0102] During the startup process of the service node, the environment identifier is injected into the access data of the service node for the target component.
[0103] In another embodiment, when injecting the environment identifier into the access data of the service node for the target component, the injection unit performs the following steps:
[0104] intercepting an access request from the service node to the target component, and obtaining the access data from the access request;
[0105] The environment identifier is injected into the access data.
[0106] Obviously, the operating environment deployment device provided in the embodiment of the present application can be used as the above Figure 1 The execution subject of the operating environment deployment method shown in the figure can thus realize the operating environment deployment device in Figure 1 The functions realized are as follows. Since the principles are the same, they will not be described in detail.
[0107] Figure 6 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 6 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0108] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 6 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0109] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0110] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming an operating environment deployment device at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0111] Acquire basic configuration data and component configuration data, wherein the basic configuration data includes an environment identifier of a target operating environment, and the component configuration data is used to configure components involved in the target operating environment;
[0112] After injecting the environment identifier into the component, the component is configured based on the component configuration data to obtain a target component suitable for the target operating environment;
[0113] The distributed system is started, and during the startup of the distributed system, the environment identifier is injected into the access data of the distributed system to the target component.
[0114] The above application Figure 1The method performed by the operating environment deployment device disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in a decoding processor. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0115] The electronic device may also perform Figure 1 The method and the operating environment deployment device are implemented in Figures 1 to 4 The functions of the illustrated embodiment will not be described in detail in the embodiments of the present application.
[0116] Of course, in addition to software implementation methods, the electronic device of the present application does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc. That is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.
[0117] The embodiment of the present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by a portable electronic device including a plurality of application programs, enable the portable electronic device to execute Figure 1 The method of the embodiment shown is specifically used to perform the following operations:
[0118] Acquire basic configuration data and component configuration data, wherein the basic configuration data includes an environment identifier of a target operating environment, and the component configuration data is used to configure components involved in the target operating environment;
[0119] After injecting the environment identifier into the component, the component is configured based on the component configuration data to obtain a target component suitable for the target operating environment;
[0120] The distributed system is started, and during the startup of the distributed system, the environment identifier is injected into the access data of the distributed system to the target component.
[0121] In short, the above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
[0122] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0123] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0124] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0125] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
Claims
1. A method for deploying an operating environment, It is characterized in that include: Acquire basic configuration data and component configuration data, wherein the basic configuration data includes an environment identifier of a target operating environment, and the component configuration data is used to configure components involved in the target operating environment; After injecting the environment identifier into the component, the component is configured based on the component configuration data to obtain a target component suitable for the target operating environment; The distributed system is started, and during the startup of the distributed system, the environment identifier is injected into the access data of the distributed system to the target component.
2. The method according to claim 1, It is characterized in that The basic configuration data also includes a version identifier of the component configuration data; The configuring the component based on the component configuration data to obtain a target component suitable for the target operating environment includes: Based on the version identifier, acquiring the historical component configuration data of the previous version of the component configuration data from a historical version library; Based on the historical component configuration data, the component is configured to obtain a candidate component; The current component parameters of the candidate component are updated based on the component configuration data to obtain the target component.
3. The method according to claim 2, It is characterized in that The updating of the current component parameters of the candidate component based on the component configuration data to obtain the target component includes: Determining target component parameters based on the component configuration data; Based on the comparison result between the target component parameters and the current component parameters of the candidate component, generating update operation information for the candidate component; Based on the update operation information, the current component parameters of the candidate component are updated to obtain the target component.
4. The method according to claim 1, It is characterized in that The component configuration data includes n versions of incremental configuration data, the incremental configuration data being used to describe configuration operation information performed on component parameters of the component, where n is an integer greater than 1; The configuring the component based on the component configuration data to obtain a target component suitable for the target operating environment includes: Based on the configuration operation information described in the n versions of the incremental configuration data and the generation time of the n versions of the incremental configuration data, the n versions of the incremental configuration data are merged to obtain the target component configuration data; The component is configured based on the target component configuration data to obtain the target component.
5. The method according to claim 4, It is characterized in that The component configuration data is obtained in the following manner: Listening for configuration operations of component parameters of the component; Whenever a configuration operation on a component parameter of the component is monitored, incremental configuration data of a version corresponding to the configuration operation is generated based on the currently monitored configuration operation.
6. The method according to claim 1, It is characterized in that The basic configuration data also includes a startup sequence of service nodes in the distributed system; The starting of the distributed system and, during the starting process of the distributed system, injecting the environment identifier into access data of the distributed system to the target component include: Based on the startup sequence, starting the service node in the distributed system; During the startup process of the service node, the environment identifier is injected into the access data of the service node for the target component.
7. The method according to claim 6, It is characterized in that The injecting the environment identifier into the access data of the service node for the target component includes: intercepting an access request from the service node to the target component; obtaining the access data from the access request; The environment identifier is injected into the access data.
8. A running environment deployment device, It is characterized in that include: An acquisition unit, configured to acquire basic configuration data and component configuration data, wherein the basic configuration data includes an environment identifier of a target operating environment, and the component configuration data is used to configure components involved in the target operating environment; A configuration unit, configured to inject the environment identifier into the component and then configure the component based on the component configuration data to obtain a target component suitable for the target operating environment; The injection unit is used to start the distributed system and, during the startup process of the distributed system, inject the environment identifier into the access data of the distributed system to the target component.
9. An electronic device, It is characterized in that include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the operating environment deployment method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, It is characterized in that When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the operating environment deployment method as described in any one of claims 1 to 7.
11. A computer program product, It is characterized in that The computer program product comprises a non-transitory computer-readable storage medium storing a computer program, wherein the computer program is operable to cause a computer to execute part or all of the steps in the method according to any one of claims 1 to 7.
