WO2017000144A1 - Dns的服务器、客户端及数据同步方法 - Google Patents

Dns的服务器、客户端及数据同步方法 Download PDF

Info

Publication number
WO2017000144A1
WO2017000144A1 PCT/CN2015/082719 CN2015082719W WO2017000144A1 WO 2017000144 A1 WO2017000144 A1 WO 2017000144A1 CN 2015082719 W CN2015082719 W CN 2015082719W WO 2017000144 A1 WO2017000144 A1 WO 2017000144A1
Authority
WO
WIPO (PCT)
Prior art keywords
server
record
updated
client
field
Prior art date
Application number
PCT/CN2015/082719
Other languages
English (en)
French (fr)
Inventor
韩军伟
陈琳
Original Assignee
华为技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2015/082719 priority Critical patent/WO2017000144A1/zh
Priority to CN201580028567.2A priority patent/CN106464745B/zh
Publication of WO2017000144A1 publication Critical patent/WO2017000144A1/zh

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L61/00Network arrangements, protocols or services for addressing or naming
    • H04L61/45Network directories; Name-to-address mapping
    • H04L61/4505Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols
    • H04L61/4511Network directories; Name-to-address mapping using standardised directories; using standardised directory access protocols using domain name system [DNS]

Definitions

  • the present invention relates to the field of DNS (Domain Name System) technology, and in particular, to a DNS server, a client, and a data synchronization method of the two.
  • DNS Domain Name System
  • DNS can map domain names and IP addresses to each other so that people can access the Internet without having to remember the IP strings that can only be read directly by the computer.
  • server server
  • client client
  • the so-called data refers to the client querying the server for information resources related to the domain name.
  • the server When the client sends a query message to the server for domain name resolution, the server returns the parsed data to the client, and the client stores the data in its own cache.
  • the data is also called a record, and the data is also called a record.
  • the record is given a Time To Live (TTL) in the buffer. Specifically, during the time-to-live, the record can be called by the client to run related services, and beyond the time-to-live, the records in the cache will be cleaned up by aging. If the relevant record in the server has been updated during the survival time, the client calls the record before the update, which will undoubtedly cause the business to fail. It can be seen that it often takes a long time for the record to go from update to take effect.
  • TTL Time To Live
  • the cache area of the client that needs to update the records can be manually cleared by the user, so that the client can send the query message to the server again to obtain the latest record, but the operation is cumbersome and inefficient.
  • various aspects of the present invention provide a DNS server, client, and data synchronization method, which can automatically maintain data synchronization between a client and a server, and ensure that the resolution record takes effect in time.
  • the first aspect provides a data synchronization method for a domain name system, including: identifying, by using a field in an interaction message between a server and a client, whether a record in the server is updated, where the interaction message includes a message sent by the client to the server and the server. Information sent to the client; when the server's record is updated, the client updates the field based on the field of the received interactive message The record of the local cache.
  • the step of using the field in the interaction message between the server and the client to identify whether the record of the server is updated includes: the client sending the first query message to the server; the client Receiving, by the terminal receiving server, a first indication message fed back to the client after determining whether the record in the server is updated, the first indication message includes a field identifying whether the record is updated in the server; when the record of the server is updated, the client receives the message according to the receiving
  • the step of updating the record of the local cache to the field of the interactive message includes: the client clears the record of the current cache area; the client sends a second query message to the server to request the updated record from the server; the client receives the feedback from the server And a second indication message, where the second indication message includes the updated record; the client stores the updated record after receiving the second indication message.
  • the step of using a field in the interaction message between the server and the client to identify whether the record of the server is updated includes: the client receiving the first indication message sent by the server, The first indication message includes a first field identifying that the record of the server has been updated and a second field identifying the version information of the record in which the update occurred; the step of updating the record of the local cache area according to the field of the received interactive message by the client
  • the method includes: the client clears the record corresponding to the version information in the current cache area, and sends a query message to the server to request the updated record from the server; the server feeds back a third indication message to the client, where the third indication message includes the updated Record; the client stores the updated records received in the cache.
  • the first indication message is a DNS message with a header field part header and an update domain part Change
  • the header field part includes Z The field and the CHCOUNT field
  • the Z field is used to identify whether the record in the server is updated
  • the CHCOUNT field is used to identify the number of records in the update domain part that are updated
  • the update field part is used to identify the record of the client that has updated.
  • the header field portion further includes an Opcode field, where the Opcode field is used to identify the type of the first indication message, to indicate that the first indication message is A message that queries whether the records in the server have been updated.
  • the second aspect provides a DNS server, including a receiving module and a sending module, where the receiving module and the sending module are used for sending and receiving an interaction message between the server and the client, and the interaction message includes a message sent by the client received by the receiving module to the server, and Server's sending module to the client
  • the sent information, the interactive message includes a field identifying whether the record in the server is updated, so that the client updates the record of the local cache according to the field of the received interactive message when the record of the server is updated.
  • the receiving module is configured to receive the first query message sent by the client
  • the server further includes a processing module, where the processing module is configured to determine whether the record in the server is updated, and control The sending module feeds back a first indication message to the client, where the first indication message includes a field identifying whether the record is updated in the server, so that the client clears the record of the current buffer area when the record in the server is updated; and the processing module determines that the record occurs.
  • the receiving module is further configured to receive a second query message sent by the client to request the updated record, and the processing module controls the sending module to feed back, to the client, a second indication message that includes the updated record, so that after the update is stored record of.
  • the sending module is configured to send a first indication message to the client, where the first indication message includes a first field that identifies that the record of the server has been updated, and a record that identifies the update.
  • the second field of the version information is such that the client clears the record corresponding to the version information in the current buffer area;
  • the receiving module is further configured to receive the query message sent by the client requesting the updated record, and the processing module controls the sending module to the client
  • the feedback includes a third indication message of the updated record, such that the client stores the updated record in the buffer.
  • the first indication message is a DNS message having a header field part and an update domain part
  • the header field part includes a Z field and The CHCOUNT field
  • the Z field is used to identify whether the record in the server is updated
  • the CHCOUNT field is used to identify the number of records in the update domain part that are updated
  • the update field part is used to identify the record of the client that has updated.
  • the header field part further includes an Opcode field, where the Opcode field is used to identify the type of the first indication message, to indicate that the first indication message is A message that queries whether the records in the server have been updated.
  • the third aspect provides a client of the DNS, including a receiving module, a sending module, a processing module, and a storage module, where the receiving module and the sending module are respectively configured to receive and send an interaction message between the server and the client, where the interaction message includes The message sent by the sending module of the client to the server and the message sent by the server received by the receiving module to the client, the interactive message including the logo service
  • the record in the server records whether the updated field occurs
  • the processing module is configured to update the record of the storage module according to the field of the interactive message received by the receiving module when the record of the server is updated.
  • the sending module is configured to send a first query message to the server, where the receiving module is configured to receive a first indication message that is sent by the server, where the first indication message includes Recording whether an updated field occurs; controlling the storage module to clear the current record when the processing module determines that the record of the server is updated according to the first indication message, and controlling the sending module to further send a second query message for requesting the updated record to the server. And receiving, by the receiving module, a second indication message fed back by the server, where the second indication message includes the updated record, and the processing module is configured to control the storage module to store the updated record.
  • the receiving module is configured to receive a first indication message sent by the server, where the first indication message includes a first field that identifies that the record of the server has been updated, and a record that identifies the update. a second field of the version information, the processing module is configured to control the storage module to clear the record corresponding to the version information, and control the sending module to send a query message to the server for requesting the updated record, and control the receiving module to receive the server feedback.
  • the third indication message includes a updated record, and the processing module is further configured to control the storage module to store the updated record.
  • the first indication message is a DNS message having a header field part and an update domain part
  • the header field part includes a Z field and The CHCOUNT field
  • the Z field is used to identify whether the record in the server is updated
  • the CHCOUNT field is used to identify the number of records in the update domain part that are updated
  • the update field part is used to identify the record of the client that has updated.
  • the header field portion further includes an Opcode field, where the Opcode field is used to identify the type of the first indication message, to indicate that the first indication message is A message that queries whether the records in the server have been updated.
  • the fourth aspect provides a DNS server, including a receiver and a transmitter, where the receiver and the transmitter are used for sending and receiving an interaction message between the server and the client, and the interaction message includes a message sent by the client to the server and a server.
  • the information sent by the sender to the client includes a field identifying whether the record in the server is updated, so that the client updates the record of the local cache according to the field of the received interactive message when the record of the server is updated.
  • the receiver is configured to receive the first query message sent by the client, the server further includes a processor, where the processor is configured to determine whether the record in the server is updated, and control the transmitter And feeding back, to the client, the first indication message, where the first indication message includes a field that identifies whether the record is updated in the server, so that the client clears the record of the current cache area when the record in the server is updated; when the processor determines that the record is updated.
  • the receiver is further configured to receive a second query message sent by the client to request the updated record, and the processor controls the sender to feed back to the client a second indication message including the updated record, so that the updated record is stored.
  • the transmitter is configured to send, to the client, a first indication message, where the first indication message includes a first field that identifies that the record of the server has been updated, and that identifies the record that is updated.
  • the second field of the version information is such that the client clears the record corresponding to the version information in the current buffer area;
  • the receiver is further configured to receive the query message sent by the client requesting the updated record, and the processor controls the sender to feed back to the client.
  • a third indication message including the updated record causes the client to store the updated record in the buffer.
  • the first indication message is a DNS message having a header field part and an update domain part
  • the header field part includes a Z field and The CHCOUNT field
  • the Z field is used to identify whether the record in the server is updated
  • the CHCOUNT field is used to identify the number of records in the update domain part that are updated
  • the update field part is used to identify the record of the client that has updated.
  • the header field part further includes an Opcode field, where the Opcode field is used to identify the type of the first indication message, to indicate that the first indication message is A message that queries whether the records in the server have been updated.
  • a fifth aspect provides a client of a DNS, including a receiver, a transmitter, a processor, and a memory, where the receiver and the transmitter are respectively configured to receive and send an interaction message between the server and the client, where the interaction message includes a client.
  • the field of the interactive message updates the record of the memory.
  • the transmitter is configured to send a first query message to the server, where the receiver is configured to receive a first indication message that is sent by the server, where the first The indication message includes a field identifying whether the record is updated in the server; the processor controls the memory to clear the current record when the processor determines that the record of the server is updated according to the first indication message, and controls the sender to further send the record for requesting the update to the server.
  • the second query message is received by the receiver, and the second indication message includes an updated record, and the processor is configured to control the memory to store the updated record.
  • the receiver is configured to receive a first indication message sent by the server, where the first indication message includes a first field that identifies that the record of the server has been updated, and a record that identifies the update that occurred. a second field of version information, the processor is configured to control the memory to clear the record currently corresponding to the version information, and control the sender to send a query message to the server for requesting the updated record, and control the receiver to receive the third indication of the server feedback The message, the third indication message includes the updated record, and the processor is further configured to control the memory to store the updated record.
  • the first indication message is a DNS message having a header field part and an update domain part
  • the header field part includes a Z field and The CHCOUNT field
  • the Z field is used to identify whether the record in the server is updated
  • the CHCOUNT field is used to identify the number of records in the update domain part that are updated
  • the update field part is used to identify the record of the client that has updated.
  • the header field part further includes an Opcode field, where the Opcode field is used to identify the type of the first indication message, to indicate that the first indication message is A message that queries whether the records in the server have been updated.
  • the field in the interaction message between the server and the client in the DNS is used to identify whether the record in the server is updated, and the client receives the interaction message sent by the server, and according to the field in the interaction message, Update the records in the local cache to automatically maintain data synchronization between the client and the server, ensuring that the resolution records take effect in a timely manner.
  • FIG. 1 is a schematic flow chart of an embodiment of a data synchronization method according to the present invention.
  • FIG. 2 is a schematic flow chart of another embodiment of a data synchronization method according to the present invention.
  • FIG. 3 is a schematic block diagram of an embodiment of a server of the present invention.
  • FIG. 4 is a schematic structural diagram of an embodiment of a server of the present invention.
  • FIG. 5 is a schematic block diagram of an embodiment of a client of the present invention.
  • FIG. 6 is a schematic structural diagram of an embodiment of a client of the present invention.
  • the field in the interaction message between the server and the client in the DNS is used to identify whether the record in the server is updated, and the interaction message may be a message sent by the client to the server or a server.
  • the information sent to the client, the client receives the interactive message sent by the server, and updates the record of the local cache according to the field in the interactive message.
  • FIG. 1 is a schematic flow chart of an embodiment of a data synchronization method according to the present invention.
  • Step S11 The client sends a first query message to the server.
  • the first query message in this embodiment is a DNS Query (query message) for performing domain name resolution between the client and the server.
  • Step S12 The server determines whether the record in the server is updated.
  • the server may determine, according to the version information of the record stored in the local cache of the client that is carried by the first query message, whether the record in the server is updated, the version information of the record may include the domain name corresponding to the record, and the record is stored.
  • the time for example, if the record carried by the first query message is stored at 11:00 on February 2, and the server has updated the data corresponding to the domain name corresponding to the record at 12 o'clock on February 2, the server is based on the The update date of the data corresponding to the domain name can be determined at 12 o'clock on February 2 at 11 o'clock on February 2, and it can be determined that the record in the server has been updated.
  • step S13 is performed; if it is determined that the record in the server is updated, steps S14-S18 are performed.
  • Step S13 The server does not feed back the first indication message to the client.
  • the server may also feed back the first indication message to the client, but the first indication message at this time includes a field that identifies that the record corresponding to the version information in the server has not been updated.
  • Step S14 The server feeds back a first indication message to the client, where the first indication message includes a field identifying that the record corresponding to the version information in the server has been updated.
  • the first indication message in this embodiment is a DNS Respone corresponding to the DNS Query, which can be understood as a DNS format message as shown in Table 1 below, but only includes the existing DNS format message.
  • the header information part (Header), the problem domain part (Question), the answer field part (Answer), the authoritative domain part (Authority), and the additional domain part (Additional) are different, the first indication message in the embodiment of the present invention.
  • an update field for identifying records that have been updated is included. Changes, which are used to indicate which records in the client's cache have been updated, that is, the update domain part carries the records before the update occurs, not the records after the update.
  • the update domain part may adopt the Question section format specified in RFC1035, that is, the QNAME field, the QTYPE field, and the QCLASS field, the QNAME field indicates the domain name queried by the client, and the QTYPE field indicates the type of the domain name.
  • the QCLASS field indicates the network type used by the query. For example, if the QCLASS value is 1, it is the Internet.
  • the header field portion of this embodiment has the format shown in Table 2 below:
  • the value of the 16-bit field of 0 to 15 constitutes an ID (IDentity) of the first indication message, and the ID is carried by the first query message sent by the client; the QR field indicates that the first indication message is a response message, The field value is 1; the Opcode field indicates the type of the first indication message, and the value of the field is 2, indicating that the first indication message is response information sent by the server to the client; and the AA field indicates the server that sends the first indication message. Whether it is an authorized authoritative domain name server. If yes, the field takes a value of 1.
  • the TC field indicates whether the field of the first indication message is too long. If it exceeds 512 bytes, the field takes a value of 1, if less than or equal to 512 words.
  • the value of this field is 0; the RD field indicates whether the server completes the recursive query, and the value of the field is 1 when completed. If the server does not complete the recursive query, the field takes 0; the RA field indicates whether the server supports A recursive query, for example, a value of 1 for the RA field indicates that the recursive query is supported, a value of 0 for the RA field indicates that the recursive query is not supported, and an RCODE field indicates the result of the recursive query, and the value of the field is 0 indicates that the recursive query is successful, otherwise it is the corresponding error code; the QDCOUNT field indicates the number of the problem domain part, the ANCOUNT field indicates the number of the answer field part, the NSCOUNT field indicates the number of the authoritative domain part, and the ARCOUNT field indicates the additional field part The number.
  • the header field part of the existing DNS format message is not set with the CHCOUNT field, and the Z field of the header field part is not used.
  • the Z field is used to identify whether the record in the server is updated, that is, the Z is utilized.
  • the version information of the record in the field delivery server for example, the value of the Z field of the first query message sent by the client is 001. If the value of the Z field in the first indication message fed back by the server is 002, it indicates the record in the server.
  • the client needs to update the record carried in the update domain part of the first indication message.
  • the CHCOUNT field is used to identify the number of records in the update domain portion that are updated.
  • Step S15 When the record is updated, the client clears the current record of the local cache.
  • Step S16 The client sends a second query message to the server to request the updated record.
  • Step S17 The server feeds back to the client a second indication message carrying the updated record.
  • Step S18 The client stores the updated record.
  • steps S16-S18 are the domain name resolution process, that is, when the client sends a DNS query message to the server for domain name resolution, the server returns the parsed data to the client, and the client stores the data in its own. In the cache area. That is, after clearing the aging record in the local cache, the client can send the DNS query message to the server as needed or at intervals.
  • the second query message and the second indication message are a DNS Query and a DNS Respone when performing domain name resolution between the client and the server. Further, in combination with the foregoing, it can be seen that the embodiment is substantially an improvement based on the existing DNS format message, and can be considered as a quick notification of parsing the record update by multiplexing the existing DNS format message, thereby automatically maintaining the client and the Data synchronization between servers ensures that parsing records take effect in a timely manner.
  • other embodiments of the present invention may further assign the value of the Opcode field in the header field part of the DNS format message, for example, 2 ⁇ / RTI> ⁇ / RTI> ⁇ / RTI> ⁇ / RTI> using the Opcode field to identify the type of the first indication message, to indicate whether the first indication message is a message that the record in the query server is updated, where the Opcode field is 2
  • the first indication message is the same as the value of the Opcode field of the existing DNS format message (DNS Respone).
  • the value of the Opcode field is any one of 3 to 15
  • the first indication message is identified as “DNS record change query message”. That is, the first indication message is identified as a message for querying whether the record in the server is updated.
  • the Z field of the header field portion is the same as the above-described usage method.
  • FIG. 2 is a flow chart showing another embodiment of the data synchronization method of the present invention.
  • Step S21 The server sends a first indication message to the client, where the first indication message includes a first field that identifies that the record of the server has been updated, and a second field that identifies the version information of the record that is updated.
  • the first indication message is a DNS format message for performing domain name resolution between the server and the client in the DNS, and is combined with Table 1 and Table 2 by assigning Opcode to the header field part of the DNS format message.
  • the value of the field for example, any one of 2 to 15, identifies the type of the first indication message by using an Opcode field, to indicate that the first indication message is a message that the record in the query server is updated, where the Opcode field When the value is 2, the first indication message is the same as the value of the Opcode field of the existing DNS format message (DNS Respone). If the Opcode field is any value of 3 to 15, the first indication message is identified. For "DNS record change query message". At this point the Z field of the header field is still used to identify if the record in the server has been updated.
  • Step S22 The client clears the record corresponding to the version information in the current buffer area, and sends a query message to the server to request the updated record from the server.
  • Step S23 The server feeds back to the client a third indication message carrying the updated record.
  • Step S24 The client stores the received updated record in the local buffer.
  • the server of this embodiment actively informs the client when it is determined that the record is updated, so that the client automatically maintains data synchronization with the server, and ensures that the parsing record takes effect in time.
  • Other embodiments of the present invention may use the Z field of the header field part of the DNS format message to transmit the version information of the record in the server to identify whether the record of the server is updated, for example, the value of the Z field of the first query message sent by the client is 001. If the value of the Z field in the first indication message fed back by the server is 002, it indicates that the record in the server is updated, and the client needs to update the record carried in the update domain part of the first indication message, and When the record is updated, the CHCOUNT field of the header field part is used to identify the number of records that are updated in the update domain part, and the Opcode field of the header field part is the same as the existing DNS format message, and the update domain part is carried. It is only the record before the update occurs, not the record after the update.
  • the present invention also provides a server as shown in FIG. 3.
  • the server 30 includes a receiving module 31 and a processing module 32, and a sending module 33.
  • the transceiver module 31 and the sending module 33 are respectively configured to receive and send.
  • the interaction message includes both the message sent by the client to the server 30, and the information sent by the server 30 to the client, specifically:
  • the interaction message is a message sent by the client to the server 30,
  • the receiving module 31 receives the first query message sent by the client, and the processing module 32 determines whether the record in the server 30 is updated, and controls the sending module 33 to feed back the first indication to the client.
  • the message includes a field identifying whether the update occurs in the server 30, such that the client clears the record of the current cache area when the record in the server 30 is updated.
  • the receiving module 31 further receives a second query message sent by the client to request the updated record, and the processing module 32 controls the sending module 33 to provide feedback to the client according to the second query message.
  • the second indication message including the updated record causes the client to store the updated record, thereby automatically maintaining data synchronization with the server 30, ensuring that the parsing record takes effect in time.
  • the first query message and the first indication message in this embodiment are DNS format messages for performing domain name resolution between the server 30 and the client in the DNS, and by combining Table 1 and Table 2, by assigning Opcode to the header field part of the first indication message.
  • the value of the field is, for example, any one of 2 to 15.
  • the type of the first indication message is identified by using an Opcode field to indicate whether the first indication message is a message that the record in the query server 30 is updated.
  • the value of the Opcode field is 2
  • the first indication message is the same as the value of the Opcode field of the existing DNS format message (DNS Respone)
  • the first indication is identified when the Opcode field is any one of 3 to 15. Whether the message is "DNS record change query message".
  • the Z field of the header field is still used to transmit the version information of the record in the server 30 to identify whether the record of the server 30 is updated.
  • the Z field of the first query message sent by the client is 001, if the server If the value of the Z field in the first indication message of the feedback is 002, it indicates that the record in the server 30 is updated, and the client needs to update the record carried in the update field part of the first indication message.
  • the update domain part carries only the records before the update, not the records after the update.
  • the record corresponding to the version information in the server 30 is updated by using only the Z field of the header field part in the first indication message, and use the CHCOUNT field identifier of the header field part when the record is updated.
  • the second query message and the second indication message are a DNS Query and a DNS Respone when the domain name is resolved between the client and the server 30.
  • the interaction message is a message sent by the server 30 to the client.
  • the sending module 33 sends a first indication message to the client, where the first indication message includes a first field identifying that the record of the server 30 has been updated and a version identifying the record in which the update occurred.
  • the second field of information causes the client to clear the record in the current cache area corresponding to the version information.
  • the receiving module 31 further receives the query message of the record that is sent by the client, and the processing module 32 controls the sending module 33 to feed back the third indication message including the updated record to the client according to the query message, so that the client according to the third instruction The message stores the updated record in the cache.
  • the first indication message in this embodiment is a DNS format message for performing domain name resolution between the server 30 and the client in the DNS.
  • the server 30 can be identified by using only the Z field of the header field in the first indication message. Whether the record corresponding to the version information is updated, and when the record is updated, the CHCOUNT field of the header field portion is used to identify the number of records in the update domain portion that are updated, and the header field is The part of the Opcode field is the same as the existing one, and the update field part carries only the record before the update occurs, not the record after the update.
  • the type of the first indication message may be identified by using an Opcode field to indicate the first type by assigning a value of an Opcode field of the header field in the first indication message, for example, any one of 2 to 15.
  • the indication message is a message that the record in the query server 30 is updated.
  • the value of the Opcode field is 2
  • the first indication message is the same as the value of the Opcode field of the existing DNS format message (DNS Respone), and the Opcode field is taken.
  • the value is any one of 3 to 15, it is identified whether the first indication message is a "DNS record change query message".
  • the Z field of the header field portion is still used to transfer the version information of the record in the server 30 to thereby identify whether the record of the server 30 has been updated, and the record that is carried in the domain portion only before the update occurs, not the record after the update. .
  • the query message and the third indication message are a DNS Query and a DNS Respone when the domain name is resolved between the client and the server 30.
  • the present invention further provides a client as shown in FIG. 4.
  • the client 40 includes a receiving module 41, a processing module 42 and a storage module 43, and a sending module 44, wherein the receiving module 41 and the sending module
  • the module 44 is configured to receive and send an interaction message between the server and the client 40, where the interaction message includes a field identifying whether the record in the server is updated, and the processing module 42 is configured to receive the interaction message according to the receiving module 41.
  • the field updates the record of the storage module 43.
  • the interaction message includes both the message sent by the client 40 to the server, and the server direction.
  • the information sent by the client 40 specifically:
  • the interaction message is a message sent by the client 40 to the server.
  • the sending module 44 is configured to send a first query message to the server, and the receiving module 41 receives a first indication message fed back by the server, where the first indication message includes a field that identifies whether an update occurs in the server.
  • the control module 42 controls the storage module 43 to clear the current record when the processing module 42 determines that the record of the server is updated according to the first indication message, and controls the sending module 44 to further send a second query message for requesting the updated record to the server. And receiving a second indication message fed back by the server, where the second indication message includes the updated record, and the processing module 42 is configured to control the storage module 43 to store the updated record.
  • the first query message and the first indication message in this embodiment are DNS format messages for performing domain name resolution between the server and the client 40 in the DNS.
  • the Opcode is given to the header field in the first indication message.
  • the value of the field is, for example, any one of 2 to 15, and the type of the first indication message is identified by using an Opcode field to indicate that the first indication message is a message that the record in the query server is updated, where Opcode
  • the first indication message is the same as the value of the Opcode field of the existing DNS format message (DNS Respone)
  • the first indication message is identified when the Opcode field is any one of 3 to 15. Whether it is "DNS record change query message”.
  • the Z field of the header field portion is still used to pass the version information of the record in the server to thereby identify whether the record of the server has been updated, and the update domain portion carries only the record before the update, not the record after the update.
  • the Z field of the header field in the first indication message to identify whether the record corresponding to the version information in the server is updated, and when the record is updated, use the CHCOUNT field of the header field to identify the location.
  • the second query message and the second indication message are a DNS Query and a DNS Respone when the domain name is resolved between the client 40 and the server.
  • the interaction message is a message sent by the server to the client 40.
  • the receiving module 41 receives a first indication message sent by the server, where the first indication message includes a first field that identifies that the record of the server has been updated, and a version that identifies the record that is updated.
  • the second field of the information the processing module 42 controls the storage module 43 to clear the record corresponding to the version information, and controls the sending module 44 to send a query message to the server for requesting the updated record, and the control receiving module 41 receives the server feedback.
  • a third indication message includes the updated record
  • the processing module 42 further controls the storage module 43 to store the updated record, so that the client 40 automatically maintains data synchronization with the server to ensure that the record is resolved. Effective in time.
  • the first indication message in this embodiment is a DNS format message for performing domain name resolution between the server and the client 40 in the DNS.
  • the Z field of the header field in the first indication message may be used to identify the server and the Z field. Whether the record corresponding to the version information is updated, and when the record is updated, the CHCOUNT field of the header field portion is used to identify the number of records in the update domain portion that are updated, and the header field portion is The Opcode field is the same as the existing one, and the update field part carries only the record before the update occurs, not the record after the update.
  • the type of the first indication message may be identified by using an Opcode field to indicate the first type by assigning a value of an Opcode field of the header field in the first indication message, for example, any one of 2 to 15.
  • the indication message is a message indicating whether the record in the server is updated.
  • the value of the Opcode field is 2
  • the first indication message is the same as the value of the Opcode field of the existing DNS format message (DNS Respone)
  • the value of the Opcode field is When it is any one of 3 to 15, it is identified whether the first indication message is a "DNS record change query message".
  • the Z field of the header field portion is still used to pass the version information of the record in the server to thereby identify whether the record of the server has been updated, and the update domain portion carries only the record before the update, not the record after the update.
  • the query message and the third indication message are a DNS Query and a DNS Respone when the domain name is resolved between the client 40 and the server.
  • the respective module structures of the server 30 and the client 40 described above are corresponding to the data synchronization method described in the above embodiments, and thus have the same technical effects.
  • each of the above-mentioned functional modules may or may not be a physical frame, and may be located in one place or on multiple network units, and may be implemented in the form of a software function box. It can also be implemented in the form of hardware, such as the server shown in FIG. 5 and the client shown in FIG. 6.
  • the server includes a receiver 51, a memory 52, a processor 53 and a bus 54, a transmitter 55, a receiver 51, a memory 52, a processor 53, and a transmitter 55 connected via a bus 54, wherein:
  • the receiver 51 and the transmitter 55 are respectively configured to receive and transmit an interaction message between the server and the client, the interaction message carrying a field identifying whether the record in the server is updated.
  • the memory 52 can be implemented as one or more of a computer floppy disk, a USB flash drive, a mobile hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk. , stores applications that are useful for data synchronization.
  • the processor 53 performs the following operations by calling an application stored in the memory 52:
  • the interaction message is a message sent by the client to the server.
  • the control receiver 51 receives the first query message sent by the client, the processor 53 determines whether the record in the server is updated, and controls the sender 55 to feed back the first indication message to the client, where the first indication message includes the identifier server. Records whether an updated field has occurred, causing the client to clear the record of the current cache when the record in the server is updated.
  • the control receiver 51 receives the second query message sent by the client to request the updated record, and the processor 53 controls the sender 55 to provide feedback to the client according to the second query message.
  • the second indication message including the updated record enables the client to store the updated record, thereby automatically maintaining data synchronization with the server, ensuring that the parsing record takes effect in time.
  • the first query message and the first indication message are DNS format messages for performing domain name resolution between the server and the client in the DNS, and are combined with Table 1 and Table 2 to obtain the Opcode field of the header field in the first indication message.
  • the value is, for example, any one of 2 to 15, and the type of the first indication message is identified by using an Opcode field to indicate whether the first indication message is a message that the record in the query server is updated, where the Opcode field takes a value.
  • the first finger is 2
  • the message is the same as the value of the Opcode field of the existing DNS format message (DNS Respone).
  • DNS Respone DNS Respone
  • the Opcode field is in any of 3 to 15, it is identified whether the first indication message is a "DNS record change query message".
  • the Z field of the header field portion is still used to pass the version information of the record in the server to identify whether the server's record has been updated, and the update domain portion carries only the record before the update, not the record after the update.
  • the Z field of the header field in the first indication message to identify whether the record corresponding to the version information in the server is updated, and when the record is updated, use the CHCOUNT field of the header field to identify the location.
  • the second query message and the second indication message are a DNS Query and a DNS Respone when performing domain name resolution between the client and the server.
  • the interaction message is a message sent by the server to the client.
  • the control transmitter 55 sends a first indication message to the client, the first indication message including a first field identifying that the record of the server has been updated and a second field identifying the version information of the record in which the update occurred, so that the client clears the current A record in the cache that corresponds to the version information.
  • the control receiver 51 further receives the query message sent by the client requesting the updated record, and the processor 53 controls the sender 55 to feed back to the client the third indication message including the updated record according to the query message, so that the client according to the third The indication message stores the updated record in the buffer area.
  • the first indication message is a DNS format message for performing domain name resolution between the server and the client in the DNS.
  • the Z field of the header field in the first indication message may be used to identify the version in the server and the version. Whether the record corresponding to the information is updated, and when the record is updated, the CHCOUNT field of the header field portion is used to identify the number of records that are updated in the update domain portion, and the Opcode field of the header field portion is The existing ones are the same, and the update domain part carries only the records before the update occurs, not the records after the update.
  • the type of the first indication message may be identified by using an Opcode field to indicate the first type by assigning a value of an Opcode field of the header field in the first indication message, for example, any one of 2 to 15.
  • the indication message is a message for querying whether the record in the server is updated,
  • the value of the Opcode field is 2
  • the first indication message is the same as the value of the Opcode field of the existing DNS format message (DNS Respone)
  • the first value is determined when the Opcode field is any one of 3 to 15.
  • Indicates whether the message is "DNS record change query message”.
  • the Z field of the header field portion is still used to pass the version information of the record in the server to thereby identify whether the record of the server has been updated, and the update domain portion carries only the record before the update, not the record after the update.
  • the query message and the second indication message are a DNS Query and a DNS Respone when performing domain name resolution between the client and the server.
  • the client includes a receiver 61, a memory 62, a processor 63 and a bus 64, a transmitter 65, a transceiver 61, a memory 62, a processor 63, and a transmitter 65 connected via a bus 64, wherein:
  • the receiver 61 and the transmitter 65 are respectively configured to receive and transmit an interaction message between the server and the client, the interaction message including a field identifying whether the record in the server has been updated.
  • the memory 62 can be implemented as one or more of a computer floppy disk, a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk. , stores applications that are useful for data synchronization.
  • the processor 63 performs the following operations by calling an application stored in the memory 62:
  • the interaction message is a message sent by the client to the server.
  • the control transmitter 65 sends a first query message to the server, and controls the receiver 61 to receive a first indication message fed back by the server, the first indication message including a field identifying whether the update occurs in the server.
  • the control memory 63 clears the current record, and the processor 63 controls the transmitter 65 to further send a second query message for requesting the updated record to the server. And controlling the receiver 61 to receive the second indication message fed back by the server, the second indication message includes the updated record, and the processor 63 is further configured to control the memory 62 to clear the current record and store the updated record.
  • the first query message and the first indication message are DNS format messages for performing domain name resolution between the server and the client in the DNS, and are combined with Table 1 and Table 2 to obtain the Opcode field of the header field in the first indication message.
  • the value for example, is any one of 2 to 15, and the type of the first indication message is identified by using an Opcode field to indicate that the first indication message is a query service.
  • the message in the device is updated.
  • the value of the Opcode field is 2
  • the first indication message is the same as the value of the Opcode field of the existing DNS format message (DNS Respone).
  • DNS Respone DNS Respone
  • the value of the Opcode field is 3 to 15. Whether any of the first indication messages is a "DNS record change query message".
  • the Z field of the header field portion is still used to pass the version information of the record in the server to thereby identify whether the record of the server has been updated, and the update domain portion carries only the record before the update, not the record after the update.
  • the Z field of the header field in the first indication message to identify whether the record corresponding to the version information in the server is updated, and when the record is updated, use the CHCOUNT field of the header field to identify the location.
  • the second query message and the second indication message are a DNS Query and a DNS Respone when performing domain name resolution between the client and the server.
  • the interaction message is a message sent by the server to the client.
  • the processor 63 controls the receiver 61 to receive a first indication message sent by the server, where the first indication message includes a first field identifying that the record of the server has been updated, and a second field identifying the version information of the record in which the update occurs, the processor 63 control memory 62 clears the record currently corresponding to the version information, and controls the sender 65 to send a query message for requesting the updated record to the server, and the third indicator message for controlling the receiver 61 to receive the feedback from the server, the third The indication message includes the updated record, and the processor 63 further controls the memory 62 to store the updated record so that the client automatically maintains data synchronization with the server, ensuring that the resolution record is in effect in time.
  • the first indication message is a DNS format message for performing domain name resolution between the server and the client in the DNS.
  • the Z field of the header field in the first indication message may be used to identify the version in the server and the version. Whether the record corresponding to the information is updated, and when the record is updated, the CHCOUNT field of the header field portion is used to identify the number of records that are updated in the update domain portion, and the Opcode field of the header field portion is The existing ones are the same, and the update domain part carries only the records before the update occurs, not the records after the update.
  • the type of the first indication message is identified by using an Opcode field to indicate that the first indication message is a message that the record in the query server is updated, where the Opcode field has a value of 2
  • the first indication message is the same as the value of the Opcode field of the existing DNS format message (DNS Respone), and the Opcode field is any one of 3 to 15 to identify whether the first indication message is a "DNS record”.
  • the Z field of the header field portion is still used to pass the version information of the record in the server to thereby identify whether the record of the server has been updated, and the update domain portion carries only the record before the update, not the record after the update.
  • the query message and the second indication message are a DNS Query and a DNS Respone when performing domain name resolution between the client and the server.

