Domain name resolution method and device, medium and equipment

By listening to preset ports to obtain domain name resolution requests, judging resource version changes, and using cache sequences to find IP addresses, the problem of low domain name resolution efficiency in cloud-native environments is solved, achieving fast response and reduced network overhead.

CN118646733BActive Publication Date: 2025-12-19SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410712510.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2025-12-19
Estimated Expiration
2044-06-04

AI Technical Summary

Technical Problem

In existing technologies, DNS servers have low query efficiency when faced with a large number of domain name resolution requests, especially in cloud-native environments, where domain name resolution efficiency is low and they cannot respond to client requests efficiently.

Method used

By listening to a preset port to obtain domain name resolution requests, extracting the domain name to be resolved, obtaining the resource version of the stateful load application, and determining whether the resource version has changed, if it has not changed, the IP address is searched from the cache sequence; if it has changed, the cache is updated or the IP address is obtained from the upstream server, thus achieving a fast response.

Benefits of technology

In a cloud-native environment, caching IP addresses reduces the number of queries to upstream servers, improves domain name resolution efficiency, and reduces network overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118646733B_ABST
    Figure CN118646733B_ABST
Patent Text Reader

Abstract

The application provides a domain name resolution method and device, medium and equipment. The method comprises the following steps: obtaining a domain name resolution request sent by a client; extracting a domain name to be resolved from the domain name resolution request; obtaining a resource version corresponding to a stateful load application; judging whether the resource version obtained this time has changed relative to the resource version obtained last time; if the resource version has not changed, searching for an IP address corresponding to the domain name to be resolved from a cache sequence of a domain name cache proxy component; wherein when the stateful load application and a corresponding server are deployed, a preset number of containers are created, a corresponding name is allocated to each container, a corresponding domain name is configured for each container according to the name of each container and the name of the server, a corresponding IP address is allocated to each container, and the domain name and the IP address of each container are stored in the cache sequence; and the searched IP address is returned to the client. The application can improve the query efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of resource access, and in particular to a domain name resolution method and device, medium and equipment. BACKGROUND

[0002] When a client sends a domain name resolution request to a node, the node needs to initiate a query request to an upstream DNS server, and the DNS server returns an IP address corresponding to the domain name through recursive or iterative query, thereby providing an entry for the user to access the required resource, so that the user can access the resource. Wherein, DNS is Domain Name Server. However, the above query method is relatively low in efficiency, especially when facing a large number of domain name resolution requests, the efficiency will be lower. SUMMARY

[0003] In view of at least one of the above technical problems, the present application provides a domain name resolution method and device, medium and equipment.

[0004] According to a first aspect, the present application provides a domain name resolution method, which includes:

[0005] The preset port is listened to to obtain a domain name resolution request sent by a client; wherein, the preset port is used to receive the domain name resolution request;

[0006] A domain name to be resolved is extracted from the domain name resolution request;

[0007] A resource version corresponding to a stateful load application is obtained; wherein, the resource version is used to represent whether the stateful load application has container expansion or contraction;

[0008] It is judged whether the resource version obtained this time has changed relative to the resource version obtained last time;

[0009] If the resource version has not changed, an IP address corresponding to the domain name to be resolved is searched from a cache sequence of a domain name cache proxy component; wherein, when the stateful load application and the corresponding server are deployed, a preset number of containers are created, each container is assigned a corresponding name, each container is configured with a corresponding domain name according to the name of each container and the name of the server, each container is assigned a corresponding IP address, and the domain name and IP address of each container are stored in the cache sequence;

[0010] The searched IP address is returned to the client.

[0011] In one embodiment, the method provided by the present application further includes:

[0012] If the resource version has not changed and the IP address corresponding to the domain name to be resolved is not found in the cache sequence of the domain name cache proxy component, the IP address corresponding to the domain name to be resolved is found from the domain name server upstream, and the found IP address and the domain name to be resolved are stored in the cache sequence.

[0013] In one embodiment, the finding of the IP address corresponding to the domain name to be resolved from the domain name server upstream comprises:

