CN-116049246-B - Resource data query method and device, electronic equipment and storage medium
Abstract
The application provides a resource data query method, a device, electronic equipment and a storage medium, wherein the method comprises the steps of obtaining a plurality of binlog log data from a database of an OpenStack, and formatting each binlog data to obtain a plurality of log data to be screened; determining target log data to be monitored from a plurality of log data to be screened based on the resource identification, and determining the target log data as the resource data of the current deployment task, thereby determining the OpenStack resource state by acquiring binlog log data in real time, and optimizing delay and state deletion caused by periodically calling an API to inquire the resource state.
Inventors
- WU SHUANG
- LI XIANGCHENG
- ZHAO ZENG
- LIU BAI
Assignees
- 网易(杭州)网络有限公司
Dates
- Publication Date
- 20260508
- Application Date
- 20230117
Claims (8)
- 1. The resource data query method is characterized by being applied to a container cloud platform system based on Kubernetes and OpenStack, and comprises the following steps: acquiring a plurality of binlog log data from the OpenStack database, and formatting each binlog data to obtain a plurality of log data to be screened; Determining a resource identifier to be monitored based on the current deployment task; determining target log data to be monitored from a plurality of log data to be screened based on the resource identification, and determining the target log data as the resource data of the current deployment task; Generating a resource standard event of the OpenStack based on the resource data of the current deployment task; Pushing the resource standard event of the OpenStack to a message middleware to control an event storage query device of the container cloud platform system to acquire the resource standard event of the OpenStack from the message middleware; the method for determining the resource identification to be monitored based on the current deployment task specifically comprises the following steps: Acquiring a current deployment task; Determining a resource identifier which corresponds to the current deployment task and needs to be monitored from a preset resource identifier list; generating a resource standard event of the OpenStack based on the resource data of the current deployment task, wherein the resource standard event specifically comprises the following steps: converting the resource data of the current deployment task into a resource standard event of the OpenStack based on a preset format; The OpenStack resource standard event comprises an event type, event occurrence time, event associated resource identification and an event description field.
- 2. The method of claim 1, wherein after converting the resource data of the currently deployed task to the resource standard event of the OpenStack, the method further comprises: And calling a unified event web interface provided by an event storage query device of the container cloud platform system, and sending the resource standard event of the OpenStack to the event storage query device so that the event storage query device obtains the resource standard event of the OpenStack.
- 3. The method of claim 1, wherein after the event storage querying device obtains the OpenStack resource standard event, the method further comprises: Acquiring a resource event of the Kubernetes through APISERVER of accessing the Kubernetes; and saving the resource event of the Kubernetes in the event storage inquiry device.
- 4. A method according to claim 3, wherein after saving the Kubernetes resource event in the event store querying device, the method further comprises: And unifying the storage formats of the resource events of the Kubernetes and the resource standard events of the OpenStack in the event storage query device.
- 5. The method of claim 4, wherein after saving the Kubernetes resource event at the event store querying device, the method further comprises: setting a query interface for querying the resource event of the Kubernetes and the resource standard event of the OpenStack for the event storage query device, and setting a query condition in the query interface: wherein the query conditions include a deployment environment-based query, a resource type-based query, and a resource identification-based query.
- 6. The resource data query device is characterized by being applied to a container cloud platform system based on Kubernetes and OpenStack, and comprises the following components: the acquisition module acquires a plurality of binlog log data from the OpenStack database, and formats each binlog log data to obtain a plurality of log data to be screened; the determining module is used for determining a resource identifier to be monitored based on the current deployment task; the screening module is used for determining target log data to be monitored from a plurality of log data to be screened based on the resource identification, and determining the target log data as the resource data of the current deployment task; The generating module is used for generating the resource standard event of the OpenStack based on the resource data of the current deployment task; The query module pushes the resource standard event of the OpenStack to a message middleware so as to control an event storage query device of the container cloud platform system to acquire the resource standard event of the OpenStack from the message middleware; the determining module is specifically configured to acquire a current deployment task, determine a resource identifier which corresponds to the current deployment task and needs to be monitored from a preset resource identifier list; the generating module is specifically configured to convert the resource data of the current deployment task into the resource standard event of the OpenStack based on a preset format, wherein the resource standard event of the OpenStack comprises an event type, an event occurrence time, an event associated resource identifier and an event description field.
- 7. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable by the processor, the processor implementing the method of any one of claims 1 to 5 when the program is executed.
- 8. A non-transitory computer readable storage medium storing computer instructions for causing a computer to perform the method of any one of claims 1 to 5.
Description
Resource data query method and device, electronic equipment and storage medium Technical Field The present application relates to the field of resource query technologies, and in particular, to a resource data query method, a device, an electronic device, and a storage medium. Background This section is intended to provide a background or context to the embodiments of the application that are recited in the claims. The description herein is not admitted to be prior art by inclusion in this section. Kubernetes (k 8 s) and OpenStack are two commonly used systems for deploying applications on a cloud platform, and users can implement specific business requirements through a common cloud platform scheduling system. For example, one software deployment task includes a container-based web service and a virtual machine-based mysql database, which the cloud platform scheduling system would deploy on k8s and on OpenStack. All the resource changes on k8s have related resource events, and based on the events, we can accurately track the resource creation and running states. However, in OpenStack, resources such as virtual machine instances, floating ips, heat orchestration tasks and the like are created without corresponding event support, and the current state of the OpenStack resources needs to be queried, which is implemented by regularly calling an API interface provided by OpenStack. However, the method based on the regular query API can affect the real-time performance of OpenStack resource status checking, and if a large number of threads are used to improve the concurrency of status checking, although the real-time performance of resource status checking can be improved, the resource occupation of the system can be increased, and resource waste is caused. Disclosure of Invention In view of the above, the present application aims to provide a resource data query method, a device, an electronic apparatus and a storage medium. Based on the above purpose, the application provides a resource data query method, which is applied to a container cloud platform system based on Kubernetes and OpenStack, and comprises the following steps: acquiring a plurality of binlog log data from the OpenStack database, and formatting each binlog data to obtain a plurality of log data to be screened; Determining a resource identifier to be monitored based on the current deployment task; determining target log data to be monitored from a plurality of log data to be screened based on the resource identification, and determining the target log data as the resource data of the current deployment task; Generating a resource standard event of the OpenStack based on the resource data of the current deployment task; and pushing the resource standard event of the OpenStack to a message middleware to control an event storage query device of the container cloud platform system to acquire the resource standard event of the OpenStack from the message middleware. Based on the same inventive concept, the exemplary embodiment of the application also provides a resource data query device, which is applied to a container cloud platform system based on Kubernetes and OpenStack, wherein the device comprises: the acquisition module acquires a plurality of binlog log data from the OpenStack database, and formats each binlog log data to obtain a plurality of log data to be screened; the determining module is used for determining a resource identifier to be monitored based on the current deployment task; the screening module is used for determining target log data to be monitored from a plurality of log data to be screened based on the resource identification, and determining the target log data as the resource data of the current deployment task; The generating module is used for generating the resource standard event of the OpenStack based on the resource data of the current deployment task; And the query module pushes the resource standard event of the OpenStack to a message middleware so as to control an event storage query device of the container cloud platform system to acquire the resource standard event of the OpenStack from the message middleware. Based on the same inventive concept, the exemplary embodiments of the present application also provide an electronic device including a memory, a processor, and a computer program stored on the memory and executable by the processor, the processor implementing the resource data query method as described above when executing the program. Based on the same inventive concept, exemplary embodiments of the present application also provide a non-transitory computer-readable storage medium storing computer instructions for causing a computer to perform the resource data query method as described above. From the above, it can be seen that the resource data query method, the device, the electronic equipment and the storage medium provided by the application acquire a plurality of binlog log data from the OpenStack