Domain name resolution method and related equipment based on single point failure avoidance algorithm
Through the multi-data center domain name resolution method based on the single point failure avoidance algorithm, the problem that the traditional DNS system is susceptible to failures is solved, and a highly reliable and low-latency domain name resolution service is achieved, which is suitable for the multi-data center environment of State Grid.
Patent Information
- Application Number
- CN202310159855.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Priority Date
- 2022-12-13
- Filing Date
- 2023-02-14
- Publication Date
- 2025-09-19
- Estimated Expiration
- 2043-02-14
AI Technical Summary
The traditional DNS system is highly centralized and susceptible to root domain name server failures, which leads to interruptions in resolution services and high resolution latency, making it unable to meet the needs of State Grid equipment supervision and automated control.
A multi-data center domain name resolution method based on a single point failure avoidance algorithm is adopted. By obtaining the target domain name and a pre-established domain name index table, the target index number is determined, and the target Internet Protocol address is obtained using a multi-data center domain name system resolution algorithm to achieve decentralized resolution.
It improves the accuracy and robustness of domain name resolution, avoids interruptions in resolution services due to root domain name server failures, and enhances the reliability and latency performance of multi-data center domain name systems.
Smart Images

Figure CN116346776B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of domain name system resolution, and in particular to a domain name resolution method based on a single point failure avoidance algorithm and related equipment. Background Art
[0002] With the continuous advancement of informatization and the expansion of State Grid's business scope, the State Grid's management and control data network is evolving from the original centralized deployment of business platforms to a multi-center service deployment of business systems. However, the current State Grid domain name system suffers from issues such as chaotic hierarchies, inconsistent configurations, and excessive caching times in terms of architecture, standards, and technology. There is an urgent need to improve the DNS architecture and provide highly reliable, secure, and stable DNS resolution services.
[0003] When the traditional DNS was first proposed, it adopted a tree-like structure that continues to this day. This highly centralized approach provides domain name resolution services through a recursive and iterative process. With the continuous development of the Internet, this system relies on root name servers to provide domain name resolution services. If a root name server fails, the entire DNS domain name system will cease to function properly. Furthermore, the system requires multiple iterations to resolve non-locally stored domain names, resulting in high latency and making it unable to meet the latency-sensitive requirements of State Grid services, such as equipment monitoring and automated control.
[0004] In view of this, achieving the decentralization of the DNS domain name system, enhancing its anti-destruction capabilities, and ensuring the uninterrupted operation of multiple data centers and multiple business systems in the power grid management and control network has become an important research issue. Summary of the Invention
[0005] In view of this, the purpose of the present disclosure is to propose a domain name resolution method and related devices based on a single point failure avoidance algorithm to solve or partially solve the above problems.
[0006] Based on the above objectives, a first aspect of the present disclosure provides a domain name resolution method based on a single point failure avoidance algorithm, the method comprising:
[0007] Obtain the target domain name and pre-established domain name index table;
[0008] Determine a target index number corresponding to the target domain name according to the domain name index table and the target domain name;
[0009] Resolving the target domain name according to the target index number using a multi-data center domain name system resolution algorithm based on single point failure avoidance to obtain a target Internet Protocol address;
[0010] A target service is requested according to the target Internet Protocol address.
[0011] Based on the same inventive concept, the second aspect of the present disclosure proposes a domain name resolution device based on a single point failure avoidance algorithm, comprising:
[0012] A domain name acquisition module is configured to acquire a target domain name and a pre-established domain name index table;
[0013] An index number determination module is configured to determine a target index number corresponding to the target domain name according to the domain name index table and the target domain name;
[0014] a domain name resolution module configured to resolve the target domain name according to the target index number using a multi-data center domain name system resolution algorithm based on single point failure avoidance to obtain a target Internet Protocol address;
[0015] The service request module is configured to request a target service according to the target Internet Protocol address.
[0016] Based on the same inventive concept, the third aspect of the present disclosure proposes an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the method described above when executing the computer program.
[0017] Based on the same inventive concept, a fourth aspect of the present disclosure proposes a non-transitory computer-readable storage medium, which stores computer instructions for causing a computer to execute the method described above.
[0018] From the above, it can be seen that the present disclosure proposes a domain name resolution method and related equipment based on a single point failure avoidance algorithm, by obtaining a target domain name and a pre-established domain name index table, determining the target index number corresponding to the target domain name according to the domain name index table and the target domain name, and determining the target index number more accurately, avoiding the problem of inaccurate domain name resolution caused by inaccurate correspondence between the index number and the target domain name; according to the target index number, the target domain name is resolved and processed using a multi-data center domain name system resolution algorithm based on single point failure avoidance to obtain a target Internet Protocol address, and a target service is requested according to the target Internet Protocol address, thereby realizing the decentralization of the multi-data center domain name system, avoiding the situation where the entire multi-data center domain name system cannot provide domain name resolution services normally due to a failure of the root domain name server, and enhancing the anti-destruction capability. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] In order to more clearly illustrate the technical solutions in the present disclosure or related technologies, the following briefly introduces the drawings required for use in the embodiments or related technical descriptions. Obviously, the drawings described below are only embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0020] Figure 1 This is a flowchart of a domain name resolution method based on a single point failure avoidance algorithm according to an embodiment of the present disclosure;
[0021] Figure 2 This is a flowchart of another application scenario of an embodiment of the present disclosure;
[0022] Figure 3 This is a flowchart of another application scenario of an embodiment of the present disclosure;
[0023] Figure 4 This is an example diagram of another application scenario of an embodiment of the present disclosure;
[0024] Figure 5 This is a structural block diagram of a domain name resolution device based on a single point failure avoidance algorithm according to an embodiment of the present disclosure;
[0025] Figure 6 Schematic diagram of the structure of an electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0026] In order to make the objectives, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below in conjunction with specific embodiments and with reference to the accompanying drawings.
[0027] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present disclosure should have the usual meanings understood by people with ordinary skills in the field to which the present disclosure belongs. The "first", "second" and similar words used in the embodiments of the present disclosure do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word include the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative position relationships. When the absolute position of the described object changes, the relative position relationship may also change accordingly.
[0028] The terms used in this disclosure are explained as follows:
[0029] DNS: The multi-data center Domain Name System (DNS) is a distributed database that maps domain names and IP addresses to each other, making it easier for people to access the Internet.
[0030] IP: Internet Protocol (IP) is the network layer protocol in the TCP / IP system. It is located in the network layer of the TCP / IP model and provides information about various protocols to the transport layer, such as TCP and UDP.
[0031] ID: Identity Document. Also known as a serial number or account number, it is a relatively unique code within a system, a kind of "identity card." Within a specific entity, the ID number generally remains unchanged.
[0032] Based on the above description, this embodiment proposes a domain name resolution method based on a single point failure avoidance algorithm, such as Figure 1 As shown, the method includes:
[0033] Step 101: Obtain a target domain name and a pre-established domain name index table.
[0034] During specific implementation, each data center stores a domain name index table locally. First, the pre-established domain name index table is retrieved and called, and the data center obtains and determines the target domain name to be accessed.
[0035] Step 102: Determine a target index number corresponding to the target domain name according to the domain name index table and the target domain name.
[0036] In specific implementation, based on the domain name index table called in the above steps and the target domain name to be accessed, the target index number corresponding to the target domain name is determined by searching the domain name index table.
[0037] Step 103: According to the target index number, the target domain name is resolved using a multi-data center domain name system resolution algorithm based on single point failure avoidance to obtain a target Internet Protocol address.
[0038] In specific implementation, the target index number determined in the above steps is used to resolve the target domain name to be accessed through a multi-data center domain name system resolution algorithm that avoids single point failures to obtain the target Internet Protocol address, that is, the target IP address.
[0039] Step 104: Request a target service according to the target Internet Protocol address.
[0040] In specific implementation, according to the target Internet Protocol address obtained by parsing in the above steps, the required target service is requested from the target Internet Protocol address.
[0041] Through the above scheme, the target domain name and a pre-established domain name index table are obtained, and the target index number corresponding to the target domain name is determined based on the domain name index table and the target domain name. The target index number is determined more accurately, avoiding the problem of inaccurate domain name resolution caused by inaccurate correspondence between the index number and the target domain name; according to the target index number, the target domain name is resolved using a multi-data center domain name system resolution algorithm based on single point failure avoidance to obtain a target Internet Protocol address, and a target service is requested based on the target Internet Protocol address, thereby realizing the decentralization of the multi-data center domain name system, avoiding the situation where the entire multi-data center domain name system cannot provide domain name resolution services normally due to a failure of the root domain name server, and enhancing the anti-destruction capability.
[0042] In some embodiments, step 103 specifically includes:
[0043] Step 1031: Obtain the number of multi-data center DNS servers, perform calculations based on the number of multi-data center DNS servers and the target index number, and determine a target multi-data center DNS server.
[0044] During specific implementation, the total number of multi-data center domain name system servers (number of DNS servers) in the data center is obtained, and calculation processing is performed based on the number of multi-data center domain name servers and the target index number to determine the target multi-data center domain name system server corresponding to the target index number.
[0045] Step 1032: Send a request message to the target multi-data center domain name system server, wherein the request message includes the target domain name, so that the target multi-data center domain name system server determines the target Internet Protocol address based on the target domain name and a pre-established resource record mapping table, and generates a response message including the target Internet Protocol address.
[0046] During specific implementation, a DNS request message is sent to the target multi-data center domain name system server confirmed in the above steps, wherein the request message includes the target domain name, so that the target multi-data center domain name system server determines the target Internet Protocol address based on the target domain name and a pre-established resource record mapping table, and generates a response message including the target Internet Protocol address.
[0047] The format of the DNS message mainly includes an infrastructure portion, a question portion, and a resource record portion, wherein the infrastructure portion refers to the message header and includes at least one of the following: a transaction ID, a flag, a question count, an answer resource record count, an authoritative name server count, and an additional resource record count. The transaction ID is an ID identifier of the DNS message, used to distinguish which request the DNS response message responds to, the flag is a flag field in the DNS message, the question count is the number of DNS query requests, the answer resource record count is the number of DNS responses, the authoritative name server count is the number of authoritative name servers, and the additional resource record count is the number of additional records, i.e., the number of IP addresses corresponding to the authoritative name servers.
[0048] The question section refers to the query question area in the message format, which is used to indicate the problem with the DNS query request. This section contains information about the query in progress, including at least one of the following: query name, query type, and query class. The query name is typically the domain name or IP address being queried, used for reverse queries. The query type is the resource type of the DNS query request, typically type A, indicating that the corresponding IP address is obtained from the domain name. The query class is the address type, typically an Internet address, with a value of 1.
[0049] The resource record portion includes a question answering area field, an authoritative name server area field, and an additional information area field, wherein the fields include at least one of the following: domain name, type, class, expiration time, resource record length, and resource data. The domain name is the domain name requested by the DNS; the type is the type of the resource record, which is the same as the query type value in the question portion; the class is the address type, which is the same as the query class value in the question portion; the expiration time is the life cycle of the resource record, which is generally used to determine the time to save and use cached data after the address resolution program retrieves the resource record, in seconds, and can also indicate the stability of the resource record. Stable information will be assigned a large value; the resource data length is the length of the resource data; and the resource data is the data of the relevant resource record returned according to the query segment requirements.
[0050] Step 1033: Receive the response message and obtain the target Internet Protocol address.
[0051] During specific implementation, a response message is received from the target multi-data center domain name system server, wherein the response message includes the target Internet Protocol address determined by the target multi-data center domain name system server according to the target domain name based on a pre-established resource record mapping table. The data center receives the response message and obtains the target Internet Protocol address contained therein, i.e., the target IP address.
[0052] Through the above scheme, the target multi-data center domain name system server is determined by calculating the obtained target index number and the number of servers, thereby avoiding the problem that the target multi-data center domain name system server is confused and cannot resolve the domain name address in subsequent steps, thereby improving accuracy; by receiving the response message sent by the target multi-data center domain name system server, the target IP address contained therein is obtained, and the service is accessed according to the IP address in subsequent steps.
[0053] In some embodiments, step 1031 specifically includes:
[0054] Step 10311, obtain the multi-data center domain name system server number.
[0055] In a specific implementation, based on the number of multi-data center DNS servers obtained in the above step, illustratively, the number of multi-data center DNS servers is n, and each multi-data center DNS server is pre-numbered, i.e., an ID. The ID of the multi-data center DNS server is obtained.
[0056] Step 10312: perform a modulo calculation on the target index number and the number of multi-data center domain name system servers.
[0057] During specific implementation, a modulo calculation is performed based on the target index number determined in the above steps and the number of domain name system servers in the multi-data center.
[0058] For example, based on the above example, the number of domain name servers in the multi-data center is n, the determined target index number is k, and the remainder calculation formula is k%n.
[0059] Step 10313: In response to the remainder being not zero, determine the multi-data center domain name system server numbered as the remainder as the target multi-data center domain name system server; or, in response to the remainder being zero, determine the multi-data center domain name system server numbered as the number of multi-data center domain name system servers as the target multi-data center domain name system server.
[0060] In a specific implementation, the remainder calculation is performed according to the above steps to determine whether the remainder value is zero. Based on the above example, in response to the remainder not being zero, the multi-data center DNS server with an ID of (k%n) is determined to be the target multi-data center DNS server; in response to the remainder being zero, the multi-data center DNS server with an ID of n is determined to be the target multi-data center DNS server.
[0061] Through the above scheme, the target index number is modulo the number of the multi-data center domain name system servers, and the target multi-data center domain name system server is determined by the modulo value. The obtained target multi-data center domain name system server is more accurate, so that a request message can be sent to the target multi-data center domain name system server in the subsequent steps to obtain the target Internet Protocol address.
[0062] In some embodiments, the receiving of the response message in step 1033 includes:
[0063] Step 10331, obtain the preset waiting time and the response time of the target multi-data center domain name system server.
[0064] In a specific implementation, the data center pre-sets a waiting time, where the preset waiting time is the time it takes to wait for the target multi-data center DNS server to respond to the request message after sending a request message to the target multi-data center DNS server. The preset waiting time and the response time of the target multi-data center DNS server are obtained.
[0065] Step 10332: Determine whether the response of the target multi-data center domain name system server has timed out based on the response time and the preset waiting time.
[0066] In a specific implementation, it is determined whether the target multi-data center domain name system server has timed out in response based on the response time obtained in the above steps and the preset waiting time.
[0067] Step 103331: In response to the target multi-data center domain name system server responding without timeout, a first response message is received, wherein the first response message is a response message sent by the target multi-data center domain name system server in response to the request message.
[0068] In a specific implementation, in response to the response time being less than the preset waiting time and the target multi-data center domain name system server responding without timeout, a first response message is received, wherein the first response message is a response message sent by the target multi-data center domain name system server in response to the request message.
[0069] Step 103332: In response to the target multi-data center domain name system server response timeout, determine that the target multi-data center domain name system server is faulty, update the target multi-data center domain name system server, and receive a second response message sent by the updated target multi-data center domain name system.
[0070] In a specific implementation, in response to the response time being greater than the preset waiting time, the multi-data center DNS server responds with a timeout, and it is determined that the target multi-data center DNS server has failed. The target multi-data center DNS server is updated, and a second response message sent by the updated target multi-data center DNS server is received. The second response message is a response message sent by the updated target multi-data center DNS server in response to the request message.
[0071] With the above solution, by comparing the target multi-data center DNS server's response time with the preset wait time, it is determined whether the target multi-data center DNS server has timed out, that is, whether the target multi-data center DNS server has failed. This avoids resolution failures in subsequent steps due to server failures. If a server failure is determined, the target multi-data center DNS server is updated to facilitate successful resolution of the target domain name in subsequent steps.
[0072] In some embodiments, step 103332 includes:
[0073] Step 1033321: In response to the target multi-data center domain name system server responding timeout, it is determined that the target multi-data center domain name system server fails, and the target index number is updated.
[0074] In a specific implementation, when the response time is greater than the preset waiting time, the multi-data center domain name system server responds overtime, it is determined that the target multi-data center domain name system server fails, and the target index number is updated. Based on the above example, the updated index number k ′ =k+1.
[0075] Step 1033322: Perform calculations based on the number of multi-data center domain name system servers and the updated target index number to determine the updated target multi-data center domain name system server, wherein the updated target multi-data center domain name system server includes a backup resource record, and the backup resource record includes the target Internet Protocol address.
[0076] In a specific implementation, an updated target multi-data center DNS server is determined by performing a modulo calculation on the updated target index number determined in the above step and the number of the multi-data center DNS servers. The updated target multi-data center DNS server includes a backup resource record, and the backup resource record includes the target Internet Protocol address.
[0077] Based on the above example, the number of multi-data center domain name system servers is n, and the updated index number is k. ′ , perform remainder calculation, determine whether the remainder value is zero, and in response to the remainder being non-zero, determine that the ID is (k ′ %n) is the updated target multi-data center domain name system server; in response to the remainder being zero, determining that the multi-data center domain name system server with ID n is the updated target multi-data center domain name system server.
[0078] Step 1033323: Send a request message to the updated target multi-data center domain name system server.
[0079] During specific implementation, a DNS request message is sent to the updated target multi-data center domain name system server confirmed in the above step.
[0080] Step 1033324: Receive the second response message, wherein the second response message is a response message sent by the updated target multi-data center domain name server in response to the request message.
[0081] Through the above scheme, when it is determined that the response of the target multi-data center domain name system server has timed out, that is, it is determined that the target multi-data center domain name system server has failed, the target index number is updated and the target multi-data center domain name system server is re-determined, thereby avoiding the problem of resolution failure caused by the failure of the target multi-data center domain name system server.
[0082] In some embodiments, before step 101, the method further includes:
[0083] Step 10A: Obtain index number information and domain name information, construct a table based on the index number information and the domain name information, and obtain the domain name index table.
[0084] During specific implementation, the index number information and the domain name information are obtained, a table is constructed based on the index number information and the domain name information to obtain a domain name index table, and the domain name index table is stored for the data center to call.
[0085] Step 10B: Obtain the Internet Protocol address corresponding to the domain name information, and construct a table based on the index number information, the domain name information and the Internet Protocol address to obtain the resource record mapping table.
[0086] In a specific implementation, an Internet Protocol address (IP address) corresponding to the domain name information is obtained. A table is constructed based on the index number information, the domain name information, and the IP address to obtain a resource record mapping table. The domain name index table and the index number information in the resource record mapping table correspond one-to-one to the domain name information.
[0087] Step 10C, obtain the number of the multi-data center domain name system servers, and evenly distribute the resource records in the resource record mapping table to the multi-data center domain name system servers based on the hash algorithm, wherein the resource record includes a resource record entry index number, and the resource record entry index number corresponds to the allocation order.
[0088] In a specific implementation, the number of domain name system servers in the multi-data center is obtained, and the resource records in the resource record mapping table are evenly distributed to the domain name system servers in the multi-data center based on a hash algorithm. The resource records include resource record entry index numbers, which correspond to the order of allocation. For example, if resource record a is the first resource record allocated, the resource record entry index number of resource record a is 1; if resource record b is the second resource record allocated, the resource record entry index number of resource record b is 2.
[0089] Through the above scheme, the domain name index table and resource record mapping table are constructed based on the acquired domain name information, index number information, and IP address. This allows for subsequent steps to query the domain name index table for the target index number corresponding to the target domain name, allocate resource records according to the resource record mapping table, and evenly distribute them to the multi-data center domain name system servers. By allocating resource records in the resource record mapping table based on a hashing algorithm, the time overhead of multiple iterations during subsequent domain name resolution is eliminated, thereby improving resolution efficiency.
[0090] In some embodiments, after step 10C, the method further includes:
[0091] Step 10D: Obtain the number of resource records in the resource record mapping table and the index number of the currently allocated resource record entry, and determine whether the resource record is allocated according to the number of resource records and the index number of the currently allocated resource record entry.
[0092] In specific implementation, the total number of resource records in the resource record mapping table and the currently allocated resource record entry index number are obtained, and whether the resource record is allocated is determined based on the number of resource records and the currently allocated resource record entry index number.
[0093] For example, the total number of resource records is m, the index number of the currently allocated resource record entry is i, and the relationship between i and m is determined. If i≤m, the resource record is not allocated; if i>m, the resource record is allocated.
[0094] Step 10E: In response to the number of the resource records being greater than the index number of the currently allocated resource record entry, obtain unallocated resource records and index number information of the unallocated resource records.
[0095] In a specific implementation, in response to the number of the resource records being greater than the index number of the currently allocated resource record entry, the resource records are not fully allocated, and the unallocated resource records and the index number information of the unallocated resource records are obtained.
[0096] Step 10F: for each unallocated resource record, determine the multi-data center domain name system server corresponding to the resource record based on the index number information.
[0097] During specific implementation, for each unallocated resource record, the multi-data center domain name system server corresponding to the resource record is determined by calculation according to the index number information.
[0098] Through the above scheme, whether the resource records are allocated is judged by the number of the resource records and the number of the multi-data center domain name system servers, and the judgment result is more accurate; when it is determined that the resource records are not allocated and there are still some remaining, for each unallocated resource record, the multi-data center domain name system server is calculated and determined according to its index number information to realize the allocation of the remaining resource records, and the allocation result is more accurate.
[0099] In some embodiments, step 10F specifically includes:
[0100] Step 10F1, obtain the multi-data center domain name system server number.
[0101] During specific implementation, the number of the multi-data center domain name system server, ie, ID, is obtained.
[0102] Step 10F2: perform a modulo calculation on the index number and the number of the multi-data center domain name system servers.
[0103] In a specific implementation, the index number is modulo the number of the multi-data center domain name system servers. For example, the index number of the unallocated resource record d is i, the number of the multi-data center domain name system servers is n, and the modulo calculation formula is i%n.
[0104] Step 10F31, in response to the remainder being zero, determines to allocate the unallocated resource record to a first multi-data center domain name system server numbered as the number of the multi-data center domain name system servers, and stores and backs up the unallocated resource record to a second multi-data center domain name system server numbered as a preset number.
[0105] In a specific implementation, a remainder calculation is performed according to the above steps to determine whether the remainder is zero. In response to the remainder of the remainder calculation being zero, illustratively, based on the above example, the preset number is 1, and it is determined that the unallocated resource record d is allocated to the multi-data center domain name system server with an ID of n, and the unallocated resource record d is stored and backed up in the multi-data center domain name system server with an ID of 1.
[0106] Step 10F32, in response to the remainder being not zero, determines to allocate the unallocated resource record to a third multi-data center domain name system server numbered as the remainder, and stores and backs up the unallocated resource record to a fourth multi-data center domain name system server numbered as the remainder plus a preset increment number.
[0107] In a specific implementation, in response to the remainder of the modulo calculation being zero, exemplarily, based on the above example, the preset increment number is 1, and it is determined that the unallocated resource record is allocated to the third multi-data center domain name system server with ID (i%n), and the unallocated resource record is stored and backed up to the fourth multi-data center domain name system server with ID (i%n+1).
[0108] Through the above scheme, the index number is modulo the number of the multi-data center domain name system servers, and the first multi-data center domain name system server and the second multi-data center domain name system server are determined by the modulo value, so that the obtained first multi-data center domain name system server and the second multi-data center domain name system server are more accurate; at the same time, while being allocated to the first multi-data center domain name system server, they are also allocated to the second multi-data center domain name system server, thereby realizing backup processing of resource records and realizing that in subsequent steps, when the first multi-data center domain name system server fails, the second multi-data center domain name system server can still be used to resolve the target domain name, thereby improving the usability of the system.
[0109] Based on the same inventive concept, the present invention discloses another embodiment in an application scenario, such as Figure 2 As shown, including:
[0110] Step 201: Obtain a resource record mapping table, wherein the resource record mapping table includes at least one of the following: index number information, domain name information, and IP address.
[0111] During specific implementation, the established resource record mapping table is obtained, wherein the table includes index number information, domain name information and IP address information.
[0112] Step 202: Obtain the number of the multi-data center domain name system servers, and evenly distribute the resource records in the resource record mapping table to the multi-data center domain name system servers based on a hash algorithm, wherein the resource record includes a resource record entry index number, and the resource record entry index number corresponds to the distribution order.
[0113] In a specific implementation, the number of domain name system servers in the multi-data center is obtained, and the resource records in the resource record mapping table are evenly distributed to the domain name system servers in the multi-data center based on a hash algorithm. The resource records include resource record entry index numbers, which correspond to the order of allocation. For example, if resource record a is the first resource record allocated, the resource record entry index number of resource record a is 1; if resource record b is the second resource record allocated, the resource record entry index number of resource record b is 2.
[0114] Step 203: Obtain the number of resource records in the resource record mapping table and the currently allocated resource record entry index number, and determine whether the resource record is allocated according to the number of resource records and the currently allocated resource record entry index number.
[0115] In specific implementation, the total number of resource records in the resource record mapping table and the currently allocated resource record entry index number are obtained, and whether the resource record is allocated is determined based on the number of resource records and the currently allocated resource record entry index number.
[0116] For example, the total number of resource records is m, the index number of the currently allocated resource record entry is i, and the relationship between i and m is determined. If i≤m, the resource record is not allocated; if i>m, the resource record is allocated.
[0117] Step 204: In response to the number of the resource records being greater than the index number of the currently allocated resource record entry, obtain unallocated resource records and index number information of the unallocated resource records.
[0118] In a specific implementation, in response to the number of the resource records being greater than the index number of the currently allocated resource record entry, the resource records are not fully allocated, and the unallocated resource records and the index number information of the unallocated resource records are obtained.
[0119] Step 205: Obtain the multi-data center domain name system server number, and perform a modulo calculation on the index number and the number of the multi-data center domain name system servers.
[0120] In a specific implementation, an ID of the multi-data center DNS server is obtained. The index ID is modulo the number of the multi-data center DNS servers. Exemplarily, the index ID of the unallocated resource record d is i, the number of the multi-data center DNS servers is n, and the modulo calculation formula is i%n.
[0121] Step 2061A: In response to the remainder being non-zero, determine to allocate the unallocated resource record to a third multi-data center DNS server numbered as the remainder.
[0122] In a specific implementation, in response to the remainder of the modulo calculation being zero, exemplarily, based on the above example, the preset increment number is 1, and it is determined that the unallocated resource record is allocated to the third multi-data center domain name system server with ID (i%n).
[0123] In step 2061B, the unallocated resource record is stored and backed up to a fourth multi-data center domain name system server numbered by the remainder plus a preset increment number.
[0124] During specific implementation, based on the above example, the unallocated resource record is stored and backed up to a fourth multi-data center domain name system server with an ID of (i%n+1).
[0125] Step 2062A: In response to the remainder being zero, determine to allocate the unallocated resource record to a first multi-data center DNS server numbered equal to the number of multi-data center DNS servers.
[0126] In a specific implementation, a remainder calculation is performed according to the above steps to determine whether the remainder is zero. In response to the remainder of the remainder calculation being zero, illustratively, based on the above example, the preset number is 1, and it is determined that the unallocated resource record d is allocated to the multi-data center domain name system server with ID n.
[0127] Step 2062B: back up the unallocated resource record to a second multi-data center domain name system server numbered as a preset number.
[0128] During specific implementation, based on the above example, the unallocated resource record d is stored and backed up to the multi-data center domain name system server with ID 1.
[0129] Step 207: Allocate the next resource record.
[0130] Based on the same inventive concept, the present invention discloses another embodiment in an application scenario, such as Figure 3 Shown, including:
[0131] Step 301: Obtain a target domain name, a pre-established domain name index table, and the number of multi-data center domain name system servers, and perform calculations based on the number of multi-data center domain name system servers and the target index number to determine the target multi-data center domain name system server.
[0132] In specific implementations, each data center stores a local domain name index table. The pre-established domain name index table is first retrieved and called. The data center then obtains and determines the target domain name to be accessed. The total number of multi-data center Domain Name System servers (DNS servers) in the data center is obtained. Based on the number of multi-data center Domain Name System servers and the target index number, a calculation is performed to determine the target multi-data center Domain Name System server corresponding to the target index number.
[0133] Step 302: Determine a target index number corresponding to the target domain name according to the domain name index table and the target domain name.
[0134] In specific implementation, based on the domain name index table called in the above steps and the target domain name to be accessed, the target index number corresponding to the target domain name is determined by searching the domain name index table.
[0135] Step 303: Obtain the multi-data center domain name system server number, and perform a modulo calculation on the target index number and the number of the multi-data center domain name system servers.
[0136] In a specific implementation, based on the number of multi-data center DNS servers obtained in the above step, illustratively, the number of multi-data center DNS servers is n, each multi-data center DNS server is pre-numbered, i.e., an ID. The ID of the multi-data center DNS server is obtained. A modulo calculation is performed between the target index number determined in the above step and the number of multi-data center DNS servers.
[0137] For example, based on the above example, the number of domain name servers in the multi-data center is n, the determined target index number is k, and the remainder calculation formula is k%n.
[0138] Step 3041: In response to the remainder being not zero, determining the multi-data center domain name system server numbered by the remainder as the target multi-data center domain name system server.
[0139] In a specific implementation, the remainder calculation is performed according to the above steps to determine whether the remainder value is zero. Based on the above example, in response to the remainder not being zero, the multi-data center DNS server with the ID (k%n) is determined to be the target multi-data center DNS server.
[0140] Step 3042: In response to the remainder being zero, determine the multi-data center DNS server numbered as the number of the multi-data center DNS servers as the target multi-data center DNS server.
[0141] In a specific implementation, in response to the remainder being zero, the multi-data center domain name system server with the ID being n is determined to be the target multi-data center domain name system server.
[0142] Step 305: Send a request message to the target multi-data center domain name system server, wherein the request message includes the target domain name, so that the target multi-data center domain name system server determines the target Internet Protocol address based on the target domain name and a pre-established resource record mapping table, and generates a response message including the target Internet Protocol address.
[0143] During specific implementation, a DNS request message is sent to the target multi-data center domain name system server confirmed in the above steps, wherein the request message includes the target domain name, so that the target multi-data center domain name system server determines the target Internet Protocol address based on the target domain name and a pre-established resource record mapping table, and generates a response message including the target Internet Protocol address.
[0144] Step 306: Obtain a preset waiting time.
[0145] In a specific implementation, the data center pre-sets a waiting time, wherein the preset waiting time is the time it takes to wait for the target multi-data center domain name system server to reply to the request message after sending the request message to the target multi-data center domain name system server. Exemplarily, the preset waiting time T is obtained.
[0146] Step 307: Obtain the target multi-data center domain name system server response time.
[0147] In a specific implementation, illustratively, the target multi-data center domain name system server response time t is obtained.
[0148] Step 308: Determine whether the response of the target multi-data center domain name system server has timed out based on the response time and the preset waiting time.
[0149] In a specific implementation, it is determined whether the target multi-data center domain name system server has timed out in response based on the response time obtained in the above steps and the preset waiting time.
[0150] Step 309: In response to the target multi-data center domain name system server responding for a timeout, it is determined that the target multi-data center domain name system server is faulty, and the target index number is updated.
[0151] In a specific implementation, when the response time is greater than the preset waiting time, the multi-data center domain name system server responds overtime, it is determined that the target multi-data center domain name system server fails, and the target index number is updated. Based on the above example, the updated index number k ′ =k+1.
[0152] Step 310: In response to the target multi-data center domain name system server responding without timeout, receive the response message and obtain the target Internet Protocol address.
[0153] During specific implementation, a response message is received from the target multi-data center domain name system server, wherein the response message includes the target Internet Protocol address determined by the target multi-data center domain name system server according to the target domain name based on a pre-established resource record mapping table. The data center receives the response message and obtains the target Internet Protocol address contained therein, i.e., the target IP address.
[0154] Based on the same inventive concept, the present invention discloses another embodiment in an application scenario, such as Figure 4 Shown, including:
[0155] Step 401: Obtain index number information, domain name information, and an Internet Protocol address corresponding to the domain name information, and construct a resource record mapping table based on the index number information, the domain name information, and the Internet Protocol address.
[0156] During specific implementation, the index number information, the domain name information and the Internet Protocol address corresponding to the domain name information are obtained, and a resource record mapping table is constructed according to the index number information, the domain name information and the Internet Protocol address.
[0157] For example, there are three data centers, deployed in Beijing, Shanghai and Xi'an, providing a total of 300 services (each data center provides 100 services). Six DNS servers are deployed in the three data centers to provide DNS services. The resource record mapping table is shown in the following table:
[0158]
[0159]
[0160] Step 402: Obtain the number of domain name system servers in multiple data centers, and evenly distribute the resource records in the resource record mapping table to the domain name system servers in multiple data centers based on a hash algorithm.
[0161] In a specific implementation, based on the example in the above steps, the number of multi-data center domain name system servers, that is, the number of DNS servers, is 6, and resource records are evenly distributed to the 6 DNS servers based on the hash algorithm, with each server having 100 resource records. The specific method for evenly distributing resource records based on the hash algorithm is to perform a remainder calculation on the index number and the number of multi-data center domain name system servers. In response to the remainder being zero, it is determined that the unallocated resource records are allocated to the first multi-data center domain name system server numbered as the number of multi-data center domain name system servers, and the unallocated resource records are stored and backed up to the second multi-data center domain name system server numbered as a preset number; in response to the remainder not being zero, it is determined that the unallocated resource records are allocated to the third multi-data center domain name system server numbered as the remainder, and the unallocated resource records are stored and backed up to the fourth multi-data center domain name system server numbered as the remainder plus a preset increment number.
[0162] For example: the resource record with (index number % 6) = 1 is allocated on the DNS server with ID 1, and its backup record is allocated on the DNS server with ID 2;
[0163] The resource record with (index number % 6) = 2 is allocated on the DNS server with ID 2, and its backup record is allocated on the DNS server with ID 3;
[0164] The resource record with (index number % 6) = 3 is allocated on the DNS server with ID 3, and its backup record is allocated on the DNS server with ID 4;
[0165] The resource record with (index number % 6) = 4 is allocated on the DNS server with ID 4, and its backup record is allocated on the DNS server with ID 5;
[0166] The resource record with (index number % 6) = 5 is allocated on the DNS server with ID 5, and its backup record is allocated on the DNS server with ID 6;
[0167] The resource record of (index number%6)=6 is allocated to the DNS server with ID 6, and its backup record is allocated to the DNS server with ID 1.
[0168] Step 403: construct a domain name index table according to the index number information and the domain name information.
[0169] Step 404: Acquire the target domain name, and determine the target index number corresponding to the target domain name through the domain name index table and the target domain name.
[0170] During specific implementation, the target domain name is obtained, and the target index number corresponding to the target domain name is determined through the domain name index table and the target domain name.
[0171] For example, according to the example in the above steps, the Beijing data center requests to access the service with the target domain name service3.shanghai.com. By searching the domain name index table, it is determined that the index number corresponding to the target domain name is 103;
[0172] The Shanghai data center requests access to the service with the target domain name service97.xian.com. By searching the domain name index table, it determines that the index number corresponding to the target domain name is 297.
[0173] Step 405: Obtain the number of multi-data center DNS servers, and calculate a target multi-data center DNS server based on the number of multi-data center DNS servers and the target index number.
[0174] In specific implementation, according to the example in the above steps, the value of the index number% number of DNS servers calculated by the Beijing data center is 1, that is, 103%6=1, and the DNS server numbered 1 is determined to be the target DNS server ( Figure 4 Middle arrow 1);
[0175] The Shanghai data center calculates the index number% of the number of DNS servers as 3, that is, 297%6=3, and determines that the DNS server numbered 3 is the target DNS server ( Figure 4 Middle arrow 4).
[0176] Step 406: Send a request message to the target multi-data center domain name system server.
[0177] Step 407: Obtain a preset waiting time and a response time of the target multi-data center domain name system server, and determine whether the response of the target multi-data center domain name system server has timed out based on the response time and the preset waiting time.
[0178] In specific implementation, according to the example in the above steps, the Beijing data center sets the waiting time to 2 seconds and waits for the target DNS server to respond. The response time is 1 second, and it is determined that the DNS server numbered 1 is operating normally;
[0179] The Shanghai data center sets the waiting time to 1 second and waits for the target DNS server to respond. The response time is 3 seconds, and it is determined that the DNS server numbered 3 fails.
[0180] In some embodiments, step 407 further includes:
[0181] Step 407A: In response to the target multi-data center domain name system server responding for a timeout, it is determined that the target multi-data center domain name system server is faulty, and the target index number is updated.
[0182] Step 407B: Calculate an updated target multi-data center DNS server based on the number of multi-data center DNS servers and the updated target index number.
[0183] Step 407C: Send a request message to the updated target multi-data center domain name system server.
[0184] In the specific implementation, the index number is incremented by 1 to 298, and the value of the index number % the number of DNS servers is calculated to be 4, that is, 298% 6 = 4, and the DNS server numbered 4 is determined to be the updated target DNS server, wherein the updated target DNS server has the backup resource record ( Figure 4 Middle arrow 5).
[0185] Step 408: Receive the response message, obtain the target Internet Protocol address, and request the target service according to the target Internet Protocol address.
[0186] In specific implementation, according to the examples in the above steps,
[0187] Beijing Data Center: After receiving the DNS request message, the target DNS server searches the local resource record according to the domain name and determines that the access IP address is 10.211.138.3. The target DNS server sends a DNS response message with the target IP address 10.211.138.3 to the Beijing Data Center ( Figure 4 The Beijing data center receives the DNS response message, obtains the IP address, and accesses the target service from the Shanghai data center (arrow 2). Figure 4 Middle arrow 3).
[0188] Shanghai Data Center: After receiving the DNS request message, the target DNS server searches the local resource record according to the domain name and determines that the access IP address is 15.211.138.97. The target DNS server sends a DNS response message with the target IP address 15.211.138.97 to the Shanghai Data Center ( Figure 4 The Shanghai data center receives the DNS response message, obtains the IP address, and accesses the target service from the Xi'an data center (arrow 6). Figure 4 middle arrow 7).
[0189] It should be noted that the method of the embodiments of the present disclosure can be performed by a single device, such as a computer or server. The method of the embodiments of the present disclosure can also be applied in a distributed scenario, where multiple devices cooperate to perform the method. In such a distributed scenario, one of the multiple devices may only perform one or more steps of the method of the embodiments of the present disclosure, and the multiple devices will interact with each other to complete the method.
[0190] It should be noted that the above description is limited to some embodiments of the present disclosure. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in an order different from that described in the above embodiments and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order or sequential order shown to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0191] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present disclosure also provides a domain name resolution device based on a single point failure avoidance algorithm.
[0192] refer to Figure 5 , Figure 5 The domain name resolution device based on the single point failure avoidance algorithm of the embodiment includes:
[0193] The domain name acquisition module 501 is configured to acquire a target domain name and a pre-established domain name index table;
[0194] An index number determination module 502 is configured to determine a target index number corresponding to the target domain name according to the domain name index table and the target domain name;
[0195] The domain name resolution module 503 is configured to resolve the target domain name according to the target index number using a multi-data center domain name system resolution algorithm based on single point failure avoidance to obtain a target Internet Protocol address;
[0196] The service request module 504 is configured to request a target service according to the target Internet Protocol address.
[0197] In some embodiments, the domain name resolution module 503 specifically includes:
[0198] a processing unit configured to obtain a number of multi-data center domain name system servers, perform processing based on the number of multi-data center domain name system servers and the target index number, and determine a target multi-data center domain name system server;
[0199] a message sending unit configured to send a request message to the target multi-data center domain name system server, wherein the request message includes the target domain name, so that the target multi-data center domain name system server determines the target Internet Protocol address according to the target domain name based on a pre-established resource record mapping table, and generates a response message including the target Internet Protocol address;
[0200] The message receiving unit is configured to receive the response message and obtain the target Internet Protocol address.
[0201] In some embodiments, the processing unit specifically includes:
[0202] A number obtaining subunit is configured to obtain the multi-data center domain name system server numbers;
[0203] a calculation subunit configured to perform a modulo calculation on the target index number and the number of the multi-data center domain name system servers;
[0204] The target determination subunit is configured to, in response to the remainder being not zero, determine the multi-data center domain name system server numbered as the remainder as the target multi-data center domain name system server; or, in response to the remainder being zero, determine the multi-data center domain name system server numbered as the number of the multi-data center domain name system servers as the target multi-data center domain name system server.
[0205] In some embodiments, the message receiving unit specifically includes:
[0206] a time acquisition subunit, configured to acquire a preset waiting time and a response time of the target multi-data center domain name system server;
[0207] a determining subunit configured to determine whether a response of the target multi-data center domain name system server has timed out based on the response time and the preset waiting time;
[0208] a first receiving subunit, configured to receive a first response message in response to the target multi-data center domain name system server responding without timeout, wherein the first response message is a response message sent by the target multi-data center domain name system server in response to the request message;
[0209] The second receiving sub-unit is configured to determine that the target multi-data center domain name system server has failed in response to a response timeout of the target multi-data center domain name system server, update the target multi-data center domain name system server, and receive a second response message sent by the updated target multi-data center domain name system.
[0210] In some embodiments, the second receiving sub-unit is specifically configured to determine that the target multi-data center domain name system server has failed in response to a timeout in the response of the target multi-data center domain name system server, and update the target index number; perform calculations based on the number of the multi-data center domain name system servers and the updated target index number to determine an updated target multi-data center domain name system server, wherein the updated target multi-data center domain name system server includes a backup resource record, and the backup resource record includes the target Internet Protocol address; send a request message to the updated target multi-data center domain name system server; receive the second response message, wherein the second response message is a response message sent by the updated target multi-data center domain name server in response to the request message.
[0211] In some embodiments, before obtaining the target domain name, the apparatus further includes:
[0212] An index table building module is configured to obtain index number information and domain name information, and construct a table based on the index number information and the domain name information to obtain the domain name index table;
[0213] a mapping table establishment module configured to obtain an Internet Protocol address corresponding to the domain name information, and construct a table based on the index number information, the domain name information, and the Internet Protocol address to obtain the resource record mapping table;
[0214] The resource record allocation module is configured to obtain the number of the multi-data center domain name system servers and evenly distribute the resource records in the resource record mapping table to the multi-data center domain name system servers based on a hash algorithm, wherein the resource record includes a resource record entry index number, and the resource record entry index number corresponds to the allocation order.
[0215] In some embodiments, the device further comprises:
[0216] an allocation judgment module configured to obtain the number of resource records in the resource record mapping table and the index number of the currently allocated resource record entry, and judge whether the resource record is allocated according to the number of resource records and the index number of the currently allocated resource record entry;
[0217] a resource record acquisition module configured to acquire unallocated resource records and index number information of the unallocated resource records in response to the number of the resource records being greater than the index number of the currently allocated resource record entry;
[0218] The server determination module is configured to calculate and determine, for each unallocated resource record, a multi-data center domain name system server corresponding to the resource record according to the index number information.
[0219] In some embodiments, the server determination module specifically includes:
[0220] A number obtaining unit is configured to obtain the multi-data center domain name system server number;
[0221] a calculation unit configured to perform a modulo calculation on the index number and the number of the multi-data center domain name system servers;
[0222] a first backup unit configured to, in response to the remainder being zero, determine to allocate the unallocated resource record to a first multi-data center DNS server numbered equal to the number of the multi-data center DNS servers, and store and back up the unallocated resource record to a second multi-data center DNS server numbered equal to a preset number;
[0223] The second backup unit is configured to, in response to the remainder being not zero, determine to allocate the unallocated resource record to a third multi-data center domain name system server numbered as the remainder, and store and back up the unallocated resource record to a fourth multi-data center domain name system server numbered as the remainder plus a preset incremental number.
[0224] For the convenience of description, the above devices are described as being functionally divided into various modules. Of course, when implementing the present disclosure, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0225] The device of the above embodiment is used to implement the domain name resolution method based on the single point failure avoidance algorithm corresponding to any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0226] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and runnable on the processor. When the processor executes the program, the domain name resolution method based on the single point failure avoidance algorithm described in any of the above embodiments is implemented.
[0227] Figure 6 10 is a schematic diagram showing a more specific hardware structure of an electronic device provided in this embodiment. The device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are communicatively connected to each other within the device via the bus 1050.
[0228] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0229] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage devices, dynamic storage devices, etc. The memory 1020 can store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.
[0230] The input / output interface 1030 is used to connect input / output modules to implement information input and output. The input / output modules can be configured as components within the device (not shown in the figure) or can be externally connected to the device to provide corresponding functions. Input devices may include a keyboard, mouse, touch screen, microphone, various sensors, etc., and output devices may include a display, speaker, vibrator, indicator light, etc.
[0231] The communication interface 1040 is used to connect to a communication module (not shown) to enable communication between the device and other devices. The communication module can communicate via a wired method (such as USB, network cable, etc.) or a wireless method (such as mobile network, WiFi, Bluetooth, etc.).
[0232] The bus 1050 comprises a path for transmitting information between the various components of the device (eg, the processor 1010 , the memory 1020 , the input / output interface 1030 , and the communication interface 1040 ).
[0233] It should be noted that although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040, and the bus 1050, in a specific implementation, the device may also include other components necessary for normal operation. In addition, it will be understood by those skilled in the art that the above device may only include the components necessary to implement the embodiments of this specification, and does not necessarily include all the components shown in the figure.
[0234] The electronic device of the above embodiment is used to implement the domain name resolution method based on the single point failure avoidance algorithm corresponding to any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0235] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present disclosure also provides a non-transitory computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the domain name resolution method based on the single point failure avoidance algorithm as described in any of the above embodiments.
[0236] The computer-readable media of this embodiment include permanent and non-permanent, removable and non-removable media that can be used to store information by any method or technology. The information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, read-only compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0237] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the domain name resolution method based on the single point failure avoidance algorithm as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0238] Those skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present disclosure (including the claims) is limited to these examples. Within the scope of the present disclosure, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present disclosure as described above, which are not provided in detail for the sake of simplicity.
[0239] In addition, to simplify the description and discussion, and so as not to obscure the embodiments of the present disclosure, known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided figures. In addition, devices may be shown in the form of block diagrams to avoid obscuring the embodiments of the present disclosure, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform on which the embodiments of the present disclosure are to be implemented (i.e., these details should be fully within the purview of those skilled in the art). Where specific details (e.g., circuits) are set forth to describe exemplary embodiments of the present disclosure, it will be apparent to those skilled in the art that the embodiments of the present disclosure may be implemented without these specific details or with variations in these specific details. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0240] Although the present disclosure has been described in conjunction with specific embodiments thereof, many alternatives, modifications, and variations of these embodiments will be apparent to those skilled in the art based on the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
[0241] The embodiments of the present disclosure are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present disclosure should be included in the scope of protection of the present disclosure.
Claims
1. A domain name resolution method based on a single point failure avoidance algorithm, characterized in that: include: Obtain the target domain name and pre-established domain name index table; Determine a target index number corresponding to the target domain name according to the domain name index table and the target domain name; Resolving the target domain name according to the target index number using a multi-data center domain name system resolution algorithm based on single point failure avoidance to obtain a target Internet Protocol address; requesting a target service according to the target Internet Protocol address; Before obtaining the target domain name, it also includes: Obtaining index number information and domain name information, and constructing a table based on the index number information and the domain name information to obtain the domain name index table; Obtaining an Internet Protocol address corresponding to the domain name information, and constructing a table based on the index number information, the domain name information, and the Internet Protocol address to obtain a resource record mapping table, wherein the domain name index table and the index number information in the resource record mapping table correspond one-to-one to the domain name information; Obtaining the number of the multi-data center domain name system servers, and evenly distributing resource records in the resource record mapping table to the multi-data center domain name system servers based on a hash algorithm, wherein the resource records include resource record entry index numbers, and the resource record entry index numbers correspond to the distribution order; After evenly distributing the resource records in the resource record mapping table to the multi-data center domain name system servers based on the hash algorithm, the method further includes: Obtaining the number of resource records in the resource record mapping table and the index number of the currently allocated resource record entry, and determining whether the resource record is completely allocated according to the number of resource records and the index number of the currently allocated resource record entry; In response to the number of the resource records being greater than the index number of the currently allocated resource record entry, obtaining unallocated resource records and index number information of the unallocated resource records; For each unallocated resource record, determine the multi-data center domain name system server corresponding to the resource record based on the index number information; The step of calculating and determining the multi-data center domain name system server according to the index number information for each unallocated resource record includes: Obtaining the multi-data center domain name system server number; Calculate the modulus of the index number and the number of domain name system servers in the multi-data center; In response to the remainder being zero, determining to allocate the unallocated resource record to a first multi-data center domain name system server numbered equal to the number of the multi-data center domain name system servers, and storing and backing up the unallocated resource record to a second multi-data center domain name system server numbered equal to a preset number; or In response to the remainder being not zero, it is determined to allocate the unallocated resource record to a third multi-data center domain name system server numbered as the remainder, and the unallocated resource record is stored and backed up to a fourth multi-data center domain name system server numbered as the remainder plus a preset increment number.
2. The method according to claim 1, characterized in that The step of resolving the target domain name according to the target index number using a multi-data center domain name system resolution algorithm based on single point failure avoidance to obtain a target Internet Protocol address includes: Obtaining the number of multi-data center domain name system servers, and performing a calculation based on the number of multi-data center domain name system servers and the target index number to determine a target multi-data center domain name system server; Sending a request message to the target multi-data center domain name system server, wherein the request message includes the target domain name, so that the target multi-data center domain name system server determines the target Internet Protocol address based on the target domain name and a pre-established resource record mapping table, and generates a response message including the target Internet Protocol address; Receive the response message and obtain the target Internet Protocol address.
3. The method according to claim 2, characterized in that The determining a target multi-data center domain name system server by performing calculation processing on the number of the multi-data center domain name system servers and the target index number includes: Obtaining the multi-data center domain name system server number; Performing a modulo calculation on the target index number and the number of domain name system servers in the multi-data center; In response to the remainder being non-zero, determining the multi-data center domain name system server numbered as the remainder as the target multi-data center domain name system server; or, In response to the remainder being zero, the multi-data center DNS servers numbered as the number of the multi-data center DNS servers are determined as target multi-data center DNS servers.
4. The method according to claim 2, characterized in that The receiving the response message includes: Obtaining a preset waiting time and a response time of the target multi-data center domain name system server; Determining whether a response of the target multi-data center domain name system server has timed out based on the response time and the preset waiting time; In response to the target multi-data center domain name system server responding without timeout, receiving a first response message, wherein the first response message is a response message sent by the target multi-data center domain name system server in response to the request message; or In response to a response timeout of the target multi-data center domain name system server, it is determined that the target multi-data center domain name system server is faulty, the target multi-data center domain name system server is updated, and a second response message sent by the updated target multi-data center domain name system is received.
5. The method according to claim 4, characterized in that In response to a timeout in response to the target multi-data center domain name system server, determining that the target multi-data center domain name system server is faulty, updating the target multi-data center domain name system server, and receiving a second response message sent by the updated target multi-data center domain name system server include: In response to a timeout in response to the target multi-data center domain name system server, it is determined that the target multi-data center domain name system server is faulty, and the target index number is updated; Perform calculations based on the number of multi-data center domain name system servers and the updated target index number. determining an updated target multi-datacenter Domain Name System server, wherein the updated target multi-datacenter Domain Name System server comprises a backup resource record including the target Internet Protocol address; Sending a request message to the updated target multi-data center domain name system server; The second response message is received, wherein the second response message is a response message sent by the updated target multi-data center domain name server in response to the request message.
6. A domain name resolution device based on a single point failure avoidance algorithm, characterized in that: include: A domain name acquisition module is configured to acquire a target domain name and a pre-established domain name index table; An index number determination module is configured to determine a target index number corresponding to the target domain name according to the domain name index table and the target domain name; a domain name resolution module configured to resolve the target domain name according to the target index number using a multi-data center domain name system resolution algorithm based on single point failure avoidance to obtain a target Internet Protocol address; a service request module configured to request a target service according to the target Internet Protocol address; Before obtaining the target domain name, it also includes: Obtaining index number information and domain name information, and constructing a table based on the index number information and the domain name information to obtain the domain name index table; Obtaining an Internet Protocol address corresponding to the domain name information, and constructing a table based on the index number information, the domain name information, and the Internet Protocol address to obtain a resource record mapping table, wherein the domain name index table and the index number information in the resource record mapping table correspond one-to-one to the domain name information; Obtaining the number of the multi-data center domain name system servers, and evenly distributing resource records in the resource record mapping table to the multi-data center domain name system servers based on a hash algorithm, wherein the resource records include resource record entry index numbers, and the resource record entry index numbers correspond to the distribution order; After evenly distributing the resource records in the resource record mapping table to the multi-data center domain name system servers based on the hash algorithm, the method further includes: Obtaining the number of resource records in the resource record mapping table and the index number of the currently allocated resource record entry, and determining whether the resource record is completely allocated according to the number of resource records and the index number of the currently allocated resource record entry; In response to the number of the resource records being greater than the index number of the currently allocated resource record entry, obtaining unallocated resource records and index number information of the unallocated resource records; For each unallocated resource record, determine the multi-data center domain name system server corresponding to the resource record based on the index number information; The step of calculating and determining the multi-data center domain name system server according to the index number information for each unallocated resource record includes: Obtaining the multi-data center domain name system server number; Calculate the modulus of the index number and the number of domain name system servers in the multi-data center; In response to the remainder being zero, determining to allocate the unallocated resource record to a first multi-data center domain name system server numbered equal to the number of the multi-data center domain name system servers, and storing and backing up the unallocated resource record to a second multi-data center domain name system server numbered equal to a preset number; or In response to the remainder being not zero, it is determined to allocate the unallocated resource record to a third multi-data center domain name system server numbered as the remainder, and the unallocated resource record is stored and backed up to a fourth multi-data center domain name system server numbered as the remainder plus a preset increment number.
7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 5 when executing the program.
Citation Information
Patent Citations
Method and device for balancing link load on basis of domain name resolution
CN101873358A
Domain name resolution method and system
CN108183975A