Resource configuration system and method in cloud environment and storage medium
By using Redis and Etcd cluster cache resource update events in the cloud computing environment, the problem of inefficient resource allocation in traditional methods is solved, and more efficient resource management and response speed is achieved.
Patent Information
- Application Number
- CN202410940600.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-11-05
AI Technical Summary
In the cloud computing environment, traditional network configuration methods lack effective caching mechanisms, resulting in inefficient resource allocation. Especially in hyperscale server clusters and giant virtual private cloud scenarios, frequent database queries and calculations increase the system burden and Response time.
When receiving resource update events, the management service component will write cache information to the Redis cluster and Etcd cluster. The Etcd cluster generates update logs. The Redis cluster stores cache information. The work service component uses these cache information to perform resource configuration update processing to reduce the Reliance on database.
Improve the efficiency of resource allocation, reduce database load, shorten response time, and ensure system stability and performance.
Smart Images

Figure CN118900233A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of communication technology, and in particular, relates to a resource configuration system, method and storage medium in a cloud environment. Background Art
[0002] With the rapid development of cloud computing services, the scale of virtualized networks within data centers is becoming increasingly large. Especially in the face of ultra-large-scale server clusters and single giant virtual private cloud scenarios, traditional network configuration methods face severe challenges.
[0003] In the existing technical solution, whenever a port on a work service component goes online, it will be notified to Neutron-server through the message queue. The latter needs to query the database to obtain information about all ports under the VPC, calculate the MAC address and VXLAN tunnel information of the port, and finally broadcast all this information to all work service components.
[0004] However, due to the lack of an effective caching mechanism, every time a port on a working service component goes online, data needs to be obtained from the database. When processing multiple ports online in the same VPC, frequent queries to the full database and multiple calculations lead to inefficient resource allocation. Summary of the invention
[0005] The present application provides a resource configuration system, method and storage medium in a cloud environment, so as to solve the defect of low efficiency in resource configuration in a cloud environment in the prior art.
[0006] In a first aspect, the present application provides a resource configuration system in a cloud environment, the system comprising: a control node and a plurality of working service components corresponding to the control node, the control node comprising: a management service component, a Redis cluster and an Etcd cluster;
[0007] The management service component is used to write the cache information of the resource update event into the Redis cluster and the Etcd cluster when receiving a new resource update event;
[0008] The Redis cluster is used to store cache information of a new resource update event in a cache space when receiving the new resource update event;
[0009] The Etcd cluster is used to generate a corresponding update log when a new resource update event is received;
[0010] The work service component is used to obtain cache information of resource update events corresponding to the update log from the Redis cluster when there is an update log in the Etcd cluster, and perform resource configuration update processing based on the cache information.
[0011] In a second aspect, the present application provides a resource configuration method in a cloud environment, which is applied to a control node, wherein the control node includes: a management service component, a Redis cluster, and an Etcd cluster, and the method includes:
[0012] When a new resource update event is obtained, the management service component writes the cache information of the resource update event into the Redis cluster and the Etcd cluster;
[0013] The Etcd cluster generates a corresponding update log based on the written resource update event;
[0014] The Redis cluster stores the cache information of the resource update event written into the cache space, so that the work service component performs resource configuration update processing based on the cache information of the resource update event in the cache space.
[0015] Optionally, the control node further includes: Datebase, and the method further includes:
[0016] The management service component traverses the Datebase and determines whether there is a new resource update event in the Datebase;
[0017] When there is a new resource update event in the Datebase, cache information of the new resource update event is obtained from the Datebase.
[0018] Optionally, the control node further includes: a Neutron-server service component, and before determining whether there is a new resource update event in the Datebase, the method further includes:
[0019] In case of receiving a new resource update event sent by the client, the Neutron-server service component determines the running state of the Datebase, where the running state includes: a normal state and an abnormal state;
[0020] When the Datebase is in a normal state, storing the new resource update event in the Datebase;
[0021] When the Datebase is in an abnormal state, the Neutron-server service component sends the new resource update event to the management service component through a preset protocol.
[0022] Optionally, the method further includes:
[0023] In the case of receiving the exception request sent by the working service component, the management service component determines the resource update event corresponding to the exception request from the Neutron-server service component, and the exception request is used to indicate that the resource update event does not exist in the cache space of the Redis cluster;
[0024] Send feedback information to the work service component, where the feedback information includes: the resource update event.
[0025] Optionally, the method further includes:
[0026] The Redis cluster determines the usage interval duration corresponding to the cache information of the resource update event in the cache space, where the usage interval duration is the duration between the last usage time and the current time;
[0027] The Redis cluster determines whether the usage interval duration exceeds a preset interval duration;
[0028] When it is determined that the usage interval duration exceeds the preset interval duration, the Redis cluster deletes the cache information of the resource update event from the cache space.
[0029] In a third aspect, the present application provides a resource configuration method in a cloud environment, which is applied to a work service component, and the method includes:
[0030] Determine whether there is a new update log in the Etcd cluster in the control node;
[0031] In the case where there is a newly added update log in the Etcd cluster, cache information of the resource update event corresponding to the update log is obtained from the cache space of the Redis cluster in the control node;
[0032] Resource configuration update processing is performed based on the cache information.
[0033] Optionally, obtaining cache information of the resource update event corresponding to the update log from the cache space of the Redis cluster in the control node includes:
[0034] Determine whether there is cache information of the resource update event corresponding to the update log in the cache space;
[0035] If yes, obtaining cache information of the resource update event from the cache space;
[0036] If not, an exception request is sent to the management service component in the control node so that the management service component obtains the resource update event from Datebase and feeds the resource update event back to the work service component. The exception request is used to indicate that there is no resource update event corresponding to the update log in the cache space of the Redis cluster.
[0037] Optionally, the performing resource configuration update processing based on the cache information includes:
[0038] According to the cache information, determine whether there is a corresponding local record for the resource node to be updated. If there is no corresponding local record for the updated resource node, perform proxy flow table configuration update processing on the resource node to be updated, obtain the proxy flow table of the resource node to be updated, and send the proxy flow table to the corresponding OVS device. The proxy flow table is used to determine the resource node to be updated as a local node;
[0039] and / or,
[0040] According to the cache information, determine whether there is a resource node to be put online. If there is a resource node to be put online, perform tunnel broadcast flow table configuration update processing on the resource node to be put online, obtain a tunnel broadcast flow table, and send the tunnel broadcast flow table to the corresponding OVS device. The tunnel broadcast flow table is used to enable the corresponding OVS device to perform online processing on the resource node to be put online;
[0041] and / or,
[0042] In the case where the cache information indicates that the resource state of the resource node corresponding to the target VPC device has changed, the resource node and the target VPC device are determined according to the resource update event, and the resource state includes: an online state and an offline state;
[0043] A tunnel flow table corresponding to the cache information is configured for the resource node; and based on the target VPC device, a resource status of the resource node is updated.
[0044] In a fourth aspect, the present application provides a computer storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the resource configuration method in a cloud environment as described in the second aspect and various possible implementations of the second aspect or the third aspect and various possible implementations of the third aspect.
[0045] The present application provides a resource configuration system, method and storage medium in a cloud environment. The system includes: a control node and multiple working service components corresponding to the control node, and the control node includes: a management service component, a Redis cluster and an Etcd cluster. The management service component is used to write the cache information of the resource update event into the Redis cluster and the Etcd cluster when a new resource update event is received; the Etcd cluster generates a corresponding update log based on the written resource update event; the Redis cluster stores the cache information of the written resource update event in the cache space; the working service component is used to obtain the cache information of the resource update event corresponding to the update log from the cache space of the Redis cluster in the control node when there is a new update log in the Etcd cluster; and perform resource configuration update processing based on the cache information, thereby improving resource configuration efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0047] Figure 1 The system architecture of the resource configuration system in the cloud environment provided by this application Figure 1 ;
[0048] Figure 2 A schematic diagram of signaling interaction of a resource configuration method in a cloud environment provided by this application;
[0049] Figure 3 A flowchart of a resource configuration method in a cloud environment provided by this application;
[0050] Figure 4 The service process of the resource configuration system in the cloud environment provided for this application Figure 1 ;
[0051] Figure 5 The service process of the resource configuration system in the cloud environment provided for this application Figure 2 .
[0052] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0053] In order to make the purpose, technical solutions and advantages of this application clearer, the technical solutions in this application will be clearly and completely described below in conjunction with the drawings in this application. Obviously, the described embodiments are part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0054] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the numbers used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in sequences other than those illustrated or described herein.
[0055] In the embodiments of the present application, the words "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary" or "for example" is intended to present related concepts in a specific way.
[0056] First, the terms involved in this application are explained.
[0057] Redis (Remote Dict ionary Server): is an open source in-memory database that can also be used as a cache and message broker. It supports a variety of data structures, such as strings, hash list sets, ordered sets, etc., and provides rich functions and commands, allowing developers to easily implement various application scenarios.
[0058] Redis cluster: Redis cluster is a distributed deployment method of Redis database, which is used to improve the performance, availability and scalability of Redis. In a Redis cluster, data is sharded and stored on multiple Redis nodes, and each node is responsible for storing part of the data.
[0059] Etcd cluster: is an open source distributed key-value storage system. Etcd is designed to store configuration data, metadata, and status information in distributed systems to achieve functions such as service discovery, configuration management, and distributed consistency. Etcd cluster is a distributed storage system composed of multiple Etcd nodes, which is used to store key-value data and provide consistency, high availability, and reliability. In an Etcd cluster, data is distributed on multiple nodes, each of which can store part of the data, and the consistency of the data is ensured by a consistency algorithm.
[0060] OVS (Open-vSwitch): Open source virtual switch software for network traffic control and management in a virtualized environment. It provides a flexible way to create, configure and manage virtual networks, allowing high-performance network communication between virtual machines and containers. As a switch for virtual networks, OVS provides a series of functions, including virtual switches, virtual ports, flow tables, tunneling technology, etc., to achieve network traffic forwarding, filtering, load balancing and isolation.
[0061] VPC (Virtual Private Cloud): A virtual network created in a public cloud environment, used to deploy and manage resources in the cloud, such as virtual machines, storage, databases, etc. VPC provides a logically isolated network environment that allows users to build their own private networks in the cloud and control network configuration, security, and traffic flow.
[0062] Neutron-server: is a core component in Open Stack, used to provide network services and manage virtual networks. In Open Stack, Neutron is a component of network services, responsible for providing network connectivity and communication functions for virtual machine instances in the cloud environment.
[0063] MAC address (Media Access Control address): is a unique hardware address used to identify a network device (such as a computer, network adapter, router, etc.) in a local area network. The MAC address is pre-assigned by the manufacturer of the network device and is usually expressed in hexadecimal. The MAC address plays an important role in data link layer communications. It is used to uniquely identify network devices in a local area network for data packet transmission and routing. When a data packet is transmitted in a local area network, the MAC addresses of the source and destination devices are used to determine the sender and receiver of the data packet.
[0064] VXLAN (Virtual Extensible LAN): is a virtualization technology used to expand the number of virtual local area networks (VLANs) in data center networks. VXLAN aims to address the scalability limitations faced by traditional VLAN technology, making it easier to manage virtual networks in large-scale cloud computing environments. VXLAN is a technology used for virtualized networks. By creating logical tunnels and introducing VXLAN network identifiers, it achieves the expansion and isolation of virtual networks, providing a more flexible and scalable network solution for large-scale cloud computing environments.
[0065] With the rapid development of cloud computing services, the scale of virtualized networks within data centers continues to expand. Traditional network configuration methods face challenges, especially in the face of ultra-large-scale server clusters and giant virtual private cloud scenarios.
[0066] In the existing technical solution, whenever a port on a work service component goes online, it is notified to Neutron-server through a message queue. Neutron-server queries the database to obtain information about all ports under the VPC, calculates the port's MAC address and VXLAN tunnel information, and then broadcasts all this information to all work service components.
[0067] However, the existing processing methods lack an effective caching mechanism, which means that every time a port on a working service component goes online, data needs to be obtained from the database, which is particularly obvious when multiple ports go online in the same VPC. Frequent queries to the full database and multiple calculations lead to inefficient resource allocation, increasing system burden and response time.
[0068] In response to the above problems, the present application proposes a resource configuration method in a cloud environment, which, through a management service component, writes the cache information of the resource update event into the Redis cluster and the Etcd cluster when a new resource update event is received; the Etcd cluster generates a corresponding update log based on the written resource update event; the Redis cluster stores the cache information of the written resource update event in the cache space; a working service component is used to obtain the cache information of the resource update event corresponding to the update log from the cache space of the Redis cluster in the control node when there is a new update log in the Etcd cluster; and performs resource configuration update processing based on the cache information, thereby improving resource configuration efficiency.
[0069] Figure 1 This is a system architecture diagram of the resource configuration system in the cloud environment provided by this embodiment. The embodiment aims to explain the functions and roles of the Neutron-server service component, Datebase, management service component, Redis cluster, Etcd cluster, and multiple work service components corresponding to the control node in the resource configuration in the cloud environment. Figure 1 As shown, the resource configuration system in the cloud environment provided by this embodiment includes:
[0070] Management service component: used to write the cache information of the resource update event into the Redis cluster and Etcd cluster when a new resource update event is received. In this way, the management service component ensures real-time synchronization and persistent storage of resources. Redis clusters are usually used for caching and fast data access, while Etcd clusters are used for distributed key-value storage and configuration management. Writing resource update events to these two clusters at the same time not only provides high-speed data access and caching functions, but also ensures data reliability and consistency. This architectural design enables the system to respond quickly to changes while ensuring data security and reliability, providing a solid foundation for the stability and performance of the entire system.
[0071] Redis cluster: used to store the cache information of the resource update event in the cache space when a new resource update event is received. By utilizing the storage and fast access characteristics of Redis's high-performance memory, the system can achieve fast storage and retrieval of resource update events. By storing resource update events in the Redis cluster, the system can quickly access the latest data, improving data access speed and real-time performance.
[0072] Etcd cluster: used to generate corresponding update logs when receiving new resource update events. Through Etcd's distributed key-value storage and strong consistency features, the system can ensure the integrity and reliability of the update log. The update log contains key change information, such as resource status, configuration, and metadata, and provides important historical records and audit functions for the system. Through the update log generated by the Etcd cluster, the system can track and manage resource update events to ensure data consistency and reliability.
[0073] Work service component: when there is an update log in the Etcd cluster, it is used to obtain the cache information of the resource update event corresponding to the update log from the Redis cluster, and perform resource configuration update processing based on the cache information. In this way, the work service component can obtain the latest resource update information in real time to ensure that the system's resource configuration is synchronized with the actual situation. Obtaining the cache information of the resource update event corresponding to the update log from the Redis cluster enables the work service component to quickly obtain the required data and improve the response speed and efficiency of the system. This architectural design enables the work service component to respond to system changes in a timely manner and maintain the accuracy and consistency of resource configuration.
[0074] Figure 2 A signaling interaction diagram of a resource configuration method in a cloud environment provided in an application embodiment. This embodiment is applied to Figure 1The resource configuration system in the cloud environment shown in the figure, wherein the control node includes: a management service component, a Redis cluster and an Etcd cluster. Figure 2 The purpose is to explain the steps between management service components, Redis clusters and Etcd clusters, and worker service components when configuring resources in a cloud environment. Figure 2 As shown, the resource configuration method in the cloud environment provided by this embodiment includes:
[0075] S201. The management service component obtains a new resource update event.
[0076] S202: When the management service component obtains a new resource update event, it reads the key from Datebase.
[0077] After the data in the table is collected, cache information is generated and written to the Redis cluster.
[0078] S203: When the management service component obtains a new resource update event, it reads the key from Datebase.
[0079] After the data in the table is collected, cache information is generated and written to the Etcd cluster.
[0080] When the management service component obtains a new resource update event, it reads the data in the key table from Datebase, generates cache information, and writes it to the Redis cluster and Etcd cluster. Writing the cache information of the resource update event to both the Redis cluster and the Etcd cluster can achieve data backup and persistence to ensure that data will not be lost. Writing the resource update event to two different storage systems at the same time can ensure data consistency between different storages and avoid data inconsistency.
[0081] As cache storage, the Redis cluster can provide fast data access and response, speed up the system's reading speed, and the update log generated by the Etcd cluster can be used for system logging and tracking to help monitor system changes and historical data. By writing resource update events to the Redis cluster and the Etcd cluster, the management service component can ensure data security, reliability, and efficiency, providing important support for the stable operation of the system and data management.
[0082] S204. The Redis cluster stores the cache information of the written resource update event in the cache space.
[0083] Among them, the Redis cluster stores the cache information of the written resource update event in the cache space, so that the work service component obtains the cache information of the stored resource update event from the cache space of the Redis cluster, and performs resource configuration update processing according to the cache information.
[0084] The work service component directly obtains the cache information of resource update events from the cache space of the Redis cluster, avoiding access to the full database and improving the system's response speed; by storing the cache information of resource update events in the cache space, the load on the full database can be reduced and the performance and throughput of the database can be improved; resource update events are stored in the cache space of the Redis cluster, and the work service component can access them directly on the local or nearby network node, reducing the delay of network transmission.
[0085] The cache information of resource update events is stored in the cache space through the Redis cluster, so that the working service component can perform resource configuration update processing based on the cache information in the cache space, which can achieve fast response, reduce database load, and thus improve system performance.
[0086] S205. The Etcd cluster generates a corresponding update log based on the written resource update event.
[0087] The management service component writes new resource update events to the Etcd cluster, and the Etcd cluster generates corresponding update logs according to the written resource update events.
[0088] The update log records the data changes that occur in the system, including detailed information on resource update events, which helps track and audit system changes. The update log is used for system monitoring and analysis to help understand the operating status and data changes. The update log can be used as a version control tool for the system, recording data changes at different time points in the system, facilitating version management and traceability. By generating update logs through the Etcd cluster, the system can better manage and maintain data and ensure data integrity and reliability.
[0089] S206. The working service component monitors the Etcd cluster to determine whether there is a new update log in the Etcd cluster.
[0090] Among them, the work service component establishes a connection with the Etcd cluster and subscribes to the update log events of the Etcd cluster. For example, the Watch API of the Etcd cluster is used to subscribe to the change events of key key-value pairs. When there is a new update log, the Etcd cluster will trigger the Watch event, and the work service component will receive a notification of the new update log.
[0091] S207: When there is a newly added update log in the Etcd cluster, cache information corresponding to the update log is obtained from the cache space of the Redis cluster.
[0092] Among them, the work service component subscribes to the update log event of the Etcd cluster to determine whether there is a new update log in the Etcd cluster. The Etcd cluster receives the subscription request of the work service component and checks whether there is a new update log in the Etcd cluster. The Etcd cluster feeds back to the work service component whether there is a new update log based on the inspection result.
[0093] When there is a new update log in the etcd cluster, a notification is sent to the work service component to notify the work service component of a new resource update event. After receiving the notification, the work service component queries the cache space of the Redis cluster and obtains the cache information of the resource update event corresponding to the update log from the cache space of the Redis cluster.
[0094] S208. The work service component performs resource configuration update processing based on the cache information.
[0095] Among them, the work service component parses the cache information of the resource update event obtained from the Redis cluster, extracts the instructions and key information therein; the work service component executes the corresponding resource configuration update operation according to the parsed resource update event, and applies the updated resource configuration to the system to ensure that the system runs according to the latest configuration.
[0096] This embodiment proposes a resource configuration method in a cloud environment, in which the management service component is responsible for writing resource update events, the Etcd cluster generates update logs, the Redis cluster provides fast access, and the work service component performs resource configuration update processing based on the cache information of the updated resource event. Through the collaboration between the management service component, the Etcd cluster, the Redis cluster and the work service component, the subscription, storage and processing of resource update events are realized, ensuring the real-time, reliability and performance of the system. The efficient operation and resource management of the system are realized.
[0097] Figure 3 Schematic diagram of a resource configuration method in a cloud environment provided by an embodiment of the present application. Figure 3 As shown, the resource configuration method in the cloud environment provided by this embodiment includes:
[0098] S301. When receiving a new resource update event sent by a client, the Neutron-server service component determines the running status of Datebase, where the running status includes: normal status and abnormal status.
[0099] Among them, the Neutron-server service component receives new resource update events sent by the client and checks the status of Datebase; the operating status includes: normal status and abnormal status. The normal operating status indicates that Datebase can provide services under normal circumstances; the abnormal status indicates that Datebase has abnormal conditions, such as connection problems, data corruption, etc., which make the database unable to provide services.
[0100] The Neutron-server service component receives resource update events from the client and determines the running status of Datebase, so as to realize real-time monitoring and feedback of Datebase status and timely identify abnormal status of Datebase. It can discover potential problems in advance and take measures to avoid system failure or data loss.
[0101] After receiving the new resource update event sent by the client, the Neutron-server service component determines the running status of Datebase, which helps to ensure the stability and reliability of the system, guarantee the continuity of services, improve customers' understanding of the system operation status, and enhance user experience.
[0102] S302: When Datebase is in a normal state, store a new resource update event in Datebase.
[0103] Among them, confirm that Datebase is in a normal state, parse the new resource update event, extract the key information and data, and store the parsed resource update event in Datebase to ensure the persistence and reliability of the data.
[0104] By updating the records in Datebase, the data in Datebase is kept consistent with the latest resource update events to ensure data accuracy. Storing resource update events in Datebase provides a basis for data backup and recovery and ensures the security of system data.
[0105] S303: When Datebase is in an abnormal state, the Neutron-server service component sends a new resource update event to the management service component through a preset protocol.
[0106] The exception request is used to indicate that the new resource update event does not exist in the cache space of the Redis cluster. In the Datebase abnormal state, the Neutron-server service component sends a new resource update event corresponding to the abnormal situation to the management service component through a preset protocol.
[0107] When receiving an exception request sent by the working service component, the management service component determines the resource update event corresponding to the exception request from the Neutron-server service component, and the exception request is used to indicate that there is no resource update event in the cache space of the Redis cluster. The management service component sends feedback information to the working service component, and the feedback information includes: resource update event.
[0108] By sending new resource update events to the management service component through the preset protocol when the Datebase is in an abnormal state, the Neutron-server service component can achieve beneficial effects such as real-time exception handling, data consistency, and system stability, providing effective support for system operation and data management.
[0109] S304: The management service component traverses Datebase and determines whether there is a new resource update event in Datebase.
[0110] The management service component traverses the data in Datebase, checks the records or tables one by one, compares each record or table, compares the timestamp or version number and other information therein, and determines whether there is a new resource update event in Datebase.
[0111] S305: When there is a new resource update event in Datebase, the management service component obtains the new resource update event from Datebase and writes the cache information of the resource update event into the Redis cluster and the Etcd cluster.
[0112] Among them, when the management service component detects Datebase and confirms that there is a new resource update event that needs to be processed, the management service component obtains the cache information of the new resource update event from Datebase, and the cache information includes, for example: data content, timestamp, etc.; the cache information of the obtained resource update event is written to the Redis cluster for fast access and query to improve efficiency.
[0113] This embodiment proposes a resource configuration method in a cloud environment, which receives new resource update events sent by the client through a service component, determines the running status of Datebase, and stores the new resource update events in Datebase when Datebase is in a normal state. When Datebase is in an abnormal state, the Neutron-server service component sends the new resource update event to the management service component through a preset protocol. Through the above process and mechanism, the system can better handle resource update events, monitor the status of Datebase, and take appropriate measures in abnormal situations, thereby improving the reliability, stability and data integrity of the system.
[0114] In a possible implementation, the Etcd cluster may also determine the usage interval duration corresponding to the cache information of the resource update event in the cache space, and determine whether the usage interval duration exceeds a preset interval duration.
[0115] The usage interval duration is the duration between the last usage time and the current time. In the cache space, the last usage time is recorded for each resource update event, the current time is obtained, and the usage interval duration of the cache information of the resource update event is calculated based on the time difference between the last usage time and the current time, and it is determined whether the usage interval duration exceeds the preset interval duration. If it is determined that the usage interval duration exceeds the preset interval duration, the Redis cluster deletes the cache information of the resource update event from the cache space.
[0116] It is understandable that when the usage interval of a resource update event exceeds the preset interval, the work service component sends a command to the Redis cluster to delete the cache information of the resource update event. After receiving the deletion command, the Redis cluster performs the corresponding deletion operation to delete the cache information of the resource update event from the cache space. Timely deletion of cache information of infrequently used resource update events can free up cache space and improve storage efficiency.
[0117] In a possible implementation, the cache information of resource update events written into the cache space of the Etcd cluster may be deleted due to a long usage interval. Therefore, when the work service component determines that there is a newly added update log in the Etcd cluster, the work service component also needs to determine whether there is cache information of the resource update event corresponding to the update log in the cache space.
[0118] In the case that a resource update event corresponding to the update log exists in the cache space, the work service component obtains cache information of the corresponding resource update event from the cache space. For the specific process, see step S306 in the above embodiment.
[0119] If there is no resource update event corresponding to the update log in the cache space, it indicates that the usage interval of the resource update event exceeds the preset interval. The working service component cannot obtain the resource update event corresponding to the update log from the cache space of the Redis cluster. It is necessary to send an exception request to the management service component so that the management service component obtains the resource update event from the Neutron-server service component and feeds back the resource update event to the working service component.
[0120] In one possible implementation, the Datebase database trigger notification mechanism of the Neutron-server service component and the management service component includes:
[0121] The management service component periodically queries the Datebase resource version change record, or directly receives HTTP requests from the Neutron-server service component to receive resource status or version changes; reads data from key tables in Datebase, generates a cache, and stores it in the redis cluster.
[0122] Key data tables and attributes in Open Stack Neutron's Datebase related to cache are as follows:
[0123] (1) ports table, key cache data are: port MAC address, port IP address, port network_id, port host table, port current version number;
[0124] (2) networks table, key data: VXLAN VNI;
[0125] (3) agents table, key data is: the VXLAN VTEP IP of the server.
[0126] Construct a cache based on the table data and set the cache expiration time. For example, if the cache expiration time is set to 600 seconds, the system is required to complete reading the data in the relevant key table within at least 600 seconds, otherwise the cache will become invalid, causing the management service component to access Datebase again and read the data in the key table.
[0127] In one possible implementation, cache triggers are set to trigger cache updates or refreshes under certain conditions. Setting cache triggers can help the system automatically update the cache when data changes, thereby ensuring the timeliness and consistency of cached data.
[0128] Open Stack Neutron has a data standard attribute table standardattributes, the structure of which is shown in Table 1:
[0129] Table 1
[0130] Fields type Can be empty? Primary / Foreign Keys default value Extensions Id bigint(20) NO Primary Key NULL auto_increment resource_type varchar(255) NO NULL created_at Datetime YES NULL updated_at Datetime YES NULL description varchar(255) YES NULL revision_number bigint(20) NO 0
[0131] The fields are: id, integer type, auto-increment, each Open Stack core resource has a unique corresponding standardattribute id; resource_type, character type indicates the type of resource, currently there are networks, ports, subnet, etc.; created_at and updated_at indicate the resource creation time and update time; description, string type, indicates the user-defined description of the resource; revision_number, resource version number, integer type, incremented each time the resource has an attribute update.
[0132] The data stored in this table indicates the creation time, update time, custom description and resource version number of a resource corresponding to a resource_type of a certain type associated with the id column. The change of the revision_number resource version number usually indicates that the attribute of the resource has changed.
[0133] Create a trigger for data update in this table. This trigger will be triggered after each creation / update / deletion of the standard attributes table. If the update operation causes the revision_number column of the standard attributes table to change, that is, the new value is not equal to the old value, a new record will be inserted into the resource_updates table, containing the values of standard attributes.id and resource_type. The structure of the resource_updates table is shown in Table 2:
[0134] Table 2
[0135]
[0136]
[0137] The trigger mainly writes three key fields: standardattributes_id, resource_type and created_at, and uses the default values for process_state and ttl.
[0138] process_state has three states:
[0139] 0: New, indicating an unprocessed state;
[0140] 1: Processing, indicating that a management service component may be processing the resource;
[0141] 2: Processing completed, indicating that a management service component has completed processing the resource;
[0142] The management service component will monitor resource_updates once per second. The existence of records in resource_updates indicates that the resource has a version change. After the resource version changes, query its corresponding data:
[0143] If data exists in the cache, compare the cached data and update it if there is any inconsistency;
[0144] If the data does not exist in the cache, query the data from the database and cache it;
[0145] If there is data in the cache and the database cannot query the relevant data, it means that the data has been deleted and the cache is cleared.
[0146] In one possible implementation, the Etcd cluster itself has the ability to trigger events when data changes. This feature will be used to implement event-driven between the management service component and the work service component of this system.
[0147] There are two types of data changes. When at least one of the data changes occurs, the event driver is triggered:
[0148] (1) The management service component adds, updates, or deletes ports in a specific group. The management service component updates group_ports.
[0149] When a port under a VPC goes online on a node for the first time, a host_networks event is sent;
[0150] When the last port under a VPC goes offline on a node, a host_networks event is sent.
[0151] (2) When a new agent comes online, the management service component will update group_hosts.
[0152] After each management service component monitors the following events, it analyzes and assembles the tunnel broadcast flow, tunnel directional flow table or unicast tunnel flow table, and ARP proxy flow table based on partial information of the event and data pulled from the cache, and finally sends them to OVS.
[0153] (1) group_ports update event:
[0154] Analyze and compare whether the port is recorded locally. If not, pull the cached data port_details and network_ports of the same VPC from the redis cluster, and build an ARP proxy flow table based on the cached data port_details and network_ports of the same VPC.
[0155] If the port has a local record but the version number has changed, the MAC address of the port is compared to see if it has changed. If not, the process is skipped. If there is a change, the flow table is updated.
[0156] If the port is updated locally, but the port in the event record no longer exists, clear the relevant flow table.
[0157] (2) group_hosts update event:
[0158] This event is monitored by all hosts;
[0159] If a node is online, update the tunnel broadcast stream and add a new tunnel output action;
[0160] If a node goes offline, update the tunnel broadcast stream and delete the old tunnel output action.
[0161] (3) host_networks update event:
[0162] This event is monitored by all hosts;
[0163] I) After a port under a VPC goes online on a node for the first time:
[0164] For the node that goes online at a.port, the data obtained from the cache include network_details, network_ports, and host_networks data. This can be used to assemble multiple tunnel directional flow tables or unicast tunnel flow tables for this node and all other nodes under this VPC. That is, the node that goes online at the port online node is A, and other nodes are distributed at ports 1, 2, 3, 4, ..., n, etc., which will generate a flow table with a quantitative relationship of 1:n.
[0165] b. After receiving the relevant message, other VPCs obtain the network_details, network_ports, and host_networks data from the cache, obtain the VNI of the VPC and the MAC address of the online port, and assemble a tunnel directional flow table or unicast tunnel flow table from its node to the port of the newly online node. That is, for all the distributed nodes of the VPC, a flow table will be added to each node.
[0166] II) After a node goes offline, the last port under a VPC sends host_networks;
[0167] a. The node whose port is offline obtains network_details data from the cache. Based on the VNI of the VPC, multiple tunnel directional flow tables or unicast tunnel flow tables from the node to all other nodes are cleared. That is, if the node that goes online is A, and other nodes have ports such as B, C, D, and E, then 1:n flow tables will be cleared;
[0168] b. After receiving the relevant message, other VPCs obtain the data network_details and network_ports from the cache, obtain the VNI of the VPC and the MAC address of the offline port, and delete a tunnel directional flow table based on the VNI and MAC address.
[0169] In one possible implementation, Figure 4 This is a service flow of a resource configuration system in a cloud environment provided by the embodiment of the present application. Figure 1 ,like Figure 4 As shown, the service process of the resource configuration system in the cloud environment provided by this embodiment is applied to the management service component, and the detailed service process includes:
[0170] 1) Initialization at startup;
[0171] During the startup phase of the management service component, the neutron database link configuration is obtained, the configuration availability is checked, and the following data of the Open Stack Neutron Datebase is read: ports, networks, subnets, agents, ml2_port_binding_levels, and ml2_port_bindings.
[0172] II) Main thread;
[0173] Monitors resource status changes on the Neutron side and is responsible for cache processing;
[0174] Associate the report of the work service component with the hostname to generate a cache;
[0175] Group the host reports of the working service components and generate a cache;
[0176] Monitor changes in the number of resource_updates;
[0177] Read the record in resource_updates and set the state process_state of the record to 1;
[0178] According to the resource_type of the record, find the corresponding resource database table;
[0179] Find the corresponding resource in Datebase based on the standardattributes_id of the record;
[0180] Use the records in Datebase to build a cache;
[0181] Start the http server and receive the port UP message from neutron: to deal with the special situation where the Datebase monitoring event cannot respond. Neutron-Server implements the resource update event notification by requesting the rest-fullAPI provided by the HTTP server;
[0182] Complete the "notification initiation" work of the event mechanism and register resource change events in the etcd cluster.
[0183] III) Concurrency and high availability;
[0184] When running multiple management service components and multiple OpenStack Neutron-Server processes exist in the environment, the following scenarios exist:
[0185] a. The same resource is processed multiple times, generating multiple resource update events;
[0186] b. Multiple operations such as updating and deleting the same resource are processed on different management service components.
[0187] In view of the above scenarios, the distributed lock and resource processing queue are introduced in the management service component. To deal with the above scenarios, a distributed lock is created for the resource, and then the event is sent to the queue. The event is popped from the queue, and the lock is released after processing. Regardless of which management service component obtains the event, the one that is locked first will be processed first. If the lock is not obtained, the processing is skipped.
[0188] In one possible implementation, Figure 5 This is a service flow of a resource configuration system in a cloud environment provided by the embodiment of the present application. Figure 2 ,like Figure 5 As shown, the service process of the resource configuration system in the cloud environment provided by this embodiment is applied to the work service component, and the detailed service process includes:
[0189] 1) Main thread;
[0190] Register the node, register its own event_group, and register the service as follows: event_group / hostname. The registered information includes: hostname host name, VXLAN VTEP IP tunnel endpoint IP;
[0191] Event loop, monitoring etcd resource change events;
[0192] Pull relevant data from the cache based on the event content;
[0193] Send the relevant flow table on br-tun of this node.
[0194] II)RPC thread;
[0195] After the new agent goes online, the work service component sends incremental data to the associated agent group, notifying the agent to send relevant configurations, such as flow tables, tunnels, etc. Here, the work service component needs to have a list-type configuration item to configure the addresses of all available work service components.
[0196] III) Status reporting thread;
[0197] Report to the management service component regularly, that is, randomly select one of the multiple alive management service components as the status of the current node as the reporting object.
[0198] In one possible implementation, the resource configuration system in the cloud environment is linked with Open Stack Neutron, including:
[0199] The main loop of Open Stack Neutron's Open-vSwitch Agent listens for port additions or updates on the bridge;
[0200] The OVS-agent main loop processes the basic flow table of the Port;
[0201] OVS-agent calls the RPC interface (update_device_list) to notify Neutron-server. Neutron-Server updates the port status to Active. At this point, the work on the Neutron side is completed.
[0202] The management service component monitors the status updates of the Port and builds a cache;
[0203] The management service component registers events in the etcd cluster;
[0204] The work service component listens to the event, pulls the cache, and completes the delivery of the relevant flow table. If the cache pull fails, it will try to obtain data from the management service component through RPC to complete the delivery of the relevant flow table.
[0205] According to the cache information, determine whether there is a corresponding local record for the resource node to be updated. If there is no corresponding local record for the updated resource node, perform proxy flow table configuration update processing on the resource node to be updated, obtain the proxy flow table of the resource node to be updated, and send the proxy flow table to the corresponding OVS device. The proxy flow table is used to determine the resource node to be updated as a local node;
[0206] and / or,
[0207] According to the cache information, determine whether there is a resource node to be put online. If there is a resource node to be put online, perform tunnel broadcast flow table configuration update processing on the resource node to be put online, obtain a tunnel broadcast flow table, and send the tunnel broadcast flow table to the corresponding OVS device. The tunnel broadcast flow table is used to enable the corresponding OVS device to perform online processing on the resource node to be put online;
[0208] and / or,
[0209] In the case where the cache information indicates that the resource state of the resource node corresponding to the target VPC device has changed, the resource node and the target VPC device are determined according to the resource update event, and the resource state includes: an online state and an offline state;
[0210] A tunnel flow table corresponding to the cache information is configured for the resource node; and based on the target VPC device, a resource status of the resource node is updated.
[0211] In a possible implementation, in order to avoid conflicts between the OVS flow tables added by the system and the OVS flow tables added by Neutron, and to ensure that the flow tables added by Neutron can take effect quickly after the flow tables added by the system are rolled back or become ineffective, the flow table structure of Neutron is adjusted: the flow tables of table=0, table=1, table=2, table=3, table=6, table=9, and table=10 remain unchanged. The default actions of table=20, table=21, and table=22 are adjusted to continue sending data packets to the related tables=24, table=25, table=26, and table=27 created by this system.
[0212] For table=20, Open Stack Neutron no longer adds a tunnel directional flow table or a unicast tunnel flow table; for table=21, Open Stack Neutron no longer adds an ARP request proxy flow table; for table=22, Open Stack Neutron no longer adds a tunnel broadcast flow.
[0213] The table=24 of this system is the generated tunnel directional flow table or unicast tunnel flow table; table=25 is the ARP proxy flow table generated by this system; table=26 is the VNI setting flow table generated by this system; table=27 is the tunnel broadcast flow generated by this system.
[0214] Table=24, table=25 flow table generation / update / deletion: mainly triggered by the creation, update, and deletion events of ports in VPC;
[0215] The creation of flow table Table=26 is triggered by the first port in VPC that goes online on this node. The deletion of flow table is triggered by the last port in VPC going offline.
[0216] The flow table of Table=27 is triggered by the online launch of the working service component of this node, as well as other new working service component online events sent by the management service component.
[0217] After adjusting the flow table structure above, the impact on the Open Stack Neutron flow table and functions can be minimized, and a dual flow table mechanism can be implemented. That is, the flow table issued by this system and the flow table issued by Open Stack Neutron can exist flexibly without interfering with each other.
[0218] The present application also provides a computer storage medium, in which computer execution instructions are stored. When a processor executes the computer execution instructions, a resource configuration method in a cloud environment as executed by the resource configuration device in the above-mentioned cloud environment is implemented.
[0219] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In hardware implementations, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those of ordinary skill in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0220] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0221] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A resource configuration system in a cloud environment, characterized in that: The system includes: a control node and a plurality of working service components corresponding to the control node, wherein the control node includes: a management service component, a Redis cluster and an Etcd cluster; The management service component is used to write the cache information of the resource update event into the Redis cluster and the Etcd cluster when receiving a new resource update event; The Redis cluster is used to store cache information of a new resource update event in a cache space when receiving the new resource update event; The Etcd cluster is used to generate a corresponding update log when a new resource update event is received; The work service component is used to obtain cache information of resource update events corresponding to the update log from the Redis cluster when there is an update log in the Etcd cluster, and perform resource configuration update processing based on the cache information.
2. A resource configuration method in a cloud environment, characterized in that: Applied to a control node, the control node includes: a management service component, a Redis cluster and an Etcd cluster, the method includes: When a new resource update event is obtained, the management service component writes the cache information of the resource update event into the Redis cluster and the Etcd cluster; The Etcd cluster generates a corresponding update log based on the written resource update event; The Redis cluster stores the cache information of the resource update event written into the cache space, so that the work service component performs resource configuration update processing based on the cache information of the resource update event in the cache space.
3. The method according to claim 2, characterized in that The control node further includes: Datebase, and the method further includes: The management service component traverses the Datebase and determines whether there is a new resource update event in the Datebase; When there is a new resource update event in the Datebase, cache information of the new resource update event is obtained from the Datebase.
4. The method according to claim 3, characterized in that The control node further includes: a Neutron-server service component. Before determining whether there is a new resource update event in the Datebase, the method further includes: In case of receiving a new resource update event sent by the client, the Neutron-server service component determines the running state of the Datebase, where the running state includes: a normal state and an abnormal state; When the Datebase is in a normal state, storing the new resource update event in the Datebase; When the Datebase is in an abnormal state, the Neutron-server service component sends the new resource update event to the management service component through a preset protocol.
5. The method according to claim 4, characterized in that The method further comprises: In the case of receiving an exception request sent by the work service component, the management service component determines a resource update event corresponding to the exception request from the Neutron-server service component, where the exception request is used to indicate that the resource update event does not exist in the cache space of the Redis cluster; Send feedback information to the work service component, where the feedback information includes: the resource update event.
6. The method according to claim 2, characterized in that The method further comprises: The Redis cluster determines the usage interval duration corresponding to the cache information of the resource update event in the cache space, where the usage interval duration is the duration between the last usage time and the current time; The Redis cluster determines whether the usage interval duration exceeds a preset interval duration; When it is determined that the usage interval duration exceeds the preset interval duration, the Redis cluster deletes the cache information of the resource update event from the cache space.
7. A resource configuration method in a cloud environment, characterized in that: Applied to a work service component, the method comprises: Determine whether there is a new update log in the Etcd cluster in the control node; In the case where there is a newly added update log in the Etcd cluster, cache information of the resource update event corresponding to the update log is obtained from the cache space of the Redis cluster in the control node; Resource configuration update processing is performed based on the cache information.
8. The method according to claim 7, characterized in that The acquiring cache information of the resource update event corresponding to the update log from the cache space of the Redis cluster in the control node includes: Determine whether there is cache information of the resource update event corresponding to the update log in the cache space; If yes, obtaining cache information of the resource update event from the cache space; If not, an exception request is sent to the management service component in the control node so that the management service component obtains the resource update event from Datebase and feeds the resource update event back to the work service component. The exception request is used to indicate that there is no resource update event corresponding to the update log in the cache space of the Redis cluster.
9. The method according to claim 7, characterized in that: The resource configuration update process based on the cache information includes: According to the cache information, determine whether there is a corresponding local record for the resource node to be updated. If there is no corresponding local record for the updated resource node, perform proxy flow table configuration update processing on the resource node to be updated, obtain the proxy flow table of the resource node to be updated, and send the proxy flow table to the corresponding OVS device. The proxy flow table is used to determine the resource node to be updated as a local node; and / or, According to the cache information, determine whether there is a resource node to be put online. If there is a resource node to be put online, perform tunnel broadcast flow table configuration update processing on the resource node to be put online, obtain a tunnel broadcast flow table, and send the tunnel broadcast flow table to the corresponding OVS device. The tunnel broadcast flow table is used to enable the corresponding OVS device to perform online processing on the resource node to be put online; and / or, In the case where the cache information indicates that the resource state of the resource node corresponding to the target VPC device has changed, the resource node and the target VPC device are determined according to the resource update event, and the resource state includes: an online state and an offline state; A tunnel flow table corresponding to the cache information is configured for the resource node; and based on the target VPC device, a resource status of the resource node is updated.
10. A computer storage medium, characterized in that: The computer storage medium stores computer execution instructions, which, when executed by a processor, are used to implement the resource configuration method in a cloud environment as described in any one of claims 2 to 9.