[0014] The IP address finding request is sent to the domain name server upstream, so that the domain name server receiving the IP address finding request obtains the IP address corresponding to the domain name to be resolved from the server corresponding to the stateful load application.

[0015] In one embodiment, the method provided by the embodiment of the application further comprises:

[0016] If the resource version has changed, it is determined whether the container corresponding to the domain name to be resolved exists;

[0017] If the container corresponding to the domain name to be resolved exists, the IP address corresponding to the domain name to be resolved is found from the cache sequence of the domain name cache proxy component;

[0018] If the IP address corresponding to the domain name to be resolved is not found, it is determined that the stateful load application has container expansion, the IP address corresponding to the domain name to be resolved is found from the domain name server upstream, and the found IP address and the domain name to be resolved are stored in the cache sequence.

[0019] The found IP address is returned to the client.

[0020] In one embodiment, the method provided by the embodiment of the application further comprises:

[0021] If the resource version has changed, it is determined whether the container corresponding to the domain name to be resolved is deleted, if the container is deleted, it is determined that the stateful load application has container contraction, the IP address is returned as empty, and the domain name to be resolved and the corresponding IP address in the cache sequence of the domain name cache proxy component are deleted.

[0022] In one embodiment, the method provided by the embodiment of the application further comprises:

[0023] If the stateful load application has container contraction and then expansion, the name of the deleted container and the domain name are assigned to the restarted container, and the IP address newly allocated to the restarted container and the assigned domain name are stored in the cache sequence of the domain name cache proxy component.

[0024] In one embodiment, the assigning a corresponding name to each container comprises: assigning a corresponding name to each container by a replica controller of the stateful load application according to a preset naming rule; and / or the configuring a corresponding domain name for each container according to the name of each container and the name of the server, and assigning a corresponding IP address to each container comprises:

[0025] The corresponding server of the stateful load application configures a corresponding domain name for each container according to the name of each container and the name of the server, and assigns a corresponding IP address to each container.

[0026] According to a second aspect, an embodiment of the present application provides a domain name resolution device, comprising:

[0027] A request obtaining module is configured to obtain a domain name resolution request sent by a client by listening to a preset port, wherein the preset port is used to receive the domain name resolution request.

[0028] A domain name extracting module is configured to extract a domain name to be resolved from the domain name resolution request.

[0029] A version obtaining module is configured to obtain a resource version corresponding to a stateful load application, wherein the resource version is used to indicate whether a container of the stateful load application is scaled.

[0030] A change judging module is configured to judge whether the resource version obtained this time is changed relative to a resource version obtained last time.

[0031] A first finding module is configured to find an IP address corresponding to the domain name to be resolved from a cache sequence of a domain name cache proxy component if the resource version is not changed, wherein a preset number of containers are created when the stateful load application and the corresponding server are deployed, a corresponding name is assigned to each container, a corresponding domain name is configured for each container according to the name of each container and the name of the server, a corresponding IP address is assigned to each container, and the domain name and the IP address of each container are stored in the cache sequence.

[0032] An IP returning module is configured to return the found IP address to the client.

[0033] According to a third aspect, an embodiment of the present application provides a computer readable storage medium, which stores a computer program, and when the computer program is executed in a computer, the computer is caused to execute the method provided in the first aspect.

[0034] According to a fourth aspect, an embodiment of the present application provides a computing device, comprising a memory and a processor, the memory storing executable code, and the processor executing the executable code to implement the method of the first aspect.

[0035] The domain name resolution method and device, medium and device provided by the embodiments of the present application obtain a domain name resolution request sent by a client, extract a domain name to be resolved from the domain name resolution request, obtain a resource version corresponding to a stateful load application, and then determine whether the resource version has changed. If the resource version has not changed, the IP address corresponding to the domain name to be resolved is searched from a cache sequence of a domain name cache proxy component, and then the searched IP address is returned to the client. In a cloud-native environment, the container under the stateful load application is dynamic and may be scaled out or scaled in. In the embodiments of the present application, whether scaling out or scaling in occurs can be determined based on the resource version and other information. If it is determined that scaling out or scaling in does not occur, the corresponding IP address is directly searched from the cache sequence of the domain name cache proxy component, and then returned to the client, so that fast response is realized, the query efficiency is improved, the number of requests to the upstream domain name server is reduced, and network overhead is reduced. BRIEF DESCRIPTION OF DRAWINGS