Abstract

一种DNS的服务器、客户端及数据同步方法,利用服务器与客户端之间的交互消息中的字段标识服务器中的记录是否发生更新,其中交互消息包括客户端向服务器发送的消息以及服务器向客户端发送的信息,在服务器的所述记录发生更新时,客户端根据接收到的交互消息的字段即可更新本地缓存区的记录。该方法能够自动保持客户端与服务器之间的数据同步,确保解析记录及时生效。

Description

DNS的服务器、客户端及数据同步方法 【技术领域】
本发明涉及DNS(Domain Name System,域名系统)技术领域,具体涉及一种DNS的服务器、客户端及两者的数据同步方法。
【背景技术】
DNS可以将域名和IP地址相互映射,使得人们无需记住仅能被计算机直接读取的IP字符串,即可访问互联网。当前,DNS的服务器(Server)与客户端(Client)之间只有查询和被查询的关系,而没有保证两者数据同步的同步机制,所谓数据是指客户端向服务器查询与域名相关的信息资源。
当客户端向服务器发送查询消息以进行域名解析时,服务器将解析后的数据返回给客户端,客户端将数据存储于自身的缓存区(Cache)中,这种数据也称为记录,且该记录在缓存区中均被赋予有一存活时间(Time To Live,TTL)。具体而言,在存活时间内,所述记录可被客户端调用以运行相关业务,而超过存活时间,缓存区中的记录会被老化清理。若在存活时间内服务器中的相关记录已经更新,则客户端调用的是更新之前的记录,这无疑会导致业务运行失败,可见,记录从更新到生效往往需要经过很长时间。当前为了确保记录及时生效,只能通过用户手动对需要更新记录的客户端的缓存区逐一清理,使得客户端可以再次向服务器发送查询消息以获取最新的记录,但操作繁琐且效率低下。
【发明内容】
鉴于此,本发明的多个方面提供一种DNS的服务器、客户端及数据同步方法,能够自动保持客户端与服务器之间的数据同步,确保解析记录及时生效。
第一方面提供一种域名系统的数据同步方法,包括:利用服务器与客户端之间的交互消息中的字段标识服务器中的记录是否发生更新,其中交互消息包括客户端向服务器发送的消息以及服务器向客户端发送的信息;在服务器的记录发生更新时,客户端根据接收到的交互消息的字段更新本 地缓存区的记录。
结合第一方面,在第一种可能的实现方式中,利用服务器与客户端之间的交互消息中的字段标识服务器的记录是否发生更新的步骤包括:客户端向服务器发送第一查询消息;客户端接收服务器在判断服务器中的记录是否发生更新之后向客户端反馈的第一指示消息,第一指示消息包括标识服务器中记录是否发生更新的字段;在服务器的记录发生更新时,客户端根据接收到的交互消息的字段更新本地缓存区的记录的步骤包括:客户端清除当前缓存区的记录;客户端向服务器发送第二查询消息,以向服务器请求更新后的记录;客户端接收服务器反馈的第二指示消息,第二指示消息包括更新后的记录;客户端在接收到第二指示消息后存储更新后的记录。
结合第一方面,在第二种可能的实现方式中,利用服务器与客户端之间的交互消息中的字段标识服务器的记录是否发生更新的步骤包括:客户端接收服务器发送的第一指示消息,所述第一指示消息包括标识服务器的记录已经发生更新的第一字段以及标识发生更新的记录的版本信息的第二字段;客户端根据接收到的交互消息的字段更新本地缓存区的记录的步骤包括:客户端清除当前缓存区中与版本信息对应的记录,并向服务器发送查询消息,以向服务器请求更新后的记录;服务器向客户端反馈第三指示消息,第三指示消息包括更新后的记录;客户端将接收到的更新后的记录存储于缓存区中。
结合第一方面的第一或第二种可能的实现方式,在第三种可能的实现方式中,第一指示消息为具有头域部分Header和更新域部分Changes的DNS消息,头域部分包括Z字段和CHCOUNT字段,Z字段用于标识服务器中的记录是否发生更新,CHCOUNT字段用于标识更新域部分中发生更新的记录的个数,更新域部分用于标识发生更新的客户端的记录。
结合第一方面的第三种可能的实现方式,在第四种可能的实现方式中,头域部分还包括Opcode字段,Opcode字段用于标识第一指示消息的类型,以表示第一指示消息为查询服务器中的记录是否发生更新的消息。
第二方面提供一种DNS的服务器,包括接收模块和发送模块,接收模块和发送模块用于收发服务器与客户端之间的交互消息,交互消息包括接收模块接收的客户端向服务器发送的消息以及服务器的发送模块向客户端 发送的信息,交互消息包括标识服务器中的记录是否发生更新的字段,使得客户端在服务器的记录发生更新时根据接收到的交互消息的字段更新本地缓存区的记录。
结合第二方面,在第一种可能的实现方式中,接收模块用于接收客户端发送的第一查询消息,服务器还包括处理模块,处理模块用于判断服务器中的记录是否发生更新,并控制发送模块向客户端反馈第一指示消息,第一指示消息包括标识服务器中记录是否发生更新的字段,使得客户端在服务器中的记录发生更新时清除当前缓存区的记录;在处理模块判断记录发生更新时,接收模块进一步用于接收客户端发送的用以请求更新后的记录的第二查询消息,处理模块控制发送模块向客户端反馈包括更新后的记录的第二指示消息,使得存储更新后的记录。
结合第二方面,在第二种可能的实现方式中,发送模块用于向客户端发送第一指示消息,第一指示消息包括标识服务器的记录已经发生更新的第一字段以及标识发生更新的记录的版本信息的第二字段,使得客户端清除当前缓存区中与版本信息对应的记录;接收模块进一步用于接收客户端发送的请求更新后的记录的查询消息,处理模块控制发送模块向客户端反馈包括更新后的记录的第三指示消息,使得客户端将更新后的记录存储于缓存区中。
结合第二方面的第一或第二种可能的实现方式,在第三种可能的实现方式中,第一指示消息为具有头域部分和更新域部分的DNS消息,头域部分包括Z字段和CHCOUNT字段,Z字段用于标识服务器中的记录是否发生更新,CHCOUNT字段用于标识更新域部分中发生更新的记录的个数,更新域部分用于标识发生更新的客户端的记录。
结合第二方面的第三种可能的实现方式,在第四种可能的实现方式中,头域部分还包括Opcode字段,Opcode字段用于标识第一指示消息的类型,以表示第一指示消息为查询服务器中的记录是否发生更新的消息。
第三方面提供一种DNS的客户端,包括接收模块、发送模块、处理模块及存储模块,接收模块和发送模块分别用于接收和发送服务器与客户端之间的交互消息,所述交互消息包括客户端的发送模块向服务器发送的消息以及接收模块接收的服务器向客户端发送的信息,交互消息包括标识服 务器中的记录是否发生更新的字段,处理模块用于在服务器的记录发生更新时根据接收模块接收到的交互消息的字段更新存储模块的记录。
结合第三方面,在第一种可能的实现方式中,发送模块用于向服务器发送第一查询消息,接收模块用于接收服务器反馈的第一指示消息,所述第一指示消息包括标识服务器中记录是否发生更新的字段;在处理模块根据第一指示消息判断服务器的记录发生更新时控制存储模块清除当前的记录,并控制发送模块进一步向服务器发送用于请求更新后的记录的第二查询消息,并由接收模块接收服务器反馈的第二指示消息,所述第二指示消息包括更新后的记录,处理模块用于控制存储模块存储更新后的记录。
结合第三方面,在第二种可能的实现方式中,接收模块用于接收服务器发送的第一指示消息,第一指示消息包括标识服务器的记录已经发生更新的第一字段以及标识发生更新的记录的版本信息的第二字段,处理模块用于控制存储模块清除当前与版本信息对应的记录,并控制发送模块向服务器发送用以请求更新后的记录的查询消息,以及控制接收模块接收服务器反馈的第三指示消息,第三指示消息包括更新后的记录,处理模块进一步用于控制存储模块存储更新后的记录。
结合第三方面的第一或第二种可能的实现方式,在第三种可能的实现方式中,第一指示消息为具有头域部分和更新域部分的DNS消息,头域部分包括Z字段和CHCOUNT字段,Z字段用于标识服务器中的记录是否发生更新,CHCOUNT字段用于标识更新域部分中发生更新的记录的个数,更新域部分用于标识发生更新的客户端的记录。
结合第三方面的第三种可能的实现方式,在第四种可能的实现方式中,头域部分还包括Opcode字段,Opcode字段用于标识第一指示消息的类型,以表示第一指示消息为查询服务器中的记录是否发生更新的消息。
第四方面提供一种DNS的服务器,包括接收器和发送器,接收器和发送器用于收发服务器与客户端之间的交互消息,交互消息包括接收器接收的客户端向服务器发送的消息以及服务器的发送器向客户端发送的信息,交互消息包括标识服务器中的记录是否发生更新的字段,使得客户端在服务器的记录发生更新时根据接收到的交互消息的字段更新本地缓存区的记录。
结合第四方面,在第一种可能的实现方式中,接收器用于接收客户端发送的第一查询消息,服务器还包括处理器,处理器用于判断服务器中的记录是否发生更新,并控制发送器向客户端反馈第一指示消息,第一指示消息包括标识服务器中记录是否发生更新的字段,使得客户端在服务器中的记录发生更新时清除当前缓存区的记录;在处理器判断记录发生更新时,接收器进一步用于接收客户端发送的用以请求更新后的记录的第二查询消息,处理器控制发送器向客户端反馈包括更新后的记录的第二指示消息,使得存储更新后的记录。
结合第四方面,在第二种可能的实现方式中,发送器用于向客户端发送第一指示消息,第一指示消息包括标识服务器的记录已经发生更新的第一字段以及标识发生更新的记录的版本信息的第二字段,使得客户端清除当前缓存区中与版本信息对应的记录;接收器进一步用于接收客户端发送的请求更新后的记录的查询消息,处理器控制发送器向客户端反馈包括更新后的记录的第三指示消息,使得客户端将更新后的记录存储于缓存区中。
结合第四方面的第一或第二种可能的实现方式,在第三种可能的实现方式中,第一指示消息为具有头域部分和更新域部分的DNS消息,头域部分包括Z字段和CHCOUNT字段,Z字段用于标识服务器中的记录是否发生更新,CHCOUNT字段用于标识更新域部分中发生更新的记录的个数,更新域部分用于标识发生更新的客户端的记录。
结合第四方面的第三种可能的实现方式,在第四种可能的实现方式中,头域部分还包括Opcode字段,Opcode字段用于标识第一指示消息的类型,以表示第一指示消息为查询服务器中的记录是否发生更新的消息。
第五方面提供一种DNS的客户端,包括接收器、发送器、处理器及存储器,接收器和发送器分别用于接收和发送服务器与客户端之间的交互消息,所述交互消息包括客户端的发送器向服务器发送的消息以及接收器接收的服务器向客户端发送的信息,交互消息包括标识服务器中的记录是否发生更新的字段,处理器用于在服务器的记录发生更新时根据接收器接收到的交互消息的字段更新存储器的记录。
结合第五方面,在第一种可能的实现方式中,发送器用于向服务器发送第一查询消息,接收器用于接收服务器反馈的第一指示消息,所述第一 指示消息包括标识服务器中记录是否发生更新的字段;在处理器根据第一指示消息判断服务器的记录发生更新时控制存储器清除当前的记录,并控制发送器进一步向服务器发送用于请求更新后的记录的第二查询消息,并由接收器接收服务器反馈的第二指示消息,所述第二指示消息包括更新后的记录,处理器用于控制存储器存储更新后的记录。
结合第五方面,在第二种可能的实现方式中,接收器用于接收服务器发送的第一指示消息,第一指示消息包括标识服务器的记录已经发生更新的第一字段以及标识发生更新的记录的版本信息的第二字段,处理器用于控制存储器清除当前与版本信息对应的记录,并控制发送器向服务器发送用以请求更新后的记录的查询消息,以及控制接收器接收服务器反馈的第三指示消息,第三指示消息包括更新后的记录,处理器进一步用于控制存储器存储更新后的记录。
结合第五方面的第一或第二种可能的实现方式,在第三种可能的实现方式中,第一指示消息为具有头域部分和更新域部分的DNS消息,头域部分包括Z字段和CHCOUNT字段,Z字段用于标识服务器中的记录是否发生更新,CHCOUNT字段用于标识更新域部分中发生更新的记录的个数,更新域部分用于标识发生更新的客户端的记录。
结合第五方面的第三种可能的实现方式,在第四种可能的实现方式中,头域部分还包括Opcode字段,Opcode字段用于标识第一指示消息的类型,以表示第一指示消息为查询服务器中的记录是否发生更新的消息。
上述的技术方案中,利用DNS中服务器与客户端之间的交互消息中的字段标识服务器中的记录是否发生更新,客户端接收到服务器发送来的交互消息,并根据交互消息中的字段即可更新本地缓存区的记录,从而能够自动保持客户端与服务器之间的数据同步,确保解析记录及时生效。
【附图说明】
为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作一简单地介绍,显而易见地,下面描述中的附图是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其它的附图。
图1是本发明的数据同步方法一实施例的流程示意图;
图2是本发明的数据同步方法另一实施例的流程示意图;
图3是本发明的服务器一实施例的原理框示意图;
图4是本发明的服务器一实施例的结构示意图;
图5是本发明的客户端一实施例的原理框示意图;
图6是本发明的客户端一实施例的结构示意图。
【具体实施方式】
为使本发明的发明目的、技术方案以及有益效果更加清楚明白,以下参照附图并列举较佳实施例,对本发明作出进一步详细说明。
本发明的一个实施例中,利用DNS中服务器与客户端之间的交互消息中的字段标识服务器中的记录是否发生更新,所述交互消息既可以为客户端向服务器发送的消息也可以为服务器向客户端发送的信息,客户端接收服务器发送来的交互消息,并根据交互消息中的字段更新本地缓存区的记录。
例如,图1是本发明的数据同步方法一实施例的流程示意图。
步骤S11:客户端向服务器发送第一查询消息。
本实施例的第一查询消息为客户端与服务器之间进行域名解析的DNS Query(查询消息)。
步骤S12:服务器判断所述服务器中的记录是否发生更新。
服务器可以根据第一查询消息携带的客户端本地缓存区存储的记录的版本信息,判断服务器中的记录是否发生更新,所述记录的版本信息可以包括所述记录对应的域名以及所述记录被存储的时间,例如,若第一查询消息携带的记录被存储的时间为2月2日11点,服务器在2月2日12点已经更新了该记录对应的域名所对应的数据,则服务器基于该域名对应的数据的更新时间2月2日12点晚于2月2日11点,即可判定服务器中的记录已经发生更新。
若判定所述服务器中的记录未发生更新,则执行步骤S13;若判定所述服务器中的记录发生更新,则执行步骤S14-S18。
步骤S13:服务器不向客户端反馈第一指示消息。
当然,服务器也可以向客户端反馈第一指示消息,但此时第一指示消息包括标识服务器中与所述版本信息对应的记录未发生更新的字段。
步骤S14:服务器向客户端反馈第一指示消息,所述第一指示消息包括标识服务器中与所述版本信息对应的记录已经发生更新的字段。
本实施例的第一指示消息为与DNS Query对应的DNS Respone(应答信息),其实质上可以理解为一种具有如下表1所示的DNS格式消息,但与现有的DNS格式消息仅包括头域部分(Header)、问题域部分(Question)、答案域部分(Answer)、权威域部分(Authority)、附加域部分(Additional)不同的是,本发明实施例中的所述第一指示消息除了包括头域部分(Header)、问题域部分(Question)、答案域部分(Answer)、权威域部分(Authority)、附加域部分(Additional)外,还包括用于标识发生更新的记录的更新域部分(Changes),即用于表示客户端的缓存区中哪些记录发生了更新,也就是说,更新域部分携带的是发生更新之前的记录,而非更新之后的记录。
Header 头域部分
Question 问题域部分
Answer 答案域部分
Authority 权威域部分
Additional 附加域部分
Changes 更新域部分
表1
其中,更新域部分可以采用RFC1035中规定的Question section format(问题部分格式),即包括QNAME字段、QTYPE字段和QCLASS字段,QNAME字段表示客户端所查询的域名,QTYPE字段表示所述域名的类型,QCLASS字段表示查询所使用的网络类别,例如QCLASS取值为1时为Internet。
本实施例的头域部分具有如下表2所示的格式:
Figure PCTCN2015082719-appb-000001
表2
其中,0~15这16位字段的取值构成第一指示消息的ID(IDentity),且所述ID由客户端发送的第一查询消息携带;QR字段表示第一指示消息为应答消息,该字段取值为1;Opcode字段表示第一指示消息的类型,该字段取值为2,表示所述第一指示消息是服务器向客户端发送的应答信息;AA字段表示发送第一指示消息的服务器是否为授权的权威域名服务器,若是,则该字段取值为1;TC字段表示第一指示消息的字段是否超长,如果超过512字节,则该字段取值为1,如果小于等于512字节,则该字段取值为0;RD字段表示服务器是否完成递归查询,并在完成时该字段取值为1,如果服务器未完成递归查询,该字段取值为0;RA字段表示服务器是否支持递归查询,例如RA字段取值为1表示支持递归查询,RA字段取值为0表示不支持递归查询;RCODE字段表示递归查询的结果,该字段取值为0时表示递归查询成功,否则为对应的错误码;QDCOUNT字段表示问题域部分的个数,ANCOUNT字段表示答案域部分的个数、NSCOUNT字段表示权威域部分的个数、ARCOUNT字段表示附加域部分的个数。
现有的DNS格式消息的头域部分未设置CHCOUNT字段,且头域部分的Z字段未被使用,本实施例正是利用所述Z字段标识服务器中的记录是否发生更新,即利用所述Z字段传递服务器中的记录的版本信息,例如客户端发送的第一查询消息的Z字段取值为001,若服务器反馈的第一指示消息中的Z字段取值为002,则表示服务器中的记录发生更新,客户端需要对第一指示消息中的更新域部分所携带的记录进行更新。并在所述记录发生更新时,利用所述CHCOUNT字段标识所述更新域部分中发生更新的记录的个数。
步骤S15:在所述记录发生更新时,客户端清除本地缓存区当前的记录。
步骤S16:客户端向服务器发送第二查询消息,以请求更新后的记录。
步骤S17:服务器向客户端反馈携带有所述更新后的记录的第二指示消息。
步骤S18:客户端存储更新后的记录。
需要指出的是,步骤S16-S18即为域名解析过程,即当客户端向服务器发送DNS查询消息以进行域名解析时,服务器将解析后的数据返回给客户端,客户端将数据存储于自身的缓存区中。也就是说,在清除本地缓存区中的已经老化的记录后,客户端可以根据需要随即或间隔一段时间又或者不向服务器发送所述DNS查询消息。
所述第二查询消息和所述第二指示消息即为客户端与服务器之间进行域名解析时的DNS Query和DNS Respone。进一步结合上述,可知本实施例实质上是在现有DNS格式消息的基础上进行的改进,可认为是通过复用现有DNS格式消息实现解析记录更新的快速知会,从而自动保持客户端与服务器之间的数据同步,确保解析记录及时生效。
再次结合表1和表2,在图1所示实施例的基础上但与之不同的是,本发明其他实施例可以进一步赋予DNS格式消息中头域部分的Opcode字段的取值,例如为2~15中的任一个,利用Opcode字段标识所述第一指示消息的类型,以表示所述第一指示消息为查询服务器中的记录是否发生更新的消息,其中Opcode字段取值为2时所述第一指示消息与现有的DNS格式消息(DNS Respone)的Opcode字段取值相同,Opcode字段取值为3~15中的任一个时标识所述第一指示消息为“DNS记录变更查询消息”,即标识所述第一指示消息为用于查询所述服务器中的记录是否发生更新的消息。此时头域部分的Z字段与前述使用方法相同。
图2是本发明的数据同步方法另一实施例的流程示意图。
步骤S21:服务器向客户端发送第一指示消息,所述第一指示消息包括标识服务器的记录已经发生更新的第一字段及标识发生更新的记录的版本信息的第二字段。
所述第一指示消息为DNS中服务器与客户端之间进行域名解析的DNS格式消息,结合表1和表2,通过赋予DNS格式消息中头域部分的Opcode 字段的取值,例如2~15中的任一个,利用Opcode字段标识所述第一指示消息的类型,以表示所述第一指示消息为查询服务器中的记录是否发生更新的消息,其中Opcode字段取值为2时所述第一指示消息与现有的DNS格式消息(DNS Respone)的Opcode字段取值相同,Opcode字段取值为3~15中的任一个时标识所述第一指示消息是否为“DNS记录变更查询消息”。此时头域部分的Z字段仍被使用以标识服务器中的记录是否发生更新。
步骤S22:客户端清除当前缓存区中与版本信息对应的记录,并向服务器发送查询消息,以向服务器请求更新后的记录。
步骤S23:服务器向客户端反馈携带有更新后的记录的第三指示消息。
步骤S24:客户端将接收到的所述更新后的记录存储于本地缓存区中。
本实施例的服务器在判定记录发生更新时主动告知客户端,从而使得客户端自动保持与服务器之间的数据同步,确保解析记录及时生效。
本发明的其他实施例可以利用DNS格式消息中头域部分的Z字段传递服务器中的记录的版本信息从而标识服务器的记录是否发生更新,例如客户端发送的第一查询消息的Z字段取值为001,若服务器反馈的第一指示消息中的Z字段取值为002,则表示服务器中的记录发生更新,客户端需要对第一指示消息中的更新域部分所携带的记录进行更新,并在记录发生更新时,利用头域部分的CHCOUNT字段标识更新域部分中发生更新的记录的个数,此时头域部分的Opcode字段与现有DNS格式消息的相同,并且所述更新域部分携带的仅仅是发生更新之前的记录,而并非更新之后的记录。
本发明还提供一种如图3所示的服务器,如图3所示,所述服务器30包括接收模块31和处理模块32、发送模块33,收发模块31和发送模块33分别用于接收和发送服务器30与客户端之间的交互消息,所述交互消息携带有标识服务器30中的记录是否发生更新的字段,使得客户端根据接收到的交互消息的字段更新本地缓存区的记录。
所述交互消息既包括客户端向服务器30发送的消息,还包括服务器30向客户端发送的信息,具体而言:
所述交互消息为客户端向服务器30发送的消息时,
接收模块31接收客户端发送的第一查询消息,处理模块32判断服务器30中的记录是否发生更新,并控制发送模块33向客户端反馈第一指示 消息,所述第一指示消息包括标识服务器30中记录是否发生更新的字段,使得客户端在服务器30中的记录发生更新时清除当前缓存区的记录。
在处理模块32判断记录发生更新时,接收模块31进一步接收客户端发送的用以请求更新后的记录的第二查询消息,处理模块32根据所述第二查询消息控制发送模块33向客户端反馈包括更新后的记录的第二指示消息,使得客户端存储更新后的记录,从而自动保持与服务器30之间的数据同步,确保解析记录及时生效。
本实施例的第一查询消息和第一指示消息为DNS中服务器30与客户端之间进行域名解析的DNS格式消息,结合表1和表2,通过赋予第一指示消息中头域部分的Opcode字段的取值,例如为2~15中的任一个,利用Opcode字段标识所述第一指示消息的类型,以表示所述第一指示消息为查询服务器30中的记录是否发生更新的消息,其中Opcode字段取值为2时所述第一指示消息与现有的DNS格式消息(DNS Respone)的Opcode字段取值相同,Opcode字段取值为3~15中的任一个时标识所述第一指示消息是否为“DNS记录变更查询消息”。此时头域部分的Z字段仍被使用以传递服务器30中的记录的版本信息从而标识服务器30的记录是否发生更新,例如客户端发送的第一查询消息的Z字段取值为001,若服务器30反馈的第一指示消息中的Z字段取值为002,则表示服务器30中的记录发生更新,客户端需要对第一指示消息中的更新域部分所携带的记录进行更新。并且更新域部分携带的仅仅发生更新之前的记录,而非更新之后的记录。
当然,还可以仅利用第一指示消息中头域部分的Z字段标识服务器30中与所述版本信息对应的记录是否发生更新,并在所述记录发生更新时,利用头域部分的CHCOUNT字段标识所述更新域部分中发生更新的记录的个数,此时所述头域部分的Opcode字段与现有的相同,并且所述更新域部分携带的仅仅是发生更新之前的记录,而并非更新之后的记录。
所述第二查询消息和所述第二指示消息即为客户端和服务器30之间进行域名解析时的DNS Query和DNS Respone。
所述交互消息为服务器30向客户端发送的消息时,
发送模块33向客户端发送第一指示消息,所述第一指示消息包括标识服务器30的记录已经发生更新的第一字段以及标识发生更新的记录的版本 信息的第二字段,使得客户端清除当前缓存区中与版本信息对应的记录。接收模块31进一步接收客户端发送的请求更新后的记录的查询消息,处理模块32根据查询消息控制发送模块33向客户端反馈包括更新后的记录的第三指示消息,使得客户端根据第三指示消息将更新后的记录存储于缓存区中。
本实施例的第一指示消息为DNS中服务器30与客户端之间进行域名解析的DNS格式消息,结合表1和表2,可以仅利用第一指示消息中头域部分的Z字段标识服务器30中与所述版本信息对应的记录是否发生更新,并在所述记录发生更新时,利用头域部分的CHCOUNT字段标识所述更新域部分中发生更新的记录的个数,此时所述头域部分的Opcode字段与现有的相同,并且所述更新域部分携带的仅仅是发生更新之前的记录,而并非更新之后的记录。
当然,还可以通过赋予第一指示消息中头域部分的Opcode字段的取值,例如为2~15中的任一个,利用Opcode字段标识所述第一指示消息的类型,以表示所述第一指示消息为查询服务器30中的记录是否发生更新的消息,其中Opcode字段取值为2时所述第一指示消息与现有的DNS格式消息(DNS Respone)的Opcode字段取值相同,Opcode字段取值为3~15中的任一个时标识所述第一指示消息是否为“DNS记录变更查询消息”。此时头域部分的Z字段仍被使用以传递服务器30中的记录的版本信息从而标识服务器30的记录是否发生更新,并且更新域部分携带的仅仅发生更新之前的记录,而并非更新之后的记录。
所述查询消息和所述第三指示消息即为客户端和服务器30之间进行域名解析时的DNS Query和DNS Respone。
本发明进一步提供一种如图4所示的客户端,如图4所示,所述客户端40包括接收模块41、处理模块42及存储模块43、发送模块44,其中,接收模块41和发送模块44分别用于接收和发送服务器与客户端40之间的交互消息,所述交互消息包括标识服务器中的记录是否发生更新的字段,处理模块42用于根据接收模块41接收到的交互消息的字段更新存储模块43的记录。
所述交互消息既包括客户端40向服务器发送的消息,还包括服务器向 客户端40发送的信息,具体而言:
所述交互消息为客户端40向服务器发送的消息时,
发送模块44用于向服务器发送第一查询消息,接收模块41接收服务器反馈的第一指示消息,所述第一指示消息包括标识服务器中记录是否发生更新的字段。
其中,在处理模块42根据所述第一指示消息判断服务器的记录发生更新时控制存储模块43清除当前的记录,并控制发送模块44进一步向服务器发送用于请求更新后的记录的第二查询消息,并接收服务器反馈的第二指示消息,所述第二指示消息包括更新后的记录,处理模块42用于控制存储模块43存储更新后的记录。
本实施例的第一查询消息和第一指示消息为DNS中服务器与客户端40之间进行域名解析的DNS格式消息,结合表1和表2,通过赋予第一指示消息中头域部分的Opcode字段的取值,例如为2~15中的任一个,利用Opcode字段标识所述第一指示消息的类型,以表示所述第一指示消息为查询服务器中的记录是否发生更新的消息,其中Opcode字段取值为2时所述第一指示消息与现有的DNS格式消息(DNS Respone)的Opcode字段取值相同,Opcode字段取值为3~15中的任一个时标识所述第一指示消息是否为“DNS记录变更查询消息”。此时头域部分的Z字段仍被使用以传递服务器中的记录的版本信息从而标识服务器的记录是否发生更新,并且更新域部分携带的仅仅发生更新之前的记录,而并非更新之后的记录。
当然,还可以仅利用第一指示消息中头域部分的Z字段标识服务器中与所述版本信息对应的记录是否发生更新,并在所述记录发生更新时,利用头域部分的CHCOUNT字段标识所述更新域部分中发生更新的记录的个数,此时所述头域部分的Opcode字段与现有的相同,并且所述更新域部分携带的仅仅是发生更新之前的记录,而并非更新之后的记录。
所述第二查询消息和所述第二指示消息即为客户端40和服务器之间进行域名解析时的DNS Query和DNS Respone。
所述交互消息为服务器向客户端40发送的消息时,
接收模块41接收服务器发送的第一指示消息,所述第一指示消息包括标识服务器的记录已经发生更新的第一字段以及标识发生更新的记录的版 本信息的第二字段,处理模块42控制存储模块43清除当前与版本信息对应的记录,并控制发送模块44向服务器发送用以请求更新后的记录的查询消息,以及控制接收模块41接收服务器反馈的第三指示消息,所述第三指示消息包括更新后的记录,处理模块42进一步控制存储模块43存储更新后的记录,从而使得客户端40自动保持与服务器之间的数据同步,确保解析记录及时生效。
本实施例的第一指示消息为DNS中服务器与客户端40之间进行域名解析的DNS格式消息,结合表1和表2,可以利用第一指示消息中头域部分的Z字段标识服务器中与所述版本信息对应的记录是否发生更新,并在所述记录发生更新时,利用头域部分的CHCOUNT字段标识所述更新域部分中发生更新的记录的个数,此时所述头域部分的Opcode字段与现有的相同,并且所述更新域部分携带的仅仅是发生更新之前的记录,而并非更新之后的记录。
当然,还可以通过赋予第一指示消息中头域部分的Opcode字段的取值,例如为2~15中的任一个,利用Opcode字段标识所述第一指示消息的类型,以表示所述第一指示消息为查询服务器中的记录是否发生更新的消息,其中Opcode字段取值为2时所述第一指示消息与现有的DNS格式消息(DNS Respone)的Opcode字段取值相同,Opcode字段取值为3~15中的任一个时标识所述第一指示消息是否为“DNS记录变更查询消息”。此时头域部分的Z字段仍被使用以传递服务器中的记录的版本信息从而标识服务器的记录是否发生更新,并且更新域部分携带的仅仅发生更新之前的记录,而并非更新之后的记录。
所述查询消息和所述第三指示消息即为客户端40和服务器之间进行域名解析时的DNS Query和DNS Respone。
在本实施例中,以上所描述的服务器30与客户端40的各个模块结构,对应执行上述各实施例所述的数据同步方法,因此具有与其相同的技术效果。
应该理解到,上述服务器30与客户端40的实施方式仅仅是示意性的,所描述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个模块可以结合或者可以集成到另一个系统中,或一些 特征可以忽略,或不执行。另外,模块相互之间的耦合或通信连接可以是通过一些接口,也可以是电性或其它的形式。上述各个功能模块作为服务器30与客户端40的组成部分,可以是或者也可以不是物理框,既可以位于一个地方,也可以分布到多个网络单元上,既可以采用软件功能框的形式实现,也可以采用硬件的形式实现,例如图5所示的服务器以及图6所示的客户端。
如图5所示,服务器包括接收器51、存储器52、处理器53及总线54、发送器55,接收器51、存储器52、处理器53、发送器55通过总线54连接,其中:
接收器51和发送器55分别用于接收和发送服务器与客户端之间的交互消息,所述交互消息携带有标识服务器中的记录是否发生更新的字段。
存储器52可以实现为计算机的软盘、U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等的一种或多种,存储有用以实现数据同步的应用程序。
处理器53通过调用存储器52中存储的应用程序,执行如下操作:
所述交互消息为客户端向服务器发送的消息时,
控制接收器51接收客户端发送的第一查询消息,处理器53判断服务器中的记录是否发生更新,并控制发送器55向客户端反馈第一指示消息,所述第一指示消息包括标识服务器中记录是否发生更新的字段,使得客户端在服务器中的记录发生更新时清除当前缓存区的记录。
在处理器53判断记录发生更新时,控制接收器51接收客户端发送的用以请求更新后的记录的第二查询消息,处理器53根据所述第二查询消息控制发送器55向客户端反馈包括更新后的记录的第二指示消息,使得客户端存储更新后的记录,从而自动保持与服务器之间的数据同步,确保解析记录及时生效。
其中,第一查询消息和第一指示消息为DNS中服务器与客户端之间进行域名解析的DNS格式消息,结合表1和表2,通过赋予第一指示消息中头域部分的Opcode字段的取值,例如为2~15中的任一个,利用Opcode字段标识所述第一指示消息的类型,以表示所述第一指示消息为查询服务器中的记录是否发生更新的消息,其中Opcode字段取值为2时所述第一指 示消息与现有的DNS格式消息(DNS Respone)的Opcode字段取值相同,Opcode字段取值为3~15中的任一个时标识所述第一指示消息是否为“DNS记录变更查询消息”。此时头域部分的Z字段仍被使用以传递服务器中的记录的版本信息从而标识服务器的记录是否发生更新,并且更新域部分携带的仅仅发生更新之前的记录,而非更新之后的记录。
当然,还可以仅利用第一指示消息中头域部分的Z字段标识服务器中与所述版本信息对应的记录是否发生更新,并在所述记录发生更新时,利用头域部分的CHCOUNT字段标识所述更新域部分中发生更新的记录的个数,此时所述头域部分的Opcode字段与现有的相同,并且所述更新域部分携带的仅仅是发生更新之前的记录,而并非更新之后的记录。
所述第二查询消息和所述第二指示消息即为客户端和服务器之间进行域名解析时的DNS Query和DNS Respone。
所述交互消息为服务器向客户端发送的消息时,
控制发送器55向客户端发送第一指示消息,所述第一指示消息包括标识服务器的记录已经发生更新的第一字段以及标识发生更新的记录的版本信息的第二字段,使得客户端清除当前缓存区中与版本信息对应的记录。控制接收器51进一步接收客户端发送的请求更新后的记录的查询消息,处理器53根据查询消息控制发送器55向客户端反馈包括更新后的记录的第三指示消息,使得客户端根据第三指示消息将更新后的记录存储于缓存区中。
其中,第一指示消息为DNS中服务器与客户端之间进行域名解析的DNS格式消息,结合表1和表2,可以利用第一指示消息中头域部分的Z字段标识服务器中与所述版本信息对应的记录是否发生更新,并在所述记录发生更新时,利用头域部分的CHCOUNT字段标识所述更新域部分中发生更新的记录的个数,此时所述头域部分的Opcode字段与现有的相同,并且所述更新域部分携带的仅仅是发生更新之前的记录,而并非更新之后的记录。
当然,还可以通过赋予第一指示消息中头域部分的Opcode字段的取值,例如为2~15中的任一个,利用Opcode字段标识所述第一指示消息的类型,以表示所述第一指示消息为查询服务器中的记录是否发生更新的消息,其 中Opcode字段取值为2时所述第一指示消息与现有的DNS格式消息(DNS Respone)的Opcode字段取值相同,Opcode字段取值为3~15中的任一个时标识所述第一指示消息是否为“DNS记录变更查询消息”。此时头域部分的Z字段仍被使用以传递服务器中的记录的版本信息从而标识服务器的记录是否发生更新,并且更新域部分携带的仅仅发生更新之前的记录,而并非更新之后的记录。
所述查询消息和所述第二指示消息即为客户端和服务器之间进行域名解析时的DNS Query和DNS Respone。
如图6所示,客户端包括接收器61、存储器62、处理器63及总线64、发送器65,收发器61、存储器62、处理器63、发送器65通过总线64连接,其中:
接收器61和发送器65分别用于接收和发送服务器与客户端之间的交互消息,所述交互消息包括标识服务器中的记录是否发生更新的字段。
存储器62可以实现为计算机的软盘、U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等的一种或多种,存储有用以实现数据同步的应用程序。
处理器63通过调用存储器62中存储的应用程序,执行如下操作:
所述交互消息为客户端向服务器发送的消息时,
控制发送器65向服务器发送第一查询消息,并控制接收器61接收服务器反馈的第一指示消息,所述第一指示消息包括标识服务器中记录是否发生更新的字段。
在处理器63根据所述第一指示消息判断服务器的记录发生更新时控制存储器63清除当前的记录,处理器63控制发送器65进一步向服务器发送用于请求更新后的记录的第二查询消息,并控制接收器61接收服务器反馈的第二指示消息,所述第二指示消息包括更新后的记录,处理器63进一步用于控制存储器62清除当前的记录,并存储更新后的记录。
其中,第一查询消息和第一指示消息为DNS中服务器与客户端之间进行域名解析的DNS格式消息,结合表1和表2,通过赋予第一指示消息中头域部分的Opcode字段的取值,例如为2~15中的任一个,利用Opcode字段标识所述第一指示消息的类型,以表示所述第一指示消息为查询服务 器中的记录是否发生更新的消息,其中Opcode字段取值为2时所述第一指示消息与现有的DNS格式消息(DNS Respone)的Opcode字段取值相同,Opcode字段取值为3~15中的任一个时标识所述第一指示消息是否为“DNS记录变更查询消息”。此时头域部分的Z字段仍被使用以传递服务器中的记录的版本信息从而标识服务器的记录是否发生更新,并且更新域部分携带的仅仅发生更新之前的记录,而并非更新之后的记录。
当然,还可以仅利用第一指示消息中头域部分的Z字段标识服务器中与所述版本信息对应的记录是否发生更新,并在所述记录发生更新时,利用头域部分的CHCOUNT字段标识所述更新域部分中发生更新的记录的个数,此时所述头域部分的Opcode字段与现有的相同,并且所述更新域部分携带的仅仅是发生更新之前的记录,而并非更新之后的记录。
所述第二查询消息和所述第二指示消息即为客户端和服务器之间进行域名解析时的DNS Query和DNS Respone。
所述交互消息为服务器向客户端发送的消息时,
处理器63控制接收器61接收服务器发送的第一指示消息,所述第一指示消息包括标识服务器的记录已经发生更新的第一字段以及标识发生更新的记录的版本信息的第二字段,处理器63控制存储器62清除当前与版本信息对应的记录,并控制发送器65向服务器发送用以请求更新后的记录的查询消息,以及控制接收器61接收服务器反馈的第三指示消息,所述第三指示消息包括更新后的记录,处理器63进一步控制存储器62存储更新后的记录,从而使得客户端自动保持与服务器之间的数据同步,确保解析记录及时生效。
其中,第一指示消息为DNS中服务器与客户端之间进行域名解析的DNS格式消息,结合表1和表2,可以利用第一指示消息中头域部分的Z字段标识服务器中与所述版本信息对应的记录是否发生更新,并在所述记录发生更新时,利用头域部分的CHCOUNT字段标识所述更新域部分中发生更新的记录的个数,此时所述头域部分的Opcode字段与现有的相同,并且所述更新域部分携带的仅仅是发生更新之前的记录,而并非更新之后的记录。
当然,还可以通过赋予第一指示消息中头域部分的Opcode字段的取值, 例如为2~15中的任一个,利用Opcode字段标识所述第一指示消息的类型,以表示所述第一指示消息为查询服务器中的记录是否发生更新的消息,其中Opcode字段取值为2时所述第一指示消息与现有的DNS格式消息(DNS Respone)的Opcode字段取值相同,Opcode字段取值为3~15中的任一个时标识所述第一指示消息是否为“DNS记录变更查询消息”。此时头域部分的Z字段仍被使用以传递服务器中的记录的版本信息从而标识服务器的记录是否发生更新,并且更新域部分携带的仅仅发生更新之前的记录,而并非更新之后的记录。
所述查询消息和所述第二指示消息即为客户端和服务器之间进行域名解析时的DNS Query和DNS Respone。
本领域技术人员可以清楚地了解到,上述服务器与客户端的各个元件的具体工作过程,可参考前述方法实施例中的对应过程,为描述方便和简洁此处不再赘述。各个元件可以单独或集成设置于物理元件中。并且,上述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中,即,本发明实施例可以以软件产品的形式体现出来,其包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。
再次说明,以上所述仅为本发明的实施例,并非因此限制本发明的专利范围,凡是利用说明书及附图内容所作的等效结构或等效流程变换,直接或间接运用在其它相关的技术领域,均同理包括在本发明的专利保护范围内。

