CN-116980385-B - Data processing method, device, equipment and computer readable storage medium
Abstract
The invention discloses a data processing method, a device, equipment and a computer readable storage medium, wherein the method comprises the steps of determining whether a overtime target overtime device exists in a first overtime device corresponding to a first DNS record of a database, deleting the target overtime device if the overtime target overtime device exists, and deleting a second DNS record corresponding to the target overtime device and the current system time corresponding to the second DNS record in the database. According to the method and the device for deleting the expired DNS records, the problem that the corresponding DNS records still exist in the DNS system when a certain service is abnormal can be avoided, and the user experience is improved.
Inventors
- ZHAO YUTAO
- HU PENG
- ZHANG YATING
- WANG YIFENG
- Zhou Leizhen
- ZHOU CHUNFENG
- BIAN ZHENG
Assignees
- 中国移动通信集团浙江有限公司
- 中国移动通信集团有限公司
Dates
- Publication Date
- 20260505
- Application Date
- 20220424
Claims (9)
- 1. A data processing method, applied to a domain name system DNS authoritative server, comprising the steps of: determining whether a target timeout device with timeout exists in a first timeout device corresponding to a first DNS record of a database; If a overtime target overtime exists, deleting the target overtime, and deleting a second DNS record corresponding to the target overtime and the current system time corresponding to the second DNS record in the database; the data processing method further comprises the following steps: when a registration request of a third DNS record is received, a first record type corresponding to the third DNS record is obtained; If the first record type is matched with a preset record type, acquiring a first expiration value corresponding to an expiration field in the third DNS record; And if the first expiration value meets a preset condition, starting a second timeout device corresponding to the third DNS record based on the first life time in the third DNS record, and storing the current system time and the third DNS record in a database in an associated mode.
- 2. The data processing method according to claim 1, wherein the data processing method further comprises: when a query request of a DNS record is received, acquiring a query domain name and a second record type corresponding to the query request; If the first target DNS record with the same name as the query domain name and the same type as the second record does not exist in the database, determining whether the second target DNS record exists in the database or not based on the query domain name, wherein the second record type of the second target DNS record is a preset record type matched with the second record type; and if the second target DNS record exists, feeding back a third target DNS record corresponding to the second target DNS record.
- 3. The data processing method of claim 2, wherein the step of feeding back a third target DNS record corresponding to the second target DNS record if the second target DNS record exists includes: acquiring a second expiration value corresponding to an expiration field in the second target DNS record; if the second expiration value meets a preset condition, acquiring a second survival time in the second target DNS record; And determining a third target DNS record corresponding to the second target DNS record based on the second life time, and feeding back the third target DNS record.
- 4. The data processing method of claim 3, wherein the steps of determining a third target DNS record corresponding to the second target DNS record based on the second lifetime, and feeding back the third target DNS record include: Determining whether the second target DNS record is overtime or not based on the second survival time, the current system time corresponding to the second target DNS record and the current time; If the second target DNS record is not overtime, determining a target survival time based on the second survival time, the current system time corresponding to the second target DNS record and the current time; updating the second target DNS record based on the target lifetime and the second record type to obtain a fourth target DNS record; And deleting an expiration field in the fourth target DNS record, obtaining the third target DNS record, and feeding back the third target DNS record.
- 5. A data processing method according to claim 3, wherein after the step of obtaining a second expiration value corresponding to an expiration field in the second target DNS record, the data processing method further comprises: if the second expiration value does not meet the preset condition, updating the second target DNS record based on the second record type to obtain a fifth target DNS record; deleting an expiration field in the fifth target DNS record, obtaining a sixth target DNS record, and feeding back the sixth target DNS record.
- 6. The data processing method according to any one of claims 1 to 5, characterized in that the data processing method further comprises: And if the first record type is not matched with the preset record type or the first expiration value does not meet the preset condition, storing the third DNS record to the database.
- 7. A data processing apparatus for application to a domain name system, DNS, authoritative server, the data processing apparatus comprising: the determining module is used for determining whether a overtime target overtime device exists in a first overtime device corresponding to the first DNS record of the database; The deleting module is used for deleting the target timeout device if the target timeout device is overtime, and deleting a second DNS record corresponding to the target timeout device and the current system time corresponding to the second DNS record in the database; the data processing apparatus is further configured to: when a registration request of a third DNS record is received, a first record type corresponding to the third DNS record is obtained; If the first record type is matched with a preset record type, acquiring a first expiration value corresponding to an expiration field in the third DNS record; And if the first expiration value meets a preset condition, starting a second timeout device corresponding to the third DNS record based on the first life time in the third DNS record, and storing the current system time and the third DNS record in a database in an associated mode.
- 8. A data processing device comprising a memory, a processor and a data processing program stored on the memory and executable on the processor, the data processing program when executed by the processor implementing the steps of the data processing method according to any one of claims 1 to 6.
- 9. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a data processing program which, when executed by a processor, implements the steps of the data processing method according to any of claims 1 to 6.
Description
Data processing method, device, equipment and computer readable storage medium Technical Field The present invention relates to the field of data processing technologies, and in particular, to a data processing method, apparatus, device, and computer readable storage medium. Background DNS (Domain NAME SYSTEM ) is largely used in service discovery of various distributed systems. In a system using DNS as service discovery, records such as A, AAAA, PTR, SRV are generally registered for each service, and the technology is widely applied in the internet through DNS for other service calls. In the conventional DNS service discovery technology, when DNS servers in various places receive a resolution request, the resolution request is sent to a DNS server specified by a domain name, so as to obtain a resolution record. After obtaining a resolution record, the local DNS server will store the record for a period of time during which if a resolution request for the same domain name is received again, the DNS server will return the resolution record directly to the client without having to make a recursive query again. In the related art, updating of DNS records is performed by means of periodic registration of services, and when a certain service is abnormal or abnormally terminated, the corresponding DNS record still exists in the DNS system and does not disappear with the termination of the service. Disclosure of Invention The invention mainly aims to provide a data processing method, a device, equipment and a computer readable storage medium, which aim to solve the technical problem that when a service is abnormal or abnormally terminated, a corresponding DNS record still exists in a DNS system. In order to achieve the above object, the present invention provides a data processing method, which is applied to a DNS authoritative server, and the data processing method includes the following steps: determining whether a target timeout device with timeout exists in a first timeout device corresponding to a first DNS record of a database; And if the overtime target timeout device exists, deleting the target timeout device, and deleting a second DNS record corresponding to the target timeout device and the current system time corresponding to the second DNS record in the database. Further, the data processing method further comprises: when a registration request of a third DNS record is received, a first record type corresponding to the third DNS record is obtained; If the first record type is matched with a preset record type, acquiring a first expiration value corresponding to an expiration field in the third DNS record; If the first expiration value meets a preset condition, starting a second timeout device corresponding to the third DNS record based on the first life time in the third DNS record; And storing the current system time and the third DNS record in a database in an associated mode. Further, the data processing method further comprises: when a query request of a DNS record is received, acquiring a query domain name and a second record type corresponding to the query request; If the first target DNS record with the same name as the query domain name and the same type as the second record does not exist in the database, determining whether the second target DNS record exists in the database or not based on the query domain name, wherein the second record type of the second target DNS record is a preset record type matched with the second record type; and if the second target DNS record exists, feeding back a third target DNS record corresponding to the second target DNS record. Further, the step of feeding back a third target DNS record corresponding to the second target DNS record if the second target DNS record exists includes: acquiring a second expiration value corresponding to an expiration field in the second target DNS record; if the second expiration value meets a preset condition, acquiring a second survival time in the second target DNS record; And determining a third target DNS record corresponding to the second target DNS record based on the second life time, and feeding back the third target DNS record. Further, the step of determining a third target DNS record corresponding to the second target DNS record based on the second lifetime, and feeding back the third target DNS record includes: Determining whether the second target DNS record is overtime or not based on the second survival time, the current system time corresponding to the second target DNS record and the current time; If the second target DNS record is not overtime, determining a target survival time based on the second survival time, the current system time corresponding to the second target DNS record and the current time; updating the second target DNS record based on the target lifetime and the second record type to obtain a fourth target DNS record; And deleting an expiration field in the fourth target DNS record, obtaining the