[0036] Figure 1 A flowchart of a domain name resolution method in an embodiment of the present application;

[0037] Figure 2 A structural block diagram of a domain name resolution device in an embodiment of the present application. DETAILED DESCRIPTION

[0038] In a first aspect, an embodiment of the present application provides a domain name resolution method, referring to Figure 1 The method comprises the following steps S110-S160:

[0039] S110, a domain name resolution request sent by a client is obtained by listening to a preset port; wherein the preset port is used to receive the domain name resolution request;

[0040] That is, the domain name resolution request is sent by the client to the preset port of the node, the preset port is listened to, and when it is listened that the preset port receives the domain name resolution request, the domain name resolution request is obtained.

[0041] It can be understood that the method provided by the embodiments of the present application is executed by a node, and the coredns service is deployed on the node, so the coredns service can listen to the preset port.

[0042] The node refers to a node in a k8s cluster.

[0043] S120, extract a domain name to be resolved from the domain name resolution request;

[0044] The domain name resolution request carries the domain name to be resolved, and thus the domain name to be resolved is extracted from the domain name resolution request.

[0045] S130, obtain a resource version corresponding to the stateful load application; wherein the resource version is used to represent whether the stateful load application has a container expansion or contraction;

[0046] The stateful load application is a StatefulSet.

[0047] When the container under the stateful load application changes in expansion, contraction, etc., the resource version changes, and thus the resource version can be used to represent whether the stateful load application has a container expansion or contraction.

[0048] S140, judge whether the resource version obtained this time changes relative to the resource version obtained last time;

[0049] S150, if the resource version does not change, find an IP address corresponding to the domain name to be resolved from a cache sequence of the domain name cache proxy component; wherein when the stateful load application and the corresponding server are deployed, a preset number of containers are created, each container is assigned a corresponding name, each container is configured with a corresponding domain name and IP address according to the name of each container and the name of the server, and the domain name and IP address of each container are stored in the cache sequence.

[0050] The stateful load application is deployed in a stateful load application mode in a k8s cluster. After the stateful load application and the corresponding server are deployed, a preset number of containers are created, each container is assigned a name, each container is configured with a domain name and an IP address, and then the domain name and the IP address of each container are stored in the cache sequence of the domain name cache proxy component as a corresponding relationship.

[0051] In one embodiment, the assignment of a corresponding name to each container can include:

[0052] The replica controller of the stateful load application assigns a corresponding name to each container according to a preset naming rule.

[0053] For example, the name of the stateful load application is handless, the name of the first started container is handless-0, the name of the second started container is handless-1, and so on.

[0054] In one embodiment, the configuring, for each container, a corresponding domain name according to the name of the container and the name of the server and assigning a corresponding IP address to each container can include:

[0055] The corresponding server of the stateful load application configures, for each container, a corresponding domain name according to the name of the container and the name of the server and assigns a corresponding IP address to each container.

[0056] For example, the name of the server corresponding to the stateful load application is handless-service. The server assigns the domain name handless-0.handless-service.default.svc.cluster.local to the first started container.

[0057]

[0058] The server assigns the domain name handless-1.handless-service.default.svc.cluster.local to the second started container.

[0059]

[0060] The format of the domain name is (container name).(name of the server corresponding to the stateful load application).namespace.svc.cluster.local. It can be seen that the name of the server corresponding to the stateful load application is used as part of the domain name when configuring the domain name.

[0061] It can be seen that through the orderly naming convention, each container has a unique and predictable name and domain name in the cluster.