Claims (25)

  1. 一种域名系统DNS的数据同步方法,其特征在于,所述方法包括:
    利用服务器与客户端之间的交互消息中的字段标识所述服务器中的记录是否发生更新,其中所述交互消息包括所述客户端向所述服务器发送的消息以及所述服务器向所述客户端发送的信息;
    在所述服务器的所述记录发生更新时,所述客户端根据接收到的所述交互消息的字段更新本地缓存区的记录。
  2. 根据权利要求1所述的方法,其特征在于,所述利用服务器与客户端之间的交互消息中的字段标识所述服务器的记录是否发生更新的步骤包括:
    所述客户端向所述服务器发送第一查询消息;
    所述客户端接收所述服务器在判断所述服务器中的记录是否发生更新后反馈的第一指示消息,所述第一指示消息包括标识所述服务器中记录是否发生更新的所述字段;
    在所述服务器的所述记录发生更新时,所述客户端根据接收到的所述交互消息的字段更新本地缓存区的记录的步骤包括:
    所述客户端清除当前所述缓存区的记录;
    所述客户端向所述服务器发送第二查询消息,以向所述服务器请求更新后的记录;
    所述客户端接收所述服务器反馈的第二指示消息,所述第二指示消息包括所述更新后的记录;
    所述客户端在接收到所述第二指示消息后存储所述更新后的记录。
  3. 根据权利要求1所述的方法,其特征在于,所述利用服务器与客户端之间的交互消息中的字段标识所述服务器的记录是否发生更新的步骤包括:
    所述客户端接收所述服务器发送的第一指示消息,所述第一指示消息包括标识所述服务器的记录已经发生更新的第一字段以及标识发生更新的记录的版本信息的第二字段;
    所述客户端根据接收到的所述交互消息的字段更新本地缓存区的记录 的步骤包括:
    所述客户端清除当前所述缓存区中与所述版本信息对应的记录,并向所述服务器发送查询消息,以向所述服务器请求更新后的记录;
    所述服务器向所述客户端反馈第三指示消息,所述第三指示消息包括所述更新后的记录;
    所述客户端将接收到的所述更新后的记录存储于所述缓存区中。
  4. 根据权利要求2或3所述的方法,其特征在于,所述第一指示消息为具有头域部分Header和更新域部分Changes的DNS消息,所述头域部分包括Z字段和CHCOUNT字段,所述Z字段用于标识所述服务器中的记录是否发生更新,所述CHCOUNT字段用于标识所述更新域部分中所述发生更新的记录的个数,所述更新域部分用于标识发生更新的所述客户端的记录。
  5. 根据权利要求4所述的方法,其特征在于,所述头域部分还包括Opcode字段,所述Opcode字段用于标识所述第一指示消息的类型,以表示所述第一指示消息为查询所述服务器中的记录是否发生更新的消息。
  6. 一种DNS的服务器,其特征在于,所述服务器包括接收模块和发送模块,所述接收模块和所述发送模块分别用于接收和发送所述服务器与客户端之间的交互消息,所述交互消息包括所述接收模块接收的所述客户端向所述服务器发送的消息以及所述服务器的所述发送模块向所述客户端发送的信息,所述交互消息包括标识所述服务器中的记录是否发生更新的字段,使得所述客户端在所述服务器的所述记录发生更新时根据接收到的所述交互消息的字段更新本地缓存区的记录。
  7. 根据权利要求6所述的服务器,其特征在于,所述接收模块用于接收所述客户端发送的第一查询消息,所述服务器还包括处理模块,所述处理模块用于判断所述服务器中的记录是否发生更新,并控制所述发送模块向所述客户端反馈第一指示消息,所述第一指示消息包括标识所述服务器中记录是否发生更新的所述字段,使得所述客户端在所述服务器中的记录发生更新时清除当前所述缓存区的记录;
    在所述处理模块判断所述记录发生更新时,所述接收模块进一步用于接收所述客户端发送的用以请求更新后的记录的第二查询消息,所述处理 模块控制所述发送模块向所述客户端反馈包括所述更新后的记录的第二指示消息,使得所述客户端存储所述更新后的记录。
  8. 根据权利要求6所述的服务器,其特征在于,所述发送模块用于向所述客户端发送第一指示消息,所述第一指示消息包括标识所述服务器的记录已经发生更新的第一字段以及标识发生更新的记录的版本信息的第二字段,使得所述客户端清除当前所述缓存区中与所述版本信息对应的记录;所述接收模块进一步用于接收所述客户端发送的请求更新后的记录的查询消息,所述处理模块控制所述发送模块向所述客户端反馈包括所述更新后的记录的第三指示消息,使得所述客户端将所述更新后的记录存储于所述缓存区中。
  9. 根据权利要求7或8所述的服务器,其特征在于,所述第一指示消息为具有头域部分和更新域部分的DNS消息,所述头域部分包括Z字段和CHCOUNT字段,所述Z字段用于标识所述服务器中的记录是否发生更新,所述CHCOUNT字段用于标识所述更新域部分中所述发生更新的记录的个数,所述更新域部分用于标识发生更新的所述客户端的记录。
  10. 根据权利要求9所述的服务器,其特征在于,所述头域部分还包括Opcode字段,所述Opcode字段用于标识所述第一指示消息的类型,以表示所述第一指示消息为查询所述服务器中的记录是否发生更新的消息。
  11. 一种DNS的客户端,其特征在于,所述客户端包括接收模块、发送模块、处理模块及存储模块,所述接收模块和所述发送模块分别用于接收和发送所述服务器与客户端之间的交互消息,所述交互消息包括所述客户端的所述发送模块向所述服务器发送的消息以及所述接收模块接收的所述服务器向所述客户端发送的信息,所述交互消息包括标识所述服务器中的记录是否发生更新的字段,所述处理模块用于在所述服务器的所述记录发生更新时根据所述接收模块接收到的所述交互消息的字段更新所述存储模块的记录。
  12. 根据权利要求11所述的客户端,其特征在于,所述发送模块用于向所述服务器发送第一查询消息,所述接收模块用于接收所述服务器反馈的第一指示消息,所述第一指示消息包括标识所述服务器中记录是否发生更新的所述字段;
    在所述处理模块根据所述第一指示消息判断所述服务器的所述记录发生更新时控制所述存储模块清除当前的记录,并控制所述发送模块进一步向所述服务器发送用于请求更新后的记录的第二查询消息,并由所述接收模块接收所述服务器反馈的第二指示消息,所述第二指示消息包括所述更新后的记录,所述处理模块用于控制所述存储模块存储所述更新后的记录。
  13. 根据权利要求11所述的客户端,其特征在于,所述接收模块用于接收服务器发送的第一指示消息,所述第一指示消息包括标识所述服务器的记录已经发生更新的第一字段以及标识发生更新的记录的版本信息的第二字段,所述处理模块用于控制所述存储模块清除当前与所述版本信息对应的记录,并控制所述发送模块向所述服务器发送用以请求更新后的记录的查询消息,以及控制所述接收模块接收所述服务器反馈的第三指示消息,所述第三指示消息包括所述更新后的记录,所述处理模块进一步用于控制所述存储模块存储所述更新后的记录。
  14. 根据权利要求12或13所述的客户端,其特征在于,所述第一指示消息为具有头域部分和更新域部分的DNS消息,所述头域部分包括Z字段和CHCOUNT字段,所述Z字段用于标识所述服务器中的记录是否发生更新,所述CHCOUNT字段用于标识所述更新域部分中所述发生更新的记录的个数,所述更新域部分用于标识发生更新的所述客户端的记录。
  15. 根据权利要求14所述的客户端,其特征在于,所述头域部分还包括Opcode字段,所述Opcode字段用于标识所述第一指示消息的类型,以表示所述第一指示消息为查询所述服务器中的记录是否发生更新的消息。
  16. 一种DNS的服务器,其特征在于,所述服务器包括接收器和发送器,所述接收器和所述发送器分别用于接收和发送所述服务器与客户端之间的交互消息,所述交互消息包括所述接收器接收的所述客户端向所述服务器发送的消息以及所述服务器的所述发送器向所述客户端发送的信息,所述交互消息包括标识所述服务器中的记录是否发生更新的字段,使得所述客户端在所述服务器的所述记录发生更新时根据接收到的所述交互消息的字段更新本地缓存区的记录。
  17. 根据权利要求16所述的服务器,其特征在于,所述接收器用于接收所述客户端发送的第一查询消息,所述服务器还包括处理器,所述处理 器用于判断所述服务器中的记录是否发生更新,并控制所述发送器向所述客户端反馈第一指示消息,所述第一指示消息包括标识所述服务器中记录是否发生更新的所述字段,使得所述客户端在所述服务器中的记录发生更新时清除当前所述缓存区的记录;
    在所述处理器判断所述记录发生更新时,所述接收器进一步用于接收所述客户端发送的用以请求更新后的记录的第二查询消息,所述处理器控制所述发送器向所述客户端反馈包括所述更新后的记录的第二指示消息,使得所述客户端存储所述更新后的记录。
  18. 根据权利要求16所述的服务器,其特征在于,所述发送器用于向所述客户端发送第一指示消息,所述第一指示消息包括标识所述服务器的记录已经发生更新的第一字段以及标识发生更新的记录的版本信息的第二字段,使得所述客户端清除当前所述缓存区中与所述版本信息对应的记录;所述接收器进一步用于接收所述客户端发送的请求更新后的记录的查询消息,所述处理器控制所述发送器向所述客户端反馈包括所述更新后的记录的第三指示消息,使得所述客户端将所述更新后的记录存储于所述缓存区中。
  19. 根据权利要求17或18所述的服务器,其特征在于,所述第一指示消息为具有头域部分和更新域部分的DNS消息,所述头域部分包括Z字段和CHCOUNT字段,所述Z字段用于标识所述服务器中的记录是否发生更新,所述CHCOUNT字段用于标识所述更新域部分中所述发生更新的记录的个数,所述更新域部分用于标识发生更新的所述客户端的记录。
  20. 根据权利要求19所述的服务器,其特征在于,所述头域部分还包括Opcode字段,所述Opcode字段用于标识所述第一指示消息的类型,以表示所述第一指示消息为查询所述服务器中的记录是否发生更新的消息。
  21. 一种DNS的客户端,其特征在于,所述客户端包括接收器、发送器、处理器及存储器,所述接收器和所述发送器分别用于接收和发送所述服务器与客户端之间的交互消息,所述交互消息包括所述客户端的所述发送器向所述服务器发送的消息以及所述接收器接收的所述服务器向所述客户端发送的信息,所述交互消息包括标识所述服务器中的记录是否发生更新的字段,所述处理器用于在所述服务器的所述记录发生更新时根据所述 接收器接收到的所述交互消息的字段更新所述存储器的记录。
  22. 根据权利要求21所述的客户端,其特征在于,所述发送器用于向所述服务器发送第一查询消息,所述接收器用于接收所述服务器反馈的第一指示消息,所述第一指示消息包括标识所述服务器中记录是否发生更新的所述字段;
    在所述处理器根据所述第一指示消息判断所述服务器的所述记录发生更新时控制所述存储器清除当前的记录,并控制所述发送器进一步向所述服务器发送用于请求更新后的记录的第二查询消息,并由所述接收器接收所述服务器反馈的第二指示消息,所述第二指示消息包括所述更新后的记录,所述处理器用于控制所述存储器存储所述更新后的记录。
  23. 根据权利要求21所述的客户端,其特征在于,所述接收器用于接收服务器发送的第一指示消息,所述第一指示消息包括标识所述服务器的记录已经发生更新的第一字段以及标识发生更新的记录的版本信息的第二字段,所述处理器用于控制所述存储器清除当前与所述版本信息对应的记录,并控制所述发送器向所述服务器发送用以请求更新后的记录的查询消息,以及控制所述接收器接收所述服务器反馈的第三指示消息,所述第三指示消息包括所述更新后的记录,所述处理器进一步用于控制所述存储器存储所述更新后的记录。
  24. 根据权利要求22或23所述的客户端,其特征在于,所述第一指示消息为具有头域部分和更新域部分的DNS消息,所述头域部分包括Z字段和CHCOUNT字段,所述Z字段用于标识所述服务器中的记录是否发生更新,所述CHCOUNT字段用于标识所述更新域部分中所述发生更新的记录的个数,所述更新域部分用于标识发生更新的所述客户端的记录。
  25. 根据权利要求24所述的客户端,其特征在于,所述头域部分还包括Opcode字段,所述Opcode字段用于标识所述第一指示消息的类型,以表示所述第一指示消息为查询所述服务器中的记录是否发生更新的消息。
