Domain name resolution method and device, computer device and storage medium
By adjusting the sorting order and selection of domain name resolution servers in a multi-cloud environment, the problem of low efficiency in multi-cluster domain name resolution is solved, realizing a flexible and efficient domain name resolution method and improving the accuracy and speed of domain name resolution.
Patent Information
- Application Number
- CN202411078599.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-07
- Publication Date
- 2026-01-16
- Estimated Expiration
- 2044-08-07
AI Technical Summary
In multi-cloud scenarios, existing domain name resolution methods cannot meet the domain name resolution needs of multiple clusters and outside the cluster, resulting in low resolution efficiency and insufficient accuracy. Existing solutions, such as custom domain name resolution servers, extend the resolution time and only probabilistically improve the resolution speed.
By obtaining domain name resolution requests, classifying domain name information using a pre-built mapping list, adjusting the sorting order of domain name resolution server addresses, and flexibly selecting target servers for resolution, the system ensures that domain name information is not constrained by cluster access, thereby improving resolution efficiency and accuracy.
It achieves flexibility and accuracy in domain name resolution in a multi-cloud environment, reduces the probability of domain name resolution failure, and improves resolution efficiency and accuracy.
Smart Images

Figure CN118972367B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of communication, and in particular to a domain name resolution method and device, computer equipment and a storage medium. BACKGROUND
[0002] In a single cluster scenario, using a domain name resolution server customized by k8s (kubernetes, an open source platform for managing containers) can realize domain name resolution of the cluster. With the rapid development of enterprise business, multi-cloud gradually becomes the basic architecture of data center construction, and multi-region disaster recovery and multi-live, large-scale multi-cluster management, cross-cloud elasticity and migration scenarios promote the rapid development of cloud-native multi-cloud related technologies. In the multi-cloud scenario, only the domain name resolution server of the cluster cannot meet the requirements, and cannot adapt to the domain name resolution scenarios of multi-cluster and outside the cluster. In order to solve this problem, users usually add a custom domain name resolution server to the / etc / resolv.conf of the pod (the smallest resource management component in kubernetes) to realize domain name resolution in the multi-cluster scenario. According to the principle of domain name resolution, the user-defined domain name resolution server will be added behind the built-in server and there are at most three domain name resolution servers. In the default case, the user-defined server is used only after the built-in server tries to complete the resolution (the default timeout is 5s). This invisibly prolongs the domain name resolution time. Although coreDNS (a flexible and scalable DNS server) provides a rotate (a kind of animation effect that allows controls to rotate around a certain point at a certain angle) plugin, it will perform round-robin queries on the configured multiple domain name resolution servers (that is, randomly selecting from the configured nameservers-domain name resolution servers, rather than always trying the first one first). This can only probabilistically solve the problem of slow domain name resolution, and is not an acceptable solution for an enterprise-level product.
[0003] Therefore, it is urgent to provide a domain name resolution method, device, computer equipment and storage medium capable of improving resolution efficiency and accuracy. SUMMARY
[0004] Based on this, it is necessary to provide a domain name resolution method, device, computer equipment and storage medium capable of improving resolution efficiency and accuracy.
[0005] In a first aspect, a domain name resolution method is provided, the method comprising:
[0006] obtaining a first configuration file and a domain name resolution request sent by a user end, wherein the domain name resolution request comprises domain name information, and the first configuration file comprises a plurality of domain name resolution server addresses;
[0007] classifying the domain name information according to a pre-constructed mapping relationship list to determine a target cluster corresponding to the domain name information;
[0008] adjusting the sorting order of the domain name resolution server addresses in the first configuration file according to the domain name resolution server addresses corresponding to the target cluster to obtain a second configuration file;
[0009] selecting corresponding domain name resolution servers according to the sorting order of the domain name resolution server addresses in the second configuration file to resolve the domain name information to obtain a target server address, and returning the target server address to the user end.
[0010] Optionally, the method for constructing the mapping relationship list comprises:
[0011] determining the category and number of domain name resolution requests based on business requirements;
[0012] obtaining a same number of clusters according to the number of domain name resolution requests, and setting a corresponding identifier for each cluster according to the category of the domain name resolution requests;
[0013] obtaining corresponding domain name resolution server addresses according to the category of the domain name resolution requests, and forming a mapping relationship based on the target domain name resolution server addresses and the corresponding identifiers;
[0014] generating the mapping relationship list based on a plurality of mapping relationships.
[0015] Optionally, classifying the domain name information according to the pre-constructed mapping relationship list to determine a target cluster corresponding to the domain name information comprises:
[0016] in response to detecting that the domain name resolution request comprises an identifier, classifying the domain name information according to the identifier and the mapping relationship list to determine a target cluster corresponding to the domain name information, wherein the identifier corresponds to the domain name information in a one-to-one manner;
[0017] in response to detecting that the domain name resolution request does not comprise an identifier, defining the cluster to which the domain name resolution request sending end belongs as the target cluster corresponding to the domain name information.
[0018] Optionally, adjusting the sorting order of the domain name resolution server addresses in the first configuration file according to the domain name resolution server addresses corresponding to the target cluster to obtain a second configuration file comprises:
[0019] obtaining an initial sorting order of domain name resolution server addresses in a first configuration file;
[0020] detecting position information of a domain name resolution server address corresponding to the target cluster in the initial sorting order of domain name resolution server addresses in the first configuration file;
[0021] in response to detecting that the position information of the domain name resolution server address corresponding to the target cluster is the first position, defining the sorting order of the domain name resolution server addresses in the first configuration file as the sorting order of the domain name resolution server addresses in the second configuration file to generate the second configuration file;
[0022] in response to detecting that the position information of the domain name resolution server address corresponding to the target cluster is not the first position, adjusting the sorting order of the domain name resolution server addresses in the first configuration file, including:
[0023] adjusting the domain name resolution server address corresponding to the target cluster to the first position, and adjusting the domain name resolution server address in the initial sorting order to the second position, and adjusting the position information of other domain name resolution server addresses in turn;
[0024] generating the second configuration file based on the adjusted sorting order of the domain name resolution server addresses.
[0025] Optionally, according to the sorting order of the domain name resolution server addresses in the second configuration file, sequentially selecting corresponding domain name resolution servers to resolve the domain name information to obtain a target server address, including:
[0026] in response to detecting that the number of domain name resolution server addresses is less than or equal to a first preset threshold, sequentially selecting corresponding domain name resolution servers to resolve the domain name information according to the sorting order of the domain name resolution server addresses in the second configuration file;
[0027] in response to detecting that the current domain name resolution server successfully resolves the domain name information, stopping the resolution and determining a target server address according to the resolution result;
[0028] in response to detecting that the number of domain name resolution server addresses is greater than the first preset threshold, sequentially selecting corresponding domain name resolution servers to resolve the domain name information according to the sorting order of the domain name resolution server addresses in the second configuration file;
[0029] if the target number of domain name resolution servers fails to successfully resolve the domain name information, deleting the domain name resolution server addresses in the second configuration file according to the sorting order of the domain name resolution server addresses and the target number, and continuing to resolve the domain name information based on the domain name resolution servers corresponding to the remaining domain name resolution server addresses.
[0030] In response to detecting that the current domain name resolution server successfully resolves the domain name information, stopping the resolving and determining the target server address according to the resolving result.
[0031] Optionally, after the target server address is resolved, the method further comprises:
[0032] caching the domain name information resolving result;
[0033] In response to detecting that the domain name information resolving request corresponding to the domain name information resolving result is detected again within a preset time range, directly returning the domain name information resolving result to the user end.
[0034] Optionally, the method further comprises:
[0035] determining the target server address according to the domain name information resolving result;
[0036] sending a service processing request to the node corresponding to the target server address to obtain a service processing result.
[0037] In a second aspect, a domain name resolution device is provided, and the device comprises:
[0038] a domain name resolution request obtaining module, configured to obtain a first configuration file and a domain name resolution request sent by a user end, wherein the domain name resolution request comprises domain name information, and the first configuration file comprises a plurality of domain name resolution server addresses;
[0039] a classification module, configured to classify the domain name information according to a pre-constructed mapping relationship list, so as to determine a target cluster corresponding to the domain name information;
[0040] an adjustment module, configured to adjust the sorting order of the domain name resolution server addresses in the first configuration file according to the domain name resolution server addresses corresponding to the target cluster, so as to obtain a second configuration file;
[0041] a resolving module, configured to select corresponding domain name resolution servers in turn to resolve the domain name information according to the sorting order of the domain name resolution server addresses in the second configuration file, so as to obtain a target server address, and send the target server address to the user end.
[0042] In a third aspect, a computer device is provided, comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0043] Obtain a first configuration file and a domain name resolution request sent by a user end, wherein the domain name resolution request comprises domain name information, and the first configuration file comprises a plurality of domain name resolution server addresses;
[0044] According to a pre-constructed mapping relationship list, classify the domain name information to determine a target cluster corresponding to the domain name information;
[0045] According to a domain name resolution server address corresponding to the target cluster, adjust the sorting order of the domain name resolution server addresses in the first configuration file to obtain a second configuration file;
[0046] According to the sorting order of the domain name resolution server addresses in the second configuration file, sequentially select corresponding domain name resolution servers to resolve the domain name information to obtain a target server address, and return the target server address to the user end.
[0047] In a fourth aspect, a computer readable storage medium is provided, and a computer program is stored on the computer readable storage medium. When the computer program is executed by a processor, the following steps are implemented:
[0048] Obtain a first configuration file and a domain name resolution request sent by a user end, wherein the domain name resolution request comprises domain name information, and the first configuration file comprises a plurality of domain name resolution server addresses;
[0049] According to a pre-constructed mapping relationship list, classify the domain name information to determine a target cluster corresponding to the domain name information;
[0050] According to a domain name resolution server address corresponding to the target cluster, adjust the sorting order of the domain name resolution server addresses in the first configuration file to obtain a second configuration file;
[0051] According to the sorting order of the domain name resolution server addresses in the second configuration file, sequentially select corresponding domain name resolution servers to resolve the domain name information to obtain a target server address, and return the target server address to the user end.
[0052] In a fifth aspect, a computer program product is provided, and the computer program product comprises a computer program. When the computer program is executed by a processor, the following steps are implemented:
[0053] Obtain a first configuration file and a domain name resolution request sent by a user end, wherein the domain name resolution request comprises domain name information, and the first configuration file comprises a plurality of domain name resolution server addresses;
[0054] According to a pre-constructed mapping relationship list, classify the domain name information to determine a target cluster corresponding to the domain name information;
[0055] adjust the sorting order of the domain name resolution server addresses in the first configuration file according to the domain name resolution server addresses corresponding to the target cluster, to obtain a second configuration file;
[0056] According to the sorting order of the domain name resolution server addresses in the second configuration file, the corresponding domain name resolution servers are selected in turn to resolve the domain name information, to obtain a target server address, and the target server address is returned to the user end.
[0057] The above domain name resolution method, device, computer device and storage medium, the method comprises: obtaining a first configuration file and a domain name resolution request sent by a user end, the domain name resolution request comprising domain name information, and the first configuration file comprising a plurality of domain name resolution server addresses; according to a pre-constructed mapping relationship list, the domain name information is classified to determine the target cluster corresponding to the domain name information; according to the domain name resolution server addresses corresponding to the target cluster, the sorting order of the domain name resolution server addresses in the first configuration file is adjusted, to obtain a second configuration file; according to the sorting order of the domain name resolution server addresses in the second configuration file, the corresponding domain name resolution servers are selected in turn to resolve the domain name information, to obtain a target server address, and the target server address is returned to the user end. The application binds the domain name resolution server with the request domain name, and can flexibly use different domain name resolution servers for different domain name resolution requests, without being constrained by the cluster, to reduce the probability of domain name resolution failure, and improve the domain name resolution efficiency and accuracy. BRIEF DESCRIPTION OF DRAWINGS
[0058] Figure 1 Application environment diagram of the domain name resolution method in one embodiment;
[0059] Figure 2 Flowchart of the domain name resolution method in one embodiment;
[0060] Figure 3 Multi-cloud cluster topology diagram of the domain name resolution method in one embodiment;
[0061] Figure 4 Domain name resolution flowchart when the domain name belongs to cluster 1 in the domain name resolution method in one embodiment;
[0062] Figure 5 Domain name resolution flowchart when the domain name belongs to cluster 2 in the domain name resolution method in one embodiment;
[0063] Figure 6 Structure block diagram of the domain name resolution device in one embodiment;
[0064] Figure 7 Figure 1 is a diagram of an internal structure of a computer device according to an embodiment. DETAILED DESCRIPTION
[0065] In order to make the objects, technical solutions, and advantages of the present application clearer, the following will be combined with the accompanying drawings for the embodiments of the present application to make a clear and complete description of the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art without creative work fall within the protection scope of the present application.
[0066] It should be understood that in the description of the present application, unless the context clearly requires otherwise, the terms "comprise", "comprising", and the like in the specification are to be construed as inclusive or open-ended, and not as excluding or closed-ended. That is, they are "including but not limited to".
[0067] It should also be understood that the terms "first", "second", and the like are used only for descriptive purposes, and are not to be construed as indicating or implying relative importance. In addition, in the description of the present application, unless otherwise stated, the meaning of "multiple" is two or more.
[0068] It should be noted that the terms "S1", "S2", and the like are only used for the purpose of describing the steps, and do not specifically refer to the order or sequence, nor are they used to limit the present application. They are only used to facilitate the description of the method of the present application, and should not be understood as indicating the order of the steps. In addition, the technical solutions of various embodiments can be combined with each other, but must be based on the fact that a person of ordinary skill in the art can implement it. When the combination of technical solutions contradicts each other or cannot be implemented, it should be considered that the combination of technical solutions does not exist, nor is it within the protection scope claimed by the present application.
[0069] The domain name system is a service of the Internet, which maintains the mapping relationship between domain names and IP addresses as a distributed database. With this corresponding relationship, network services can be accessed through domain names, without having to memorize IP addresses. The domain name system provides some server user queries, which is the domain name resolution server (nameserver). In the current cloud native use case, four domain name resolution strategies are supported for containers managed by k8s, which can be summarized as follows: using the built-in domain name resolution server of k8s (configuring the dns-clusterIp parameter in kubelet), using the domain name resolution server of the cluster node (setting in / etc / resolv.conf), and using the user-defined domain name resolution server (passing parameters through dnsconfig).
[0070] In a single cluster scenario, using k8s custom domain name resolution server can realize the domain name resolution of this cluster. Since kubernetes 1.13, Coredns has become the default DNS server (domain name resolution server) of kubernetes. At the same time, NodeLocalDNS (local domain name resolution server) is used as a cache proxy to improve the performance of cluster DNS, so it is usually the first domain name resolution server built into k8s. When a pod (the smallest resource management component in kubernetes) is created, if the domain name resolution strategy is selected to use the default configuration of k8s, then / etc / resolv.conf in the pod is NodeLocalDNS and Coredns as domain name resolution server.
[0071] According to the background art, in a single cluster scenario, using k8s (kubernetes, an open source platform for managing containers) custom domain name resolution server can realize the domain name resolution of this cluster, which cannot meet the application of multi-cloud scenario. The complete domain name resolution process is as follows: the user initiates a DNS domain name resolution request, and the whole process calls libnns3, libresolv and other dynamic libraries in turn, and then accesses nsswitch.conf to determine whether to access the hosts file first or through the dns server.host.conf contains the configuration of the resolver, the default is multi on, indicating that libresolv will return all ip (a single domain name may correspond to multiple A records) of the parsed ip, resolv.conf contains the specified nameserver, the resolver will connect these nameserver to get the A record corresponding to the domain name, and then make further access request according to the ip in the record. If multiple nameservers are configured in / etc / resolv.conf, the first one is used by default. Only when the first one fails, such as port not responding or domain name not found, will the subsequent nameserver be used. Because this is a global configuration for the pod of the container group, and there are fixed requirements for the number and access order of the domain name resolution server, it cannot meet the demand of cross-cluster access domain name resolution in multi-cloud scenario. In order to solve this problem, users usually add custom domain name resolution server, but this way prolongs the domain name resolution time, and the rotate plug-in provided by coreDNS will query the configured multiple domain name resolution servers in turn, but it can only solve the problem of slow domain name resolution probabilistically, which is not an acceptable solution for an enterprise-level product.
[0072] To solve the above technical problems, the application provides a domain name resolution method, device, equipment and storage medium, by binding the domain name resolution server with the request domain name, configuring the domain name resolution request at each request level, for different domain name resolution requests, the cluster access constraint can be avoided, and different domain name resolution servers can be flexibly used, so as to reduce the probability of domain name resolution failure, improve the domain name resolution efficiency and accuracy.
[0073] The domain name resolution method provided by the application can be applied to an application environment as shown in Figure 1 The terminal 102 communicates with the data processing platform arranged on the server 104 through the network, wherein the terminal 102 can be but is not limited to various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices, and the server 104 can be realized by an independent server or a server cluster composed of multiple servers.
[0074] In one embodiment, as shown in Figure 2 A domain name resolution method is provided, which is applied to the terminal in Figure 1 for example, including the following steps:
[0075] S1: Obtain a first configuration file and a domain name resolution request sent by a user terminal, wherein the domain name resolution request includes domain name information, and the first configuration file includes a plurality of domain name resolution server addresses.
[0076] It should be noted that the first configuration file refers to a file required in the domain name resolution process, which is an / etc / resolv.conf file, and the / etc / resolv.conf file is a configuration file for configuring DNS domain name resolution in a Linux system, which contains some parameter settings required in domain name query, such as timeout time, maximum number of attempts, whether to use cache, etc. This file is used to provide configuration for domain name query on the host, and is also the key to realize service query in the container cluster environment. Each line of configuration starts with a keyword, followed by specific configuration parameters, which are used to specify some parameter settings in the domain name query process, such as Figure 4 and Figure 5 As shown in Figure 4 and Figure 5As shown, the domain name resolution request sent by the user end can be test.{ns}.svc.cluster.local or test.{ns}.svc.cluster2.local, where cluster and cluster2 are identifiers in the domain name resolution request, i.e., domain name information, used to match the corresponding cluster, which can be set by the user.
[0077] Specifically, the user end sends a domain name resolution request in a pod of a container cluster, such as sending a domain name resolution request in cluster 1, then cluster 1 is the corresponding local cluster, sending a domain name resolution request in cluster 2, then cluster 2 is the corresponding local cluster, and so on, which will not be described again.
[0078] S2: According to the pre-constructed mapping relationship list, the domain name information is classified to determine the target cluster corresponding to the domain name information.
[0079] It should be noted that the mapping relationship list includes multiple mapping relationships, and the mapping relationship is composed of a domain name resolution server address and a corresponding identifier,
[0080] In some specific embodiments, the construction method of the mapping relationship list includes:
[0081] Based on the business needs, the category and number of domain name resolution requests are determined, i.e., the user can determine in advance which categories of domain name resolution requests his business may involve, and based on this, the category and number of domain name resolution requests are determined, such as Figure 3 As shown, the domain name resolution request includes a request in the local cluster and a request to access cluster 2, a request to access cluster 3 and a request to access cluster 4, and the domain name resolution servers used for the four requests are different, so four domain name resolution servers need to be preset;
[0082] According to the number of domain name resolution requests, the same number of clusters are obtained, and according to the category of the domain name resolution request, the corresponding identifier is set for each cluster, such as the clusters 1, 2, 3 and 4 mentioned above, and the corresponding identifier can be set according to the actual needs, which can be cluster, cluster2, i.e., the local cluster, cluster2, etc.;
[0083] According to the category of the domain name resolution request, the corresponding domain name resolution server address is obtained, which can be represented by different identifiers, such as domain name resolution servers 1, 2, 3, and request sending end domain name resolution server, and a mapping relationship is formed based on the target domain name resolution server address and the corresponding identifier.
[0084] Based on multiple mapping relationships, the mapping relationship list is generated.
[0085] In some embodiments, the domain name information is classified according to a pre-constructed mapping relationship list to determine the target cluster corresponding to the domain name information, including:
[0086] In response to detecting that the domain name resolution request contains an identifier, the domain name information is classified based on the identifier and the mapping relationship list to determine the target cluster corresponding to the domain name information, the identifier corresponding one-to-one to the domain name information;
[0087] In response to detecting that the domain name resolution request does not contain an identifier, the cluster to which the domain name resolution request sending end belongs is defined as the target cluster corresponding to the domain name information.
[0088] Specifically, if the domain name resolution request sent by the user contains an identifier, then according to the identifier, the corresponding domain name resolution server address is matched from the mapping relationship list, and the cluster corresponding to the domain name resolution server address is the target cluster corresponding to the domain name information. If the domain name resolution request sent by the user does not contain an identifier, then the current cluster is taken as the target cluster corresponding to the domain name information. As mentioned above, the current cluster is the cluster to which the request sending end belongs, such as the request sent by cluster 1, and cluster 1 is taken as the current cluster.
[0089] In the above embodiments, by binding the domain name resolution server with the request domain name information, the domain name resolution server is configured at each request level, so that the domain name information resolution process is not restricted by the access of the cluster, and the use scenarios of multi-cloud and external domain name access of the current cluster are met. Different domain name resolution servers are used flexibly for different domain name resolution requests to improve the accuracy and efficiency of domain name resolution.
[0090] S3: Adjust the sorting order of the domain name resolution server addresses in the first configuration file according to the domain name resolution server addresses corresponding to the target cluster to obtain a second configuration file.
[0091] It should be noted that, if there are four clusters, the sorting order of the domain name resolution server addresses in the first configuration file can be the request sending end domain name resolution server, domain name resolution server 1, domain name resolution server 2, and domain name resolution server 3, or other order, which is not limited here.
[0092] In some embodiments, adjusting the sorting order of the domain name resolution server addresses in the first configuration file according to the domain name resolution server addresses corresponding to the target cluster to obtain a second configuration file includes:
[0093] Obtain the initial sorting order of the domain name resolution server addresses in the first configuration file, that is, as described above, the request sending domain name resolution server, domain name resolution server 1, domain name resolution server 2, and domain name resolution server 3;
[0094] The position information of the domain name resolution server address corresponding to the target cluster in the initial sorting order of the domain name resolution server addresses in the first configuration file is detected. If the domain name resolution server address corresponding to the target cluster is domain name resolution server 2, then its position information is the third position.
[0095] In response to detecting that the location information of the domain name resolution server address corresponding to the target cluster is first, i.e. first, the sorting order of the domain name resolution server addresses in the first configuration file is defined as the sorting order of the domain name resolution server addresses in the second configuration file, so as to generate the second configuration file;
[0096] In response to detecting that the location information of the domain name resolution server address corresponding to the target cluster is not the first position, the sorting order of the domain name resolution server addresses in the first configuration file is adjusted, including:
[0097] The domain name resolution server address corresponding to the target cluster is moved to the first position, and the domain name resolution server address that is initially at the first position is moved to the second position. The position information of other domain name resolution server addresses is then adjusted in turn. That is, if the domain name resolution server address corresponding to the target cluster is domain name resolution server 2, domain name resolution server 2 is moved to the first position, the domain name resolution server of the request sending end is moved to the second position, domain name resolution server 1 and domain name resolution server 3 are in the third and fourth positions respectively, and so on.
[0098] The second configuration file is generated based on the adjusted sorting order of the domain name resolution server addresses.
[0099] Specifically, such as Figure 4 As shown, if the domain name resolution request is within this cluster, then CoreDNS is used as the first domain name resolution server for this request, such as... Figure 5 As shown, if the domain name resolution request is for cluster 2, then nameserver2 (i.e., domain name resolution server 2) is used as the first domain name resolution server for this request. Therefore, based on the above classification results, the nameserver part of the / etc / resolv.conf file (configuration file) used by the domain name resolution request is rewritten, changing the first nameserver to the domain name resolution server address corresponding to the classified domain name information, and modifying the order of other domain name resolution server addresses accordingly, such as... Figure 4As shown, when the domain name information belongs to the cluster, coredns is used as the domain name resolution server, the configuration file is search default.svc.clusrter.local svc.cluster.local nameserver 10.232.0.33 / / coredns, and when the domain name information belongs to cluster 2, namesercer2 is used as the domain name resolution server, the configuration file is search default.svc.clusrter.local svc.cluster.local nameserver namesercer2.
[0100] In the above embodiment, by determining the priority of the domain name resolution server, and adjusting the domain name resolution server address corresponding to the domain name resolution server with higher priority to the first place, the domain name information resolution process is not limited by the use order, and the flexibility of the use of the domain name resolution server is improved.
[0101] S4: According to the domain name resolution server address sorting order in the second configuration file, the corresponding domain name resolution server is selected in turn to resolve the domain name information to obtain the target server address, and the target server address is returned to the user end.
[0102] It should be noted that the server address is the server ip, which is obtained by resolving the domain name information through the domain name resolution server.
[0103] In some specific embodiments, according to the domain name resolution server address sorting order in the second configuration file, the corresponding domain name resolution server is selected in turn to resolve the domain name information to obtain the target server address, including:
[0104] In response to detecting that the number of domain name resolution server addresses is less than or equal to a first preset threshold, the corresponding domain name resolution server is selected in turn according to the domain name resolution server address sorting order in the second configuration file to resolve the domain name information, wherein the first preset value can be set according to actual needs, and preferably, the first preset value is 3, that is, the number of domain name resolution servers corresponding to the domain name resolution server addresses in the / etc / resolv.conf file is not more than three, such as the request sending end domain name resolution server, domain name resolution server 1 and domain name resolution server 2;
[0105] In response to detecting that the current domain name resolution server successfully resolves the domain name information, the resolution is stopped, and the target server address is determined according to the resolution result, i.e., the domain name information is resolved in sequence, such as when the first domain name resolution server has successfully resolved, the resolution is stopped, if the first domain name resolution server has not successfully resolved, the second domain name resolution server is used to resolve again, and so on, if the resolution is successful, the resolution is stopped, if the resolution is not successful, but there is no domain name resolution server to be resolved, the overall resolution process is also stopped;
[0106] In response to detecting that the number of domain name resolution server addresses is greater than the first preset threshold, the corresponding domain name resolution servers are selected in sequence according to the domain name resolution server address sorting order in the second configuration file to resolve the domain name information.
[0107] If the target number of domain name resolution servers fails to successfully resolve the domain name information, the domain name resolution server addresses in the second configuration file are deleted according to the domain name resolution server address sorting order and the target number, and the remaining domain name resolution servers are used to continue to resolve the domain name information, wherein the target number is generally set to 3, because in the general mode, the control logic in the container will first record the content of the / etc / resolv.conf file in the container at the initial time, and then update the / etc / resolv.conf file to point the nameserver to 127.0.0.1, and the nameserver of the previously read / etc / resolv.conf file in the container is used as the recursive DNS (recursive DNS server) of the embedded DNS (embedded DNS server), when the embedded DNS cannot complete the domain name resolution, the extDNS (core library, provides an extension of the DNS server) is used, when the extDNS is used, it is used in sequence one by one, but no matter how many nameservers are configured, only the first three are used for domain name resolution, based on this, the target number can be set to 3, when the number of domain name resolution servers exceeds 3 and fails to resolve after trying the first three nameservers, the nameserver part of / etc / resolv.conf is updated, i.e., the first three nameservers are deleted, and the remaining domain name resolution server addresses are sequentially brought up, and the domain name resolution servers corresponding to the domain name resolution server addresses are used to continue to resolve the domain name information.
[0108] In response to detecting that the current domain name resolution server successfully resolves the domain name information, the resolving is stopped, and a target server address is determined according to a resolving result, for example, if the fourth domain name resolution server has successfully resolved, the resolving is stopped, if the fourth domain name resolution server has not successfully resolved, the fifth domain name resolution server is used to resolve again, and so on, if the resolving is successful, the resolving is stopped, if the resolving is not successful, but there is no domain name resolution server to be resolved, the overall resolving process is also stopped.
[0109] In some embodiments, after the target server address is resolved, the method further includes:
[0110] The domain name information resolving result is cached, that is, the domain name information resolving result is cached after the resolving is completed, so that when the domain name information initiates a request again, a return can be quickly obtained without using a domain name resolution server to return, and the resolving efficiency is improved.
[0111] In response to detecting that the domain name information resolving request corresponding to the domain name information resolving result is detected again within a preset time range, the domain name information resolving result is directly returned to the user end, the preset time range can be set according to actual needs, generally, in order to ensure the correctness of the domain name resolving request, the preset time range is not greater than 30s, that is, the resolving record is generally only saved for 30s.
[0112] In some embodiments, after the target server address is resolved, the method further includes:
[0113] The number of times of resolving the target domain name information is recorded.
[0114] If the number of times of resolving the target domain name information is greater than a second preset threshold value within a preset time period, a resolving time period of the target domain name information is obtained, wherein the preset time period can be set according to actual needs, for example, 5 minutes, the second preset threshold value can be set according to actual needs, for example, 20 times, and the resolving time period refers to a time period in a day to which a resolving time of the target domain name information belongs, for example, a time between 12:10 and 12:15.
[0115] In response to detecting that the number of times of occurrence of the target resolving time period is greater than a third preset threshold value within a preset time period, the target domain name information is marked, wherein the second preset threshold value can be set according to actual needs, for example, 5 times, the preset time period can be set according to actual needs, for example, 7 days in a week, and the resolving time period is, for example, 12:10 to 12:15.
[0116] If the current time is in the target resolution time period, when the labeled target domain name information corresponding resolution result is detected for the first time, the resolution result cache time length is determined according to the time length corresponding to the target resolution time period and the average number of resolution times, and the resolution result is cached, so as to return the domain name information resolution result directly to the user end when the domain name information resolution request corresponding to the domain name information resolution result is detected again in the resolution time period.
[0117] The calculation method of the cache time length is: y=kx, y is the cache time length, x is the time length corresponding to the target resolution time period, and k is the percentage value based on the average number of resolution times. For example, when the number of resolution times is 20, the percentage value is 0.2, and when the number of resolution times is 40, the percentage value is 0.4. The same applies to other cases, which will not be described here.
[0118] In the above embodiment, the cache time length of the domain name information resolution result is determined by calculation, which further reduces the response time of the domain name resolution request and improves the resolution efficiency while ensuring the correctness of the resolution result.
[0119] In some specific embodiments, the method further comprises:
[0120] According to the domain name information resolution result, the target server address, i.e. the server address for sending a business processing request, is determined;
[0121] The business processing request is sent to the node corresponding to the target server address (i.e. the target pod) to obtain the business processing result, and the business processing result is returned to the user end.
[0122] In the above embodiment, by updating the content in the configuration file, the domain name resolution process is not limited by the number of domain name resolvers and the use order, and the domain name information is resolved through the preset sorting order, which reduces the response time of the domain name resolution request, reduces the probability of domain name resolution failure, and improves the flexibility of domain name resolution.
[0123] The domain name resolution method comprises the following steps: obtaining a first configuration file and a domain name resolution request sent by a user end, wherein the domain name resolution request comprises domain name information, and the first configuration file comprises a plurality of domain name resolution server addresses; classifying the domain name information according to a pre-constructed mapping relationship list, so as to determine a target cluster corresponding to the domain name information; adjusting the sorting order of the domain name resolution server addresses in the first configuration file according to the domain name resolution server addresses corresponding to the target cluster, so as to obtain a second configuration file; and sequentially selecting corresponding domain name resolution servers according to the sorting order of the domain name resolution server addresses in the second configuration file, so as to resolve the domain name information, to obtain a target server address, and to return the target server address to the user end. The application binds the domain name resolution server and the request domain name, can flexibly use different domain name resolution servers for different domain name resolution requests, so as to reduce the probability of domain name resolution failure, and improve the domain name resolution efficiency and accuracy.
[0124] It should be understood that, although Figures 2-5 the steps in the flowcharts are shown in sequence according to the arrows, the steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, the execution of the steps is not strictly limited in sequence, and the steps can be executed in other orders. Moreover, Figures 2-5 at least part of the steps in the flowcharts can comprise a plurality of sub-steps or a plurality of stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of the sub-steps or stages is not necessarily sequential, but can be executed in rotation or alternation with at least part of other steps or sub-steps or stages of other steps.
[0125] In one embodiment, as shown in Figure 6 , a domain name resolution apparatus is provided, comprising: a domain name resolution request acquisition module, a classification module, an adjustment module and a resolution module, wherein:
[0126] The domain name resolution request acquisition module is configured to obtain a first configuration file and a domain name resolution request sent by a user end, wherein the domain name resolution request comprises domain name information, and the first configuration file comprises a plurality of domain name resolution server addresses.
[0127] The classification module is configured to classify the domain name information according to a pre-constructed mapping relationship list, so as to determine a target cluster corresponding to the domain name information.
[0128] The adjustment module is configured to adjust the sorting order of the domain name resolution server addresses in the first configuration file according to the domain name resolution server addresses corresponding to the target cluster, so as to obtain a second configuration file.
[0129] The analysis module is configured to sequentially select corresponding domain name resolution servers according to a domain name resolution server address sorting order in the second configuration file, and to obtain a target server address by resolving the domain name information by using the domain name resolution servers, and to send the target server address to the user terminal.
[0130] As a preferred embodiment, the classification module is specifically configured to:
[0131] determine the category and the number of the domain name resolution requests based on service requirements;
[0132] obtain a same number of clusters according to the number of the domain name resolution requests, and set a corresponding identifier for each cluster according to the category of the domain name resolution requests;
[0133] obtain corresponding domain name resolution server addresses according to the category of the domain name resolution requests, and form a mapping relationship based on the target domain name resolution server addresses and the corresponding identifiers;
[0134] generate the mapping relationship list based on the mapping relationships.
[0135] As a preferred embodiment, the classification module is specifically configured to:
[0136] in response to detecting that the domain name resolution request contains an identifier, classify the domain name information based on the identifier and the mapping relationship list to determine a target cluster corresponding to the domain name information, and the identifier corresponds to the domain name information in a one-to-one manner;
[0137] in response to detecting that the domain name resolution request does not contain an identifier, define a cluster to which a domain name resolution request sending end belongs as the target cluster corresponding to the domain name information.
[0138] As a preferred embodiment, the adjustment module is specifically configured to:
[0139] obtain an initial sorting order of domain name resolution server addresses in a first configuration file;
[0140] detect position information of a domain name resolution server address corresponding to the target cluster in the initial sorting order of the domain name resolution server addresses in the first configuration file;
[0141] in response to detecting that the position information of the domain name resolution server address corresponding to the target cluster is the first position, define the sorting order of the domain name resolution server addresses in the first configuration file as the sorting order of the domain name resolution server addresses in the second configuration file to generate the second configuration file.
[0142] adjusting the sorting order of the domain name resolution server addresses in the first configuration file in response to detecting that the position information of the domain name resolution server address corresponding to the target cluster is not the first, comprising:
[0143] adjusting the domain name resolution server address corresponding to the target cluster to the first, and adjusting the domain name resolution server address in the initial sorting order to the second, and adjusting the position information of other domain name resolution server addresses in turn;
[0144] generating the second configuration file based on the adjusted sorting order of the domain name resolution server addresses.
[0145] As a more optimal embodiment, in the embodiment of the application, the resolving module is specifically configured to:
[0146] selecting the corresponding domain name resolution server in turn to resolve the domain name information according to the sorting order of the domain name resolution server addresses in the second configuration file in response to detecting that the number of domain name resolution server addresses is less than or equal to the first preset threshold value;
[0147] stopping the resolution and determining the target server address according to the resolution result in response to detecting that the current domain name resolution server successfully resolves the domain name information;
[0148] selecting the corresponding domain name resolution server in turn to resolve the domain name information according to the sorting order of the domain name resolution server addresses in the second configuration file in response to detecting that the number of domain name resolution server addresses is greater than the first preset threshold value;
[0149] if the target number of domain name resolution servers fails to successfully resolve the domain name information, deleting the domain name resolution server addresses in the second configuration file according to the sorting order of the domain name resolution server addresses and the target number, and continuing to resolve the domain name information based on the domain name resolution servers corresponding to the remaining domain name resolution server addresses;
[0150] stopping the resolution and determining the target server address according to the resolution result in response to detecting that the current domain name resolution server successfully resolves the domain name information.
[0151] As a more optimal embodiment, in the embodiment of the application, the device further comprises a cache module, which is specifically configured to:
[0152] caching the domain name information resolution result;
[0153] in response to detecting that the domain name information resolution request corresponding to the domain name information resolution result is detected again within a preset time range, directly returning the domain name information resolution result to the user end.
[0154] As a preferred implementation, in the embodiment of the present application, the device further comprises a service processing request response module, which is specifically configured to:
[0155] determine the target server address according to the domain name information resolution result;
[0156] send a service processing request to the node corresponding to the target server address to obtain a service processing result.
[0157] The specific limitations of the domain name resolution device can refer to the limitations of the domain name resolution method described above, which will not be repeated here. Each module in the above domain name resolution device can be realized by software, hardware and their combination in whole or in part. The above modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so that the processor calls and executes the operations corresponding to each module.
[0158] In one embodiment, a computer device is provided, which can be a terminal, and its internal structure diagram can be as shown in Figure 7 The computer device includes a processor, a memory, a network interface, a display screen and an input device connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The network interface of the computer device is configured to communicate with external terminals through network connection. The computer program is executed by the processor to implement a domain name resolution method. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer overlaid on the display screen, or a key, trackball or touchpad arranged on the shell of the computer device, or an external keyboard, touchpad or mouse, etc.
[0159] Those skilled in the art can understand that Figure 7 the structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.
[0160] In one embodiment, a computer device is provided, which includes a memory, a processor and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented:
[0161] S1: obtaining a first configuration file and a domain name resolution request sent by a user end, the domain name resolution request including domain name information, and the first configuration file including a plurality of domain name resolution server addresses;
[0162] S2: classifying the domain name information according to a pre-constructed mapping relationship list to determine a target cluster corresponding to the domain name information;
[0163] S3: adjusting the sorting order of the domain name resolution server addresses in the first configuration file according to the domain name resolution server addresses corresponding to the target cluster to obtain a second configuration file;
[0164] S4: sequentially selecting corresponding domain name resolution servers according to the sorting order of the domain name resolution server addresses in the second configuration file to resolve the domain name information to obtain a target server address, and returning the target server address to the user end.
[0165] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0166] determining the category and quantity of the domain name resolution request based on service requirements;
[0167] obtaining a same quantity of clusters according to the quantity of the domain name resolution request, and setting a corresponding identifier for each cluster according to the category of the domain name resolution request;
[0168] obtaining corresponding domain name resolution server addresses according to the category of the domain name resolution request, and forming a mapping relationship based on the target domain name resolution server addresses and the corresponding identifiers;
[0169] generating the mapping relationship list based on a plurality of mapping relationships.
[0170] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0171] in response to detecting that the domain name resolution request includes an identifier, classifying the domain name information based on the identifier and the mapping relationship list to determine a target cluster corresponding to the domain name information, the identifier corresponding to the domain name information in one-to-one correspondence;
[0172] in response to detecting that the domain name resolution request does not include an identifier, defining the cluster to which the domain name resolution request sending end belongs as the target cluster corresponding to the domain name information.
[0173] In one embodiment, the processor, when executing the computer program, further implements the following steps:
[0174] obtaining an initial sorting order of the domain name resolution server addresses in the first configuration file;
[0175] detecting position information of the domain name resolution server address corresponding to the target cluster in an initial sorting order of the domain name resolution server addresses in the first configuration file;
[0176] in response to detecting that the position information of the domain name resolution server address corresponding to the target cluster is the first, defining the sorting order of the domain name resolution server addresses in the first configuration file as the sorting order of the domain name resolution server addresses in the second configuration file to generate the second configuration file;
[0177] in response to detecting that the position information of the domain name resolution server address corresponding to the target cluster is not the first, adjusting the sorting order of the domain name resolution server addresses in the first configuration file, comprising:
[0178] adjusting the domain name resolution server address corresponding to the target cluster to the first, and adjusting the domain name resolution server address at the first in the initial sorting order to the second, and adjusting the position information of other domain name resolution server addresses in turn;
[0179] generating the second configuration file based on the adjusted sorting order of the domain name resolution server addresses.
[0180] In one embodiment, the processor when executing the computer program also implements the following steps:
[0181] in response to detecting that the number of domain name resolution server addresses is less than or equal to a first preset threshold, selecting corresponding domain name resolution servers in turn according to the sorting order of the domain name resolution server addresses in the second configuration file to resolve the domain name information;
[0182] in response to detecting that the current domain name resolution server successfully resolves the domain name information, stopping the resolution and determining the target server address according to the resolution result;
[0183] in response to detecting that the number of domain name resolution server addresses is greater than the first preset threshold, selecting corresponding domain name resolution servers in turn according to the sorting order of the domain name resolution server addresses in the second configuration file to resolve the domain name information;
[0184] if the target number of domain name resolution servers fails to successfully resolve the domain name information, deleting the domain name resolution server addresses in the second configuration file according to the sorting order of the domain name resolution server addresses and the target number, and continuing to resolve the domain name information based on the domain name resolution servers corresponding to the remaining domain name resolution server addresses;
[0185] in response to detecting that the current domain name resolution server successfully resolves the domain name information, stopping the resolution and determining the target server address according to the resolution result.
[0186] In one embodiment, the processor, when executing the computer program, also implements the following steps:
[0187] caching the domain name information resolution result;
[0188] In response to detecting that the domain name information resolution request corresponding to the domain name resolution result is detected again within a preset time range, directly returning the domain name information resolution result to the user end.
[0189] In one embodiment, the processor, when executing the computer program, also implements the following steps:
[0190] determining a target server address according to the domain name information resolution result;
[0191] sending a service processing request to the node corresponding to the target server address to obtain a service processing result.
[0192] In one embodiment, a computer readable storage medium is provided, and the computer readable storage medium stores a computer program, and the computer program, when executed by a processor, implements the following steps:
[0193] S1: obtaining a first configuration file and a domain name resolution request sent by a user end, the domain name resolution request including domain name information, and the first configuration file including a plurality of domain name resolution server addresses;
[0194] S2: classifying the domain name information according to a pre-constructed mapping relationship list to determine a target cluster corresponding to the domain name information;
[0195] S3: adjusting the sorting order of the domain name resolution server addresses in the first configuration file according to the domain name resolution server addresses corresponding to the target cluster to obtain a second configuration file;
[0196] S4: selecting corresponding domain name resolution servers according to the sorting order of the domain name resolution server addresses in the second configuration file to resolve the domain name information to obtain a target server address, and returning the target server address to the user end.
[0197] In one embodiment, the computer program, when executed by the processor, also implements the following steps:
[0198] determining the category and quantity of the domain name resolution request based on service demand;
[0199] obtaining a same number of clusters according to the quantity of the domain name resolution request, and setting a corresponding identifier for each cluster according to the category of the domain name resolution request;
[0200] According to the category of the domain name resolution request, the corresponding domain name resolution server address is obtained, and a mapping relationship is formed based on the target domain name resolution server address and the corresponding identifier;
[0201] Based on the plurality of mapping relationships, the mapping relationship list is generated.
[0202] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0203] In response to detecting that the identifier is included in the domain name resolution request, the domain name information is classified based on the identifier and the mapping relationship list to determine the target cluster corresponding to the domain name information, and the identifier corresponds one-to-one to the domain name information;
[0204] In response to detecting that the identifier is not included in the domain name resolution request, the cluster to which the domain name resolution request sending end belongs is defined as the target cluster corresponding to the domain name information.
[0205] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0206] The initial sorting order of the domain name resolution server addresses in the first configuration file is obtained;
[0207] The position information of the domain name resolution server address corresponding to the target cluster in the initial sorting order of the domain name resolution server addresses in the first configuration file is detected;
[0208] In response to detecting that the position information of the domain name resolution server address corresponding to the target cluster is the first position, the sorting order of the domain name resolution server addresses in the first configuration file is defined as the sorting order of the domain name resolution server addresses in the second configuration file to generate the second configuration file;
[0209] In response to detecting that the position information of the domain name resolution server address corresponding to the target cluster is not the first position, the sorting order of the domain name resolution server addresses in the first configuration file is adjusted, including:
[0210] The domain name resolution server address corresponding to the target cluster is adjusted to the first position, and the domain name resolution server address in the initial sorting order is adjusted to the second position, and the position information of other domain name resolution server addresses is adjusted in turn;
[0211] Based on the adjusted sorting order of the domain name resolution server addresses, the second configuration file is generated.
[0212] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0213] When the number of domain name resolution server addresses detected is less than or equal to a first preset threshold, the corresponding domain name resolution servers are selected sequentially according to the sorting order of the domain name resolution server addresses in the second configuration file to resolve the domain name information.
[0214] When it is detected that the current domain name resolution server has successfully resolved the domain name information, the resolution is stopped, and the target server address is determined based on the resolution result;
[0215] When the number of domain name resolution server addresses detected is greater than a first preset threshold, the corresponding domain name resolution servers are selected sequentially according to the sorting order of the domain name resolution server addresses in the second configuration file to resolve the domain name information.
[0216] If the target number of DNS servers fail to resolve the domain name information, the DNS server addresses in the second configuration file are deleted according to the DNS server address sorting order and the target number, and the DNS server addresses corresponding to the remaining DNS server addresses are used to continue resolving the domain name information.
[0217] When the current domain name resolution server detects that the domain name information has been successfully resolved, the resolution is stopped, and the target server address is determined based on the resolution result.
[0218] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0219] Cache the domain name resolution results;
[0220] When a domain name resolution request corresponding to a domain name resolution result is detected again within a preset time range, the domain name resolution result is directly returned to the user.
[0221] In one embodiment, when the computer program is executed by a processor, it also performs the following steps:
[0222] Determine the target server address based on the domain name resolution results;
[0223] Send a service processing request to the node corresponding to the target server address to obtain the service processing result.
[0224] In one embodiment, a computer program product is provided, the computer program product comprising a computer program that, when executed by a processor, performs the following steps:
[0225] S1: Obtain the first configuration file and the domain name resolution request sent by the user terminal. The domain name resolution request includes domain name information, and the first configuration file includes multiple domain name resolution server addresses.
[0226] S2: according to the pre-constructed mapping relationship list, the domain name information is classified to determine the target cluster corresponding to the domain name information;
[0227] S3: according to the domain name resolution server address corresponding to the target cluster, the sorting order of the domain name resolution server address in the first configuration file is adjusted to obtain a second configuration file;
[0228] S4: according to the domain name resolution server address sorting order in the second configuration file, the corresponding domain name resolution server is selected in turn to resolve the domain name information to obtain a target server address, and the target server address is returned to the user end.
[0229] In one embodiment, the computer program is executed by the processor to further implement the following steps:
[0230] Based on the business needs, the category and quantity of the domain name resolution request are determined;
[0231] According to the number of domain name resolution requests, the same number of clusters is obtained, and the corresponding identifier is set for each cluster according to the category of the domain name resolution request;
[0232] According to the category of the domain name resolution request, the corresponding domain name resolution server address is obtained, and the mapping relationship is formed based on the target domain name resolution server address and the corresponding identifier;
[0233] Based on multiple mapping relationships, the mapping relationship list is generated.
[0234] In one embodiment, the computer program is executed by the processor to further implement the following steps:
[0235] In response to detecting that the domain name resolution request contains an identifier, the domain name information is classified based on the identifier and the mapping relationship list to determine the target cluster corresponding to the domain name information, and the identifier corresponds to the domain name information one by one;
[0236] In response to detecting that the domain name resolution request does not contain an identifier, the cluster to which the domain name resolution request sending end belongs is defined as the target cluster corresponding to the domain name information.
[0237] In one embodiment, the computer program is executed by the processor to further implement the following steps:
[0238] Obtain the initial sorting order of the domain name resolution server address in the first configuration file;
[0239] Detect the position information of the domain name resolution server address corresponding to the target cluster in the initial sorting order of the domain name resolution server address in the first configuration file;
[0240] in response to detecting that the location information of the domain name resolution server address corresponding to the target cluster is the first, defining the sorting order of the domain name resolution server address in the first configuration file as the sorting order of the domain name resolution server address in the second configuration file to generate the second configuration file;
[0241] in response to detecting that the location information of the domain name resolution server address corresponding to the target cluster is not the first, adjusting the sorting order of the domain name resolution server address in the first configuration file, including:
[0242] adjusting the domain name resolution server address corresponding to the target cluster to the first, and adjusting the domain name resolution server address in the initial sorting order to the second, and adjusting the location information of other domain name resolution server addresses in turn;
[0243] generating the second configuration file based on the adjusted sorting order of the domain name resolution server address.
[0244] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0245] in response to detecting that the number of domain name resolution server addresses is less than or equal to the first preset threshold, selecting the corresponding domain name resolution server in turn according to the sorting order of the domain name resolution server address in the second configuration file to resolve the domain name information;
[0246] in response to detecting that the current domain name resolution server successfully resolves the domain name information, stopping the resolution, and determining the target server address according to the resolution result;
[0247] in response to detecting that the number of domain name resolution server addresses is greater than the first preset threshold, selecting the corresponding domain name resolution server in turn according to the sorting order of the domain name resolution server address in the second configuration file to resolve the domain name information;
[0248] if the target number of domain name resolution servers fails to successfully resolve the domain name information, deleting the domain name resolution server address in the second configuration file according to the sorting order of the domain name resolution server address and the target number, and continuing to resolve the domain name information based on the domain name resolution server corresponding to the remaining domain name resolution server address;
[0249] in response to detecting that the current domain name resolution server successfully resolves the domain name information, stopping the resolution, and determining the target server address according to the resolution result.
[0250] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0251] Cache the domain name information resolution result;
[0252] In response to detecting that the domain name information resolution request corresponding to the domain name resolution result is detected again within a preset time range, the domain name information resolution result is directly returned to the user end.
[0253] In one embodiment, the computer program, when executed by the processor, further implements the following steps:
[0254] According to the domain name information resolution result, determine the target server address;
[0255] Send a service processing request to the node corresponding to the target server address to obtain a service processing result.
[0256] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. Any reference to memory, storage, database or other medium used in the embodiments provided by the present application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0257] The technical features of the above embodiments can be combined in any way. To make the description concise, not all possible combinations of the technical features in the above embodiments are described, but as long as the combinations of the technical features do not exist, they should be considered as the scope of the present disclosure.
[0258] The above embodiments only express several implementation ways of the present application, and the description is more specific and detailed, but it should not be understood as a limitation to the scope of the patent. It should be pointed out that for ordinary skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which are all within the scope of protection of the present application.
Claims
1. A domain name resolution method, characterized by, The method comprises: obtaining a first configuration file and a domain name resolution request sent by a user end, wherein the domain name resolution request comprises domain name information, and the first configuration file comprises a plurality of domain name resolution server addresses; classifying the domain name information according to a pre-constructed mapping relationship list to determine a target cluster corresponding to the domain name information; adjusting the sorting order of the domain name resolution server addresses in the first configuration file according to the domain name resolution server addresses corresponding to the target cluster to obtain a second configuration file; selecting corresponding domain name resolution servers in turn according to the sorting order of the domain name resolution server addresses in the second configuration file to resolve the domain name information to obtain a target server address, and returning the target server address to the user end.
2. The domain name resolution method of claim 1, wherein, The method for constructing the mapping relationship list comprises: determining the category and quantity of domain name resolution requests based on business requirements; obtaining a same number of clusters according to the quantity of domain name resolution requests, and setting a corresponding identifier for each cluster according to the category of domain name resolution requests; obtaining corresponding domain name resolution server addresses according to the category of domain name resolution requests, and forming a mapping relationship based on the target domain name resolution server addresses and the corresponding identifiers; generating the mapping relationship list based on a plurality of mapping relationships.
3. The domain name resolution method according to claim 1 or 2, characterized in that, The method for classifying the domain name information according to the pre-constructed mapping relationship list to determine the target cluster corresponding to the domain name information comprises: in response to detecting that the domain name resolution request contains an identifier, classifying the domain name information according to the identifier and the mapping relationship list to determine the target cluster corresponding to the domain name information, wherein the identifier corresponds to the domain name information one by one; in response to detecting that the domain name resolution request does not contain an identifier, defining the cluster to which the domain name resolution request sending end belongs as the target cluster corresponding to the domain name information.
4. The domain name resolution method of claim 1, wherein, The method for adjusting the sorting order of the domain name resolution server addresses in the first configuration file according to the domain name resolution server addresses corresponding to the target cluster to obtain a second configuration file comprises: obtaining an initial sorting order of the domain name resolution server addresses in the first configuration file; detecting the position information of the domain name resolution server addresses corresponding to the target cluster in the initial sorting order of the domain name resolution server addresses in the first configuration file; in response to detecting that the position information of the domain name resolution server addresses corresponding to the target cluster is the first position, defining the sorting order of the domain name resolution server addresses in the first configuration file as the sorting order of the domain name resolution server addresses in the second configuration file to generate the second configuration file; in response to detecting that the position information of the domain name resolution server addresses corresponding to the target cluster is not the first position, adjusting the sorting order of the domain name resolution server addresses in the first configuration file, comprising: adjusting the domain name resolution server addresses corresponding to the target cluster to the first position, and adjusting the domain name resolution server address in the initial sorting order to the second position, and adjusting the position information of other domain name resolution server addresses in turn; Generate the second configuration file based on the adjusted ranking order of the domain name resolution server addresses.
5. The domain name resolution method of claim 1, wherein, Select corresponding domain name resolution servers in sequence according to the ranking order of the domain name resolution server addresses in the second configuration file to resolve the domain name information to obtain a target server address. In response to detecting that the number of domain name resolution server addresses is less than or equal to a first preset threshold, select corresponding domain name resolution servers in sequence according to the ranking order of the domain name resolution server addresses in the second configuration file to resolve the domain name information. In response to detecting that the current domain name resolution server successfully resolves the domain name information, stop the resolution and determine the target server address according to the resolution result. In response to detecting that the number of domain name resolution server addresses is greater than the first preset threshold, select corresponding domain name resolution servers in sequence according to the ranking order of the domain name resolution server addresses in the second configuration file to resolve the domain name information. If the target number of domain name resolution servers fails to successfully resolve the domain name information, delete the domain name resolution server addresses in the second configuration file according to the ranking order of the domain name resolution server addresses and the target number, and continue to resolve the domain name information based on the domain name resolution servers corresponding to the remaining domain name resolution server addresses. In response to detecting that the current domain name resolution server successfully resolves the domain name information, stop the resolution and determine the target server address according to the resolution result.
6. The domain name resolution method of claim 1, wherein, After the target server address is resolved, the method further includes: Cache the domain name information resolution result. In response to detecting that the domain name information resolution request corresponding to the domain name information resolution result is detected again within a preset time range, directly return the domain name information resolution result to the user end.
7. The domain name resolution method of claim 1, wherein, The method further includes: Determine the target server address according to the domain name information resolution result. Send a service processing request to the node corresponding to the target server address to obtain a service processing result.
8. A domain name resolution apparatus characterized by comprising: The apparatus includes: A domain name resolution request acquisition module configured to acquire a first configuration file and a domain name resolution request sent by a user end, wherein the domain name resolution request includes domain name information, and the first configuration file includes a plurality of domain name resolution server addresses. A classification module configured to classify the domain name information according to a pre-constructed mapping relationship list to determine a target cluster corresponding to the domain name information. An adjustment module configured to adjust the ranking order of the domain name resolution server addresses in the first configuration file according to the domain name resolution server addresses corresponding to the target cluster to obtain a second configuration file. A resolution module configured to select corresponding domain name resolution servers in sequence according to the ranking order of the domain name resolution server addresses in the second configuration file to resolve the domain name information to obtain a target server address, and send the target server address to the user end.
9. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the method of any one of claims 1 to 7.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to implement the method of any one of claims 1 to 7.
Citation Information
Patent Citations
Domain name resolution method and system
CN108183975A
Domain name processing method and device
CN113225408A