[0062] The domain name cache proxy component is deployed on the node. After the stateful load application and the corresponding server are deployed, the domain name and the corresponding IP address of each container are stored in the cache sequence of the domain name cache proxy component. The domain name cache proxy component can also be referred to as the NodelLocal-DNSCache component.

[0063] S160, returning the found IP address to the client.

[0064] It can be seen that in S150, if the resource version does not change, the IP address corresponding to the domain name to be resolved is found from the cache sequence of the domain name cache proxy component, and then the found IP address is returned to the client, thereby realizing the resolution of the domain name.

[0065] ​​For example, in a specific business access scenario, a user needs to access the resource corresponding to the IP address of the domain name corresponding to the first started container. Thus, the client sends a domain name resolution request to the node, and the to-be-resolved domain name in the domain name resolution request is:

[0066] handless-0.handless-service.default.svc.cluster.local

[0067] After the steps S110-S160, the IP address returned to the client is: 100.101.51.133.

[0068] In an embodiment, the method provided by the embodiment of the application further includes:

[0069] If the resource version has not changed and the IP address corresponding to the to-be-resolved domain name is not found in the cache sequence of the domain name cache proxy component, the IP address corresponding to the to-be-resolved domain name is found from an upstream domain name server, and the found IP address and the to-be-resolved domain name are stored in the cache sequence.

[0070] It can be seen that if the resource version has not changed and the corresponding IP address is not found in the cache sequence of the domain name cache proxy component, the corresponding IP address needs to be obtained from the upstream domain name server, and then the found IP address is returned to the client. The found IP address and the to-be-resolved domain name are also stored in the cache sequence, so that the next time the to-be-resolved domain name is resolved, the cache sequence is directly searched, and it is not necessary to obtain from the upstream domain name server.

[0071] Further, the finding of the IP address corresponding to the to-be-resolved domain name from the upstream domain name server can include: sending an IP address finding request to the upstream domain name server, so that the domain name server receiving the IP address finding request obtains the IP address corresponding to the to-be-resolved domain name from the server corresponding to the stateful load application.

[0072] That is, the node sends an IP address finding request to the upstream domain name server, and the upstream domain name server receives the IP address finding request and obtains the IP address corresponding to the to-be-resolved domain name from the server corresponding to the stateful load application, because the IP address is allocated by the server corresponding to the stateful load application for each container.

[0073] In an embodiment, the method provided by the embodiment of the application further includes A1-A4:

[0074] A1, if the resource version has changed, it is determined whether the container corresponding to the to-be-resolved domain name exists;

[0075] A2, if the container corresponding to the domain name to be resolved exists, searching the IP address corresponding to the domain name to be resolved from the cache sequence of the domain name cache proxy component;

[0076] A3, if the IP address corresponding to the domain name to be resolved is not found, determining that the container of the stateful load application is scaled, searching the IP address corresponding to the domain name to be resolved from the upstream domain name server, and storing the searched IP address and the domain name to be resolved into the cache sequence;

[0077] A4, returning the searched IP address to the client.

[0078] That is, if the resource version is changed, it means that the container of the stateful load application is scaled or scaled. Then, it is determined whether the container corresponding to the domain name to be resolved exists, if the container corresponding to the domain name to be resolved exists, the IP address corresponding to the domain name to be resolved is searched from the cache sequence of the domain name cache proxy component. If the IP address corresponding to the domain name to be resolved is not found, it means that the container corresponding to the domain name to be resolved is a newly started container, and the domain name and IP address of the newly started container are not stored into the cache sequence. It can be seen that, at this time, the container is scaled. In this case, the IP address corresponding to the domain name to be resolved is searched from the upstream domain name server, the searched IP address and the domain name to be resolved are stored into the cache sequence, and the searched IP address is returned to the client.

[0079] If the IP address corresponding to the domain name to be resolved is searched from the cache sequence of the domain name cache proxy component, it means that the container corresponding to the domain name to be resolved is not a newly started container, and the searched IP address can be directly returned to the client.