PCT/CN2015/082719 2015-06-30 2015-06-30 Dns的服务器、客户端及数据同步方法 WO2017000144A1 (zh)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2015/082719 WO2017000144A1 (zh) 2015-06-30 2015-06-30 Dns的服务器、客户端及数据同步方法
CN201580028567.2A CN106464745B (zh) 2015-06-30 2015-06-30 Dns的服务器、客户端及数据同步方法

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2015/082719 WO2017000144A1 (zh) 2015-06-30 2015-06-30 Dns的服务器、客户端及数据同步方法

Publications (1)

Publication Number Publication Date
WO2017000144A1 true WO2017000144A1 (zh) 2017-01-05

Family

ID=57607470

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/082719 WO2017000144A1 (zh) 2015-06-30 2015-06-30 Dns的服务器、客户端及数据同步方法

Country Status (2)

Country Link
CN (1) CN106464745B (zh)
WO (1) WO2017000144A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110855466A (zh) * 2018-12-24 2020-02-28 互联网域名系统北京市工程研究中心有限公司 一种dns服务器向客户端主动推送更新的方法
CN114124888A (zh) * 2020-08-25 2022-03-01 中国移动通信有限公司研究院 一种域名解析方法及装置

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108494859B (zh) * 2018-03-28 2020-07-14 烽火通信科技股份有限公司 网络数据的同步方法及系统
CN109547585A (zh) * 2019-01-14 2019-03-29 中国雄安集团数字城市科技有限公司 一种基于边缘计算云的快速切换的方法
CN110647279A (zh) * 2019-10-09 2020-01-03 贵州天霓物联技术有限公司 物品存储箱内物品的管理方法、系统、装置、设备及介质
CN111885212B (zh) * 2020-06-03 2023-05-30 山东伏羲智库互联网研究院 域名存储方法及装置
CN113163023B (zh) * 2021-02-26 2023-02-21 北京车和家信息技术有限公司 一种域名管理方法、装置、介质和电子设备

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1805450A (zh) * 2005-01-10 2006-07-19 华为技术有限公司 在域名系统dns机制中实现服务器与客户端数据同步的方法
CN102984286A (zh) * 2012-11-14 2013-03-20 上海牙木通讯技术有限公司 一种dns服务器的缓存更新方法、装置及系统
WO2014184711A2 (en) * 2013-05-13 2014-11-20 Yandex Europe Ag Method of and system for providing a client device with an automatic update of an ip address associated with a domain name

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6769031B1 (en) * 2000-09-29 2004-07-27 Interland, Inc. Dynamically incorporating updates to active configuration information
US8438240B2 (en) * 2011-09-27 2013-05-07 Cloudflare, Inc. Distributing transmission of requests across multiple IP addresses of a proxy server in a cloud-based proxy service
US20140059071A1 (en) * 2012-01-11 2014-02-27 Saguna Networks Ltd. Methods, circuits, devices, systems and associated computer executable code for providing domain name resolution

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1805450A (zh) * 2005-01-10 2006-07-19 华为技术有限公司 在域名系统dns机制中实现服务器与客户端数据同步的方法
CN102984286A (zh) * 2012-11-14 2013-03-20 上海牙木通讯技术有限公司 一种dns服务器的缓存更新方法、装置及系统
WO2014184711A2 (en) * 2013-05-13 2014-11-20 Yandex Europe Ag Method of and system for providing a client device with an automatic update of an ip address associated with a domain name

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110855466A (zh) * 2018-12-24 2020-02-28 互联网域名系统北京市工程研究中心有限公司 一种dns服务器向客户端主动推送更新的方法
CN114124888A (zh) * 2020-08-25 2022-03-01 中国移动通信有限公司研究院 一种域名解析方法及装置

Also Published As

Publication number Publication date
CN106464745B (zh) 2019-11-29
CN106464745A (zh) 2017-02-22

Similar Documents

Publication Publication Date Title
WO2017000144A1 (zh) Dns的服务器、客户端及数据同步方法
CN108737515B (zh) 在联网环境中请求路由选择
CN102769529B (zh) Dnssec签名服务器
US8086713B2 (en) Determining a subscriber device has failed gracelessly without issuing a DHCP release message and automatically releasing resources reserved for the subscriber device within a broadband network upon determining that another subscriber device requesting the reservation of a network address has the same context information as the failed subscriber device
EP1838071B1 (en) A method for implementing the data synchronization of the server and the client side in the mechanism of the domain name system
CN101375566B (zh) 利用动态dns的域名系统和动态dns服务器全局地址管理方法
RU2008106250A (ru) Хранение и разрешение в dns филиала
US10432581B2 (en) Network identification as a service
EP2930911B1 (en) Method and apparatus for controlling sending of heartbeat signal
WO2018214853A1 (zh) 一种减小dns报文长度的方法、装置、介质及设备
CN108494755B (zh) 一种传输应用程序编程接口api请求的方法及装置
US20150134848A1 (en) Alias resource record sets
EP2928117A1 (en) System and method for device registration and discovery in content-centric networks
BRPI0812140B1 (pt) Método para identificar um serviço, porta de protocolo de aplicativo e sistema de processamento de serviço
CN103581361A (zh) 一种域名解析代理方法、设备及系统
US10122630B1 (en) Methods for network traffic presteering and devices thereof
EP3389240A1 (en) Method and system for processing cache cluster service
CN108337280B (zh) 一种资源更新方法及装置
EP3288242B1 (en) Domain name system accessing method and device
KR101645222B1 (ko) 어드밴스드 도메인 네임 시스템 및 운용 방법
JP6571737B2 (ja) Dnsサーバ装置、方法、及びプログラム
JP3938145B2 (ja) 電子メール代理装置およびプログラム
JP6868066B2 (ja) 認証システム、認証方法およびプログラム
JP2017083945A (ja) 認証システム、認証方法およびプログラム
JP2017034637A (ja) 権威dnsサーバ装置、dnsクエリ処理方法およびdnsクエリ処理プログラム

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15896675

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15896675

Country of ref document: EP

Kind code of ref document: A1