[0080] It can be seen that, if the container of the stateful load application is scaled, the name, domain name and IP address of the newly started container are allocated, but the domain name and IP address are not placed in the cache sequence, but when a domain name resolution request is received, it is determined that the container corresponding to the domain name to be resolved in the domain name resolution request is a newly started container through the above steps, and then the domain name and IP address of the newly started container are placed in the cache sequence. Thus, when the IP address of the newly started container needs to be searched next time, the IP address can be directly searched from the cache sequence, so that the number of requests to the upstream domain name server is reduced.

[0081] In an embodiment, the method provided by the embodiment of the application can further include B1:

[0082] B1、if the resource version changes, it is determined whether the container corresponding to the domain name to be resolved is deleted, if the container is deleted, it is determined that the stateful load application is scaled in, the IP address is returned as empty, and the domain name to be resolved and the corresponding IP address in the cache sequence of the domain name cache proxy component are deleted.

[0083] That is, if the resource version changes and the container corresponding to the domain name to be resolved does not exist, it is indicated that the container corresponding to the domain name to be resolved is deleted, that is, the stateful load application is scaled in. At this time, the IP address returned to the client is empty. Moreover, the domain name to be resolved and the corresponding IP address in the cache sequence are deleted. In this way, it is ensured that the information cached in the cache sequence and the current state of the container of the stateful load application are consistent.

[0084] It can be understood that when a container is deleted, the corresponding domain name and IP address in the cache sequence are not deleted, and therefore only when it is learned through the above steps that the container corresponding to the domain name to be resolved in the domain name resolution request is deleted, the domain name to be resolved and the IP address in the cache sequence are deleted. In this way, when the deleted container is accessed next time, the IP address is directly returned as empty.

[0085] In an embodiment, the method provided by the embodiment of the application further includes:

[0086] If the stateful load application is scaled in and then scaled out, the name and domain name of the deleted container are assigned to the restarted container, and the IP address newly allocated to the restarted container and the assigned domain name are stored in the cache sequence of the domain name cache proxy component.

[0087] That is, if a container is deleted and then a container is restarted, the name and domain name of the deleted container are assigned to the newly restarted container, and the stateful load application corresponding to the restarted container re-allocates an IP address, which is not the IP address of the deleted container. Therefore, the correspondence between the domain name and the IP address changes, and the IP address newly allocated to the restarted container and the assigned domain name are stored in the cache sequence as a correspondence. In this way, when the IP address of the restarted container needs to be accessed, the corresponding IP address can be obtained from the cache sequence, so that the resource is accessed.

[0088] When a container is deleted, the newly created container is assigned the same name as the deleted container, the name does not change, and the domain name does not change.

[0089] In the prior art, if a container is restarted, the IP address of the container changes, but the stored IP address of the container is the original IP address, so that the original IP address is returned to the client, resulting in failure to access. Therefore, in the embodiment of the application, the newly allocated IP address is returned to the client, ensuring that this time the access can be successful. Moreover, the IP address newly allocated for the restarted container and the domain name assigned to it are stored in a corresponding relationship in the cache sequence, ensuring that subsequent access can be successful.

[0090] It can be understood that the embodiment of the application is applied in the field of cloud-native Kubernetes container technology, and the domain name cache proxy component, i.e., NodelLocal-DNSCache, is used to cache the domain name and IP address of the container. When a domain name resolution request sent by a client is received, the corresponding IP address is searched from the cache sequence of the domain name cache proxy component, and then returned to the client.

[0091] Kubernetes, i.e., k8s, is an open-source container orchestration engine, which is a leading solution based on distributed architecture of container technology. The NodelLocal-DNSCache component maintains a cache sequence for each node. The StatefulSet is used to manage the workload API object of the stateful application.

[0092] It can be understood that the cache mechanism is a technology for reducing latency in domain name resolution. In the embodiment of the application, the cache sequence of the domain name cache proxy component on the node is used to store the domain name and IP address, which can improve the response speed, avoid the number of requests to the upstream domain name server, and significantly reduce the query delay and network overhead.

[0093] The embodiment of the application has the following beneficial effects:

[0094] (1) In the cloud-native environment, the container under the stateful load application is dynamic and can be scaled up or scaled down. In the embodiment of the application, whether scaling up or scaling down occurs can be determined based on resource version information, etc. If it is determined that scaling up or scaling down does not occur, the corresponding IP address is searched from the cache sequence of the domain name cache proxy component, and then returned to the client, achieving fast response.

[0095] (2) if it is determined that the capacity expansion occurs, and the container corresponding to the domain name to be resolved is a newly started container, the IP address corresponding to the domain name to be resolved is searched from the domain name server upstream, the searched IP address and the domain name to be resolved are stored in the cache sequence, and the searched IP address is returned to the client. The update of the cache sequence is realized, and the domain name resolution request of the newly started container can be quickly responded subsequently. If it is determined that the capacity reduction occurs, and the container corresponding to the domain name to be resolved is a deleted container, the IP address is returned as empty, and the domain name and the IP address in the cache sequence are deleted, so that the update of the cache address is realized. It can be seen that the update and cleaning of the cache sequence can be realized based on the embodiment of the application, and the accuracy of the cache sequence is ensured.

[0096] In a second aspect, an embodiment of the application provides a domain name resolution device. Referring to Figure 2 The device 100 comprises:

[0097] The request acquisition module 110 is configured to acquire the domain name resolution request sent by the client by listening to a preset port, wherein the preset port is used to receive the domain name resolution request.

[0098] The domain name extraction module 120 is configured to extract the domain name to be resolved from the domain name resolution request.

[0099] The version acquisition module 130 is configured to acquire the resource version corresponding to the stateful load application, wherein the resource version is used to represent whether the container capacity expansion or reduction of the stateful load application occurs.

[0100] The change judgment module 140 is configured to judge whether the resource version acquired this time changes relative to the resource version acquired last time.

[0101] The first search module 150 is configured to search the IP address corresponding to the domain name to be resolved from the cache sequence of the domain name cache proxy component, if the resource version does not change, wherein a preset number of containers are created when the stateful load application and the corresponding server are deployed, the corresponding name is allocated to each container, the corresponding domain name is configured for the container according to the name of each container and the name of the server, the corresponding IP address is allocated to each container, and the domain name and the IP address of each container are stored in the cache sequence.

[0102] The IP return module 160 is configured to return the searched IP address to the client.

[0103] In an embodiment, the device provided by the embodiment of the application can further comprise:

[0104] The second searching module is configured to search the IP address corresponding to the domain name to be resolved from an upstream domain name server if the resource version has not changed and the IP address corresponding to the domain name to be resolved has not been found from the cache sequence of the domain name cache proxy component, and store the found IP address and the domain name to be resolved into the cache sequence.

[0105] In one embodiment, the second searching module is specifically configured to send an IP address searching request to the upstream domain name server, so that the domain name server receiving the IP address searching request acquires the IP address corresponding to the domain name to be resolved from the server corresponding to the stateful load application.

[0106] In one embodiment, the apparatus provided by the embodiment of the present application can further include:

[0107] The third searching module is configured to search the IP address corresponding to the domain name to be resolved from the cache sequence of the domain name cache proxy component if the resource version has changed and the container corresponding to the domain name to be resolved exists, and determine that the stateful load application has container expansion if the IP address corresponding to the domain name to be resolved has not been found, search the IP address corresponding to the domain name to be resolved from an upstream domain name server, and store the found IP address and the domain name to be resolved into the cache sequence.

[0108] In one embodiment, the apparatus provided by the embodiment of the present application can further include:

[0109] The fourth searching module is configured to determine that the stateful load application has container contraction if the container corresponding to the domain name to be resolved is deleted when the resource version has changed, return an empty IP address, and delete the domain name to be resolved and the corresponding IP address in the cache sequence of the domain name cache proxy component.

[0110] In one embodiment, the apparatus provided by the embodiment of the present application can further include:

[0111] The cache updating module is configured to assign the name and domain name of the deleted container to the restarted container if the stateful load application has container contraction and then expansion, and store the IP address newly allocated for the restarted container and the assigned domain name into the cache sequence of the domain name cache proxy component.

[0112] In one embodiment, the replica controller of the stateful load application assigns a corresponding name to each container according to a preset naming rule; and / or the corresponding server of the stateful load application configures a corresponding domain name for each container according to the name of the container and the name of the server, and assigns a corresponding IP address to each container.

[0113] It can be understood that the explanations, specific embodiments, advantages, examples and the like of the device provided by the embodiments of the present application can refer to the corresponding parts in the method provided by the first aspect, which will not be repeated here.

[0114] In a third aspect, a computer readable medium is provided, and the computer readable medium stores computer instructions. When the computer instructions are executed by a processor, the processor executes the method provided by the first aspect.

[0115] Specifically, a system or device equipped with a storage medium can be provided, and the storage medium stores software program codes for implementing the functions of any of the above embodiments, and the computer (or CPU or MPU) of the system or device reads and executes the program codes stored in the storage medium.

[0116] In this case, the program codes read from the storage medium can implement the functions of any of the above embodiments, and thus the program codes and the storage medium storing the program codes constitute a part of the present application.

[0117] The storage medium for providing the program codes includes a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program codes can be downloaded from a server computer via a communication network.

[0118] In addition, it should be clear that not only the program codes read by the computer can be executed, but also part or all of the actual operations can be completed by the operating system and the like operating on the computer based on the instructions of the program codes, thereby implementing the functions of any of the above embodiments.

[0119] In addition, it can be understood that the program codes read from the storage medium can be written into the memory provided in the expansion board inserted into the computer or the memory provided in the expansion module connected to the computer, and then part or all of the actual operations can be executed by the CPU and the like installed on the expansion board or the expansion module based on the instructions of the program codes, thereby implementing the functions of any of the above embodiments.

[0120] It can be understood that the explanation, specific implementation, beneficial effects, examples and the like of the content in the computer readable medium provided by the embodiments of the present application can refer to the corresponding parts in the method provided by the first aspect, and will not be repeated here.

[0121] In a fourth aspect, an embodiment of the present specification provides a computing device, comprising a memory and a processor, wherein the memory stores executable code, and the processor executes the executable code to implement the method in any one of the embodiments of the specification.

[0122] It can be understood that the explanation, specific implementation, beneficial effects, examples and the like of the content in the computer readable medium provided by the embodiments of the present application can refer to the corresponding parts in the method provided by the first aspect, and will not be repeated here.

[0123] Each of the embodiments in the present specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other. Each of the embodiments mainly describes the difference from other embodiments. Especially, for the device embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the related parts can refer to the part of the method embodiments.

[0124] Those skilled in the art should realize that, in one or more examples described above, the functions described in the present application can be realized by hardware, software, a plug-in or any combination thereof. When realized by software, the functions can be stored in a computer readable medium or transmitted as one or more instructions or codes on a computer readable medium.

[0125] The above specific embodiments further explain the purpose, technical solutions and beneficial effects of the present application. It should be understood that the above description is only a specific embodiment of the present application, and is not used to limit the protection scope of the present application. Any modification, equivalent replacement, improvement and the like made on the basis of the technical solutions of the present application should be included in the protection scope of the present application.

Claims

1. A domain name resolution method, characterized by, The method comprises the following steps: listening to a preset port to obtain a domain name resolution request sent by a client; the preset port is used to receive the domain name resolution request; extracting a domain name to be resolved from the domain name resolution request; obtaining a resource version corresponding to a stateful load application; the resource version is used to represent whether the stateful load application has container expansion or contraction; judging whether the resource version obtained this time has changed relative to the resource version obtained last time; if the resource version has not changed, searching for an IP address corresponding to the domain name to be resolved in a cache sequence of a domain name cache proxy component; when the stateful load application and a corresponding server are deployed, a preset number of containers are created, each container is assigned a corresponding name, each container is configured with a corresponding domain name according to the name of each container and the name of the server, each container is assigned a corresponding IP address, and the domain name and the IP address of each container are stored in the cache sequence; returning the searched IP address to the client.

2. The method of claim 1, wherein, The method further comprises the following steps: if the resource version has not changed and the IP address corresponding to the domain name to be resolved has not been searched from the cache sequence of the domain name cache proxy component, searching for the IP address corresponding to the domain name to be resolved from an upstream domain name server and storing the searched IP address and the domain name to be resolved in the cache sequence.

3. The method of claim 2, wherein, The step of searching for the IP address corresponding to the domain name to be resolved from the upstream domain name server comprises the following steps: sending an IP address search request to the upstream domain name server, so that the domain name server receiving the IP address search request obtains the IP address corresponding to the domain name to be resolved from the server corresponding to the stateful load application.

4. The method of claim 1, wherein, The method further comprises the following steps: if the resource version has changed, judging whether there is a container corresponding to the domain name to be resolved; if there is the container corresponding to the domain name to be resolved, searching for the IP address corresponding to the domain name to be resolved from the cache sequence of the domain name cache proxy component; if the IP address corresponding to the domain name to be resolved has not been searched, determining that the stateful load application has container expansion, searching for the IP address corresponding to the domain name to be resolved from the upstream domain name server, and storing the searched IP address and the domain name to be resolved in the cache sequence; returning the searched IP address to the client.

5. The method of claim 1, wherein, The method further comprises the following steps: if the resource version has changed, judging whether the container corresponding to the domain name to be resolved is deleted; if the container is deleted, determining that the stateful load application has container contraction, returning an empty IP address, and deleting the domain name to be resolved and the corresponding IP address in the cache sequence of the domain name cache proxy component.

6. The method of claim 5, wherein, The method further comprises the following steps: if the stateful load application has container contraction and then expansion, assigning the name and the domain name of the deleted container to a restarted container, storing the IP address newly assigned to the restarted container and the assigned domain name in the cache sequence of the domain name cache proxy component.

7. The method according to claim 1, wherein The method comprises: assigning a corresponding name to each container according to a preset naming rule by a replica controller of the stateful load application; The method further comprises: configuring a corresponding domain name for each container according to the name of each container and the name of the server, and assigning a corresponding IP address to each container, which comprises: Configuring a corresponding domain name for each container according to the name of each container and the name of the server by the corresponding server of the stateful load application, and assigning a corresponding IP address to each container.

8. A domain name resolution apparatus characterized by comprising: The method comprises: A request obtaining module is configured to obtain a domain name resolution request sent by a client by listening to a preset port, wherein the preset port is used to receive the domain name resolution request; A domain name extracting module is configured to extract a to-be-resolved domain name from the domain name resolution request; A version obtaining module is configured to obtain a resource version corresponding to the stateful load application, wherein the resource version is used to represent whether the stateful load application has undergone container scaling; A change judging module is configured to judge whether the resource version obtained this time has changed relative to the resource version obtained last time; A first finding module is configured to find an IP address corresponding to the to-be-resolved domain name from a cache sequence of a domain name cache proxy component if the resource version has not changed, wherein a preset number of containers are created when the stateful load application and the corresponding server are deployed, a corresponding name is assigned to each container, a corresponding domain name is configured for each container according to the name of each container and the name of the server, a corresponding IP address is assigned to each container, and the domain name and the IP address of each container are stored in the cache sequence; An IP returning module is configured to return the found IP address to the client.

9. A computer-readable storage medium, characterized in that, The computer program is stored on the computer and, when executed in the computer, causes the computer to execute the method of any one of claims 1-7.

10. A computing device, comprising: The computer program product comprises a memory and a processor, wherein the memory stores executable code, and the processor executes the executable code to implement the method of any one of claims 1-7.

Citation Information

Patent Citations

  • Distributed container cluster service discovery method based on homebred CPU and operation system

    CN108040079A

  • Pod communication connection method and device, electronic equipment and storage medium

    CN111786984A