WO2020024445A1 - Data storage method and apparatus, computer device, and computer storage medium - Google Patents

Data storage method and apparatus, computer device, and computer storage medium Download PDF

Info

Publication number
WO2020024445A1
WO2020024445A1 PCT/CN2018/111119 CN2018111119W WO2020024445A1 WO 2020024445 A1 WO2020024445 A1 WO 2020024445A1 CN 2018111119 W CN2018111119 W CN 2018111119W WO 2020024445 A1 WO2020024445 A1 WO 2020024445A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
storage node
storage
distance
query
Prior art date
Application number
PCT/CN2018/111119
Other languages
French (fr)
Chinese (zh)
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 平安科技(深圳)有限公司
Publication of WO2020024445A1 publication Critical patent/WO2020024445A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1448Management of the data involved in backup or backup restore

Definitions

  • the present application relates to the field of Internet technologies, and in particular, to a data storage method, device, computer device, and computer storage medium.
  • the traditional data storage method is usually disk storage. Users store the data that needs to be stored on the disk so that the data can be viewed anytime, anywhere.
  • traditional disks have become increasingly difficult to meet the storage needs of users based on massive data in terms of capacity, performance, and bandwidth. Therefore, data storage systems supported by cloud platforms Came into being.
  • a data center is deployed in the data storage system. Users can upload the data to be stored to the data center, and the data center stores the data to be stored.
  • a data center is provided with a storage cluster for storing data.
  • the data center When a user uploads data to be stored to a data storage system, the data center receives the data to be stored, and the data center receives the data to be stored. Data is added to the storage cluster for storage.
  • the related technology has at least the following problems: When the data center performs data storage, all the data to be stored are stored in the same storage cluster, so that the storage cluster stores Massive data, and then when receiving a user's data query request, data query needs to be performed in the massive data, and the data that the user needs to query cannot be obtained quickly, resulting in a long time consuming query data and poor intelligence.
  • this application provides a data storage method, device, computer equipment, and computer storage medium.
  • the main purpose is to solve the need to query data in a large amount of data when receiving a data query request from a user. Obtaining data that users need to query results in a longer time and poor intelligence.
  • a data storage method includes: receiving a data storage instruction of a user, where the data storage instruction includes at least data to be stored and a terminal identifier of a terminal of the user; The terminal identification locates the terminal of the user, and obtains the first physical location of the user; determines at least one storage node according to the first physical location, and determines the at least one storage node and the first physical location At least one first distance between them, the at least one storage node is deployed in a storage resource pool indicated by the first physical location; extracting a target distance from the at least one first distance, and determining a target distance indicated by the target distance A target storage node, where the target distance is a first distance among the at least one first distance that meets a first distance criterion; obtaining the data to be stored in the data storage instruction, and storing the data to be stored in the The target storage node is described.
  • a data storage device includes a first receiving module configured to receive a user's data storage instruction.
  • the data storage instruction includes at least data to be stored and a terminal of the user.
  • a first distance determination module configured to determine based on the first physical location At least one storage node and determining at least a first distance between the at least one storage node and the first physical location, the at least one storage node being deployed in a storage resource pool indicated by the first physical location;
  • a first node determining module configured to extract a target distance from the at least one first distance, and determine a target storage node indicated by the target distance, where the target distance satisfies a first distance criterion among the at least one first distance A first distance;
  • a first storage module configured to obtain the data to be stored in the data storage instruction, To be stored in the data storage to the target storage no
  • a computer device including a memory and a processor, where the computer-readable instructions are stored in the memory, and the processor implements the computer-readable instructions to implement the first section.
  • the steps of the method there is provided a computer non-volatile readable storage medium having computer-readable instructions stored thereon, characterized in that the computer-readable instructions implement the first aspect when executed by a processor. The steps of the method.
  • Physical location determine the target storage node closest to the physical location to store the user's data to be stored, so that the data stored by users in different locations is distributed, and the storage data of all users is not stored in a storage cluster.
  • the data that the user needs to query can be quickly obtained, the time taken to query the data is shortened, and the intelligence is better.
  • FIG. 1 shows a schematic flowchart of a data storage method provided by an embodiment of the present application
  • FIG. 2A shows a schematic structure diagram of a data storage system provided by an embodiment of the present application
  • FIG. 2B shows the present application
  • FIG. 2C shows a schematic flow chart of a data storage method provided by an embodiment of the present application
  • FIG. 1 shows a schematic flowchart of a data storage method provided by an embodiment of the present application
  • FIG. 2A shows a schematic structure diagram of a data storage system provided by an embodiment of the present application
  • FIG. 2B shows the present application
  • FIG. 2C shows a schematic flow chart of a data storage method provided by an embodiment of the present application
  • FIG. 1 shows a schematic flowchart of a data storage method provided by an embodiment of the present application
  • FIG. 2A shows a schematic structure diagram of a data storage system provided by an embodiment of the
  • FIG. 2D shows a schematic flow chart of a data storage method provided by an embodiment of the present application
  • FIG. 3A shows a schematic structural diagram of a data storage device provided by an embodiment of the present application
  • FIG. 3B shows a schematic structural diagram of a data storage device provided by an embodiment of the present application
  • FIG. 3C shows a A schematic diagram of a data storage device structure
  • FIG. 3D shows a schematic diagram of a data storage device structure provided in an embodiment of the present application
  • FIG. 3E shows a schematic diagram of a data storage device structure provided in an embodiment of the application
  • FIG. 3G shows the structure of a data storage device provided by an embodiment of the present application Intentions.
  • An embodiment of the present application provides a data storage method. As shown in FIG. 1, the method includes: 101. Receive a user's data storage instruction.
  • the data storage instruction includes at least data to be stored and a terminal identifier of a user's terminal. For the specific process, refer to step 203 in the following embodiment. 102.
  • the user's terminal is located based on the terminal identifier to obtain the first physical location of the user.
  • step 203 in the following embodiments.
  • 103 Determine at least one storage node according to the first physical location, determine at least a first distance between the at least one storage node and the first physical location, and deploy at least one storage node. In the storage resource pool indicated by the first physical location.
  • step 204 in the following embodiments.
  • 104 Extract the target distance from at least one first distance, and determine the target storage node indicated by the target distance.
  • the target distance is the first of the at least one first distance that meets the first distance criterion. distance.
  • step 105 For the specific process, refer to step 205 in the following embodiment. 105.
  • the data storage method can determine the target storage node closest to the physical location to store the user's to-be-stored data according to the physical location of the data requested by the user, so that the data stored by users in different locations can achieve distributed storage.
  • the storage data of all users will not be stored in a storage cluster, so that when the user's data query request is received, the data that the user needs to query can be quickly obtained, the time consumed for querying the data is shortened, and the intelligence is better.
  • an endpoint and a storage resource pool are deployed in a plurality of regions in a data storage system.
  • Endpoint represents the directory system when the user's terminal is connected to the storage resource pool; the storage resource pool is used to store the data uploaded by the user.
  • the storage resource pool includes at least one storage node, and the storage of each region's storage resource pool. They are all highly available saves, and even if a storage node in the storage resource pool fails, the data stored in the storage node will not be lost.
  • the storage resource pool in each region is connected to the resource synchronization channel, and the resource synchronization channel is used to synchronize the data in a certain region from the storage resource pool in the current region to the storage resource pool in another region.
  • the embodiment of the present application provides a data storage method, which can quickly obtain the data that a user needs to query, shorten the time required for querying the data, and have better intelligence. As shown in FIG. 2B, the method includes:
  • each storage resource pool in the multiple storage resource pools includes at least one storage node.
  • the preset data channel is at least a public network channel or an internal network channel.
  • the public network channel may specifically be a VPN (Virtual Private Network (Virtual Private Network) channel.
  • At least one storage node may use a preset data channel of the area for data connection, thereby ensuring synchronization, backup, and other operations on data stored in the storage node.
  • Rate data connections between the storage resource pool and other storage resource pools and generate a rating result.
  • a storage resource pool establishes a data connection with another storage resource pool
  • a public network channel or an internal network channel may be used for connection, and the security coefficient of the internal network channel is higher than that of the public network channel. Therefore, after the data connection between the storage resource pool and other storage resource pools is successfully established, the data connection between the storage resource pool and other storage resource pools can be rated to generate a rating result, so that synchronization can be determined later based on the rating results.
  • the most secure storage node is synchronized, and users can also be reminded of the security of data synchronization.
  • the generated rating result is three levels, which can be specifically expressed as level C, which indicates that the storage resource pool in this area is different from the storage resource pools in other areas. There is only a public network channel between them, and the risk of synchronization is high; if the data connection between the storage resource pool and other storage resource pools is an internal network channel, the generated rating result is a second-level, which can be specifically expressed as a B-level, indicating the area's The storage resource pool and the storage resource pools in other regions only have internal network channels, and the risk of synchronization is low.
  • the generated rating result is Level 1, which can be specifically expressed as level A, indicating that the storage resource pools in this region and the storage resource pools in other regions have two channels, the internal network channel and the public network channel.
  • the synchronization risk is the lowest, and it will take precedence when synchronizing data. Select the intranet channel for data synchronization.
  • the terminal identification is extracted from the data storage instruction, and the user's terminal is located based on the terminal identification to obtain the first physical location of the user.
  • the data storage instruction includes at least data to be stored and a terminal identifier of a user's terminal.
  • the server provided by the data storage system can provide users with data storage services in the form of clients. Data storage portals are provided in the clients, and users can download the clients in the terminals they hold; further, in order to ensure that users can be accurate in the future
  • the client can provide a registration service for the user, and assign a registration ID to each registered user, and use this registration ID as the terminal ID.
  • the data storage system determines that the data storage instruction is received to obtain the terminal identification of the terminal held by the user, which may specifically be the mobile phone number of the terminal held by the user and the user's registration identification. After the terminal identifier of the terminal is obtained, the terminal can be located according to the terminal identifier, and then the first physical location of the terminal is obtained.
  • the terminal may be positioned by using GPRS (General Packet Radio Service).
  • GPRS General Packet Radio Service
  • the GPRS function in the operating system of the terminal can be called to locate the terminal, and then obtain the first physical location of the terminal.
  • the embodiment of the present application does not specifically describe the terminal positioning method. limited.
  • the 204 Determine at least one storage node according to the first physical location, and determine at least one first distance between the at least one storage node and the first physical location.
  • at least one storage node is deployed in a storage resource pool indicated by the first physical location.
  • the area where the terminal is located can be determined according to the obtained first physical location.
  • the first physical location may be a certain district in Shanghai, a certain district in Shenzhen, etc. It can be determined that the area to which the first physical location belongs is Shanghai and Shenzhen.
  • the storage resource pool in each area includes more than one storage node, in order to select the best storage node for the user in the future, it is necessary to determine at least one storage node in the area. After determining at least one storage node, the location of each storage node is different. Considering that the closer the storage node is to the user's location, the faster the data storage and query speed will be, which will reduce the data during transmission. It takes a long time, therefore, at least one first distance between the at least one storage node and the first physical location of the terminal may be determined, and then the storage node closest to the terminal is determined according to the at least one first distance to store the user's data to be stored.
  • the node position of at least one storage node when acquiring the first distance, the node position of at least one storage node may be located first; then, the distance between the node position of the at least one storage node and the first physical position is calculated as the first distance. Because at least one storage node is included in the storage resource pool of an area, at least one first distance can be obtained.
  • the at least one first distance is sorted from large to small to generate a first ranking result, and the first ranked first is extracted from the first ranking result.
  • the distance is used as the target distance, that is, the smallest first distance is used as the target distance, and the storage node indicated by the target distance is determined as the target storage node.
  • the data to be stored can be obtained in the data storage instruction, the data to be stored is transmitted to the target storage node, and the target storage node stores the data to be stored.
  • the preset number of the last second distances uses the storage nodes indicated by the preset number of the second last distances as backup storage nodes.
  • the other storage nodes are storage nodes other than the target node among the at least one storage node.
  • the data is synchronized to multiple backup storage nodes in the storage resource pool, and data backup is implemented based on the multiple backup storage nodes.
  • multiple second distances between the target storage node and other storage nodes in at least one storage node of the current storage resource pool can be determined, and the multiple second distances can be sorted from large to small to generate The second sorting result, extracting a preset number of last second distances from the second sorting result, that is, extracting a preset number of minimum second distances, and using the storage nodes indicated by the preset number of last second distances as Backup the storage nodes, and then synchronize the data to be stored to a preset number of backup storage nodes for data backup.
  • the preset number can be two, so that two storage nodes with the smallest distance from the target storage node can be selected as backup storage nodes. For example, if the target storage node is P1, after storing the data to be stored in P1, select the storage nodes P2 and P3 that are closest to P1 as the backup storage nodes, so that in the future based on the data channel between P1 and P2 and P3, The data to be stored is transmitted to the backup storage nodes P2 and P3 for backup.
  • the first distance and the second weight of the second distance and the network weight can be obtained, and the second distance is calculated.
  • Calculate the second product of the network weight and the second weight with the first product of the first weight take the sum of the first product and the second product as the comprehensive distance of the storage node, and calculate the overall comprehensive distance of other storage nodes, Furthermore, a preset number of storage nodes with the smallest comprehensive distance is used as a backup storage node.
  • the new backup storage can be determined periodically for each target storage node in the above manner. Node and adjust the backup location of the data. For example, a new backup storage node can be determined for each target storage node every 30 days. The embodiment of the present application does not specifically limit the timing for updating the backup storage node for the target storage node.
  • the data addition instruction carries data to be added. Considering that the user may want to add the previously stored data in the future and add some new data for storage, therefore, the client provided by the data storage system can provide an additional data entry. When it is detected that the user triggers the data query entry, To display the data addition page, obtain the data to be added uploaded by the user on the data addition page, and determine that the user's data addition instruction is currently received.
  • the user may move in the area due to business trips, travels, etc., so that when the user requests data addition, the second physical location is different from the first physical location where data was previously stored.
  • the storage node from the user's second physical location may not be the target storage node for data storage before, and the storage node closest to the second physical location may be any one of the multiple backup storage nodes determined according to the target storage node. Therefore, when receiving a user's data addition instruction, it is necessary to obtain the second physical location of the user, compare the second physical location of the user with the first physical location where the data was previously stored, and determine the second physical location and the first physical location. Whether a physical location is the same.
  • step 211 performs the following.
  • the second physical location is the same as the first physical location, write data to be added in the target storage node.
  • the data to be added may be written directly in the target storage node. It should be noted that after the data to be added is added to the target storage node, the data to be added needs to be synchronized to other backup storage nodes, so as to ensure that the data stored in multiple backup storage nodes and the target storage node are The data is consistent.
  • the second physical location is different from the first physical location, store the data to be added to the backup storage node, and based on the backup storage node, synchronize the data to be added to the target storage node.
  • the data to be added may be stored in In the backup storage node, based on the backup storage node, the data to be added is synchronized to the target storage node, and the data to be added is added to the target storage node. For example, suppose the target storage node is P1, and the backup storage nodes are P2 and P3.
  • the additional data carried in the data addition instruction is stored.
  • the additional data is synchronized to P1 and P3 based on P2. It should be noted that after the data to be added is added to the target storage node, the data to be added needs to be synchronized to other backup storage nodes, so as to ensure that the data stored in multiple backup storage nodes and the target storage node are The data is consistent.
  • the second physical location is different from the first physical location and is not in the same storage resource pool as the first physical location, that is, the node closest to the second physical location is not a backup storage node determined according to the target storage node. Then repeat the process of determining the target storage node shown in the above steps 204 to 205, determine the temporary storage node based on the second physical location, and transmit the data to be added to the temporary storage node. Based on the temporary storage node, the to-be-added Data is synchronized to the target storage node and a preset number of backup storage nodes. The process of determining the temporary storage node is not repeated here. For example, suppose the target storage node is P1, and the backup storage nodes are P2 and P3.
  • P1, P2, and P3 are all located in area A. If the user's second physical location is in area B, and the storage node closest to the second physical location is P5 Then, the storage node P5 is used as a temporary storage node, and the additional data is transmitted to P5, and the additional data is transmitted to P1 based on P5, and synchronized to P2 and P3.
  • the user needs to query the data stored in the data storage system from time to time in daily work. For the process of querying the data, see FIG. 2D. The process includes the content in steps 212 to 217.
  • the data query request carries a data identifier of the data to be queried.
  • the client provided by the data storage system can provide a data query entry.
  • the data query page is displayed to obtain the user.
  • the data identifier of the data to be queried is input on the data query page, and it is determined that the user's data query request is currently received.
  • the user may not perform data query at the previous data storage location due to business trips, trips, etc., so that the storage node closest to the user's query data location is not the target storage node for data storage. Therefore, When receiving a user's data query request, it is necessary to obtain the user's query location for data query, compare the query location with the first physical location where the data was previously stored, and determine whether the query location is consistent with the first physical location.
  • step 213 If the location is consistent with the first physical location, you can directly obtain the data to be queried from the target storage node, that is, perform the following step 213; if the query location is not consistent with the first physical location, you need to determine the storage node that is closest to the query location And implement data query based on the storage node, that is, step 214 described below is performed.
  • the query location is consistent with the first physical location, obtain the query data indicated by the data identifier in the target storage node, and return the query data to the user.
  • the query location is consistent with the first physical location, the data to be queried indicated by the data identifier is acquired in the target storage node, and the data to be queried may be directly returned to the user. For example, suppose the user previously stored data in Shanghai, and the target storage node is Shanghai's P1. When a user's data query request is received, if it is detected that the user's current location is Shanghai, then the data to be queried is obtained in P1. Return the data to be queried to the user.
  • the query location is inconsistent with the first physical location, repeat the above-mentioned process of determining the target storage node, determine the query storage node based on the query location, transmit the data identifier to the target storage node based on the query storage node, and receive based on the query storage node.
  • the query data returned by the target storage node returns the query data to the user.
  • the query location is inconsistent with the first physical location, it means that the storage node closest to the current query location is not the target storage node, and the storage node closest to the query location needs to be determined as the query storage node, and based on The query storage node transmits a data representation to the target storage node, so that the target storage node can obtain the data to be queried according to the data identifier, and then return the data to be queried to the query storage node, and the query storage node returns the data to be queried to the user. For example, suppose the previous user stored data in Shanghai, and the target storage node is P1 in Shanghai.
  • the data storage system can perform statistics on the user's data query at the query location to generate the user's query rule.
  • Step 1 Statistic data query performed by the user at the query location to generate a query rule of the user at the query location.
  • the query rule includes at least historical query times and historical query time. Among them, if it is detected that the user has not performed data query at the location where the data was stored previously, the query location for the current data query can be retained, and the user's data query at the query location will be continuously counted in the subsequent generation of users. The query pattern at this query position.
  • Step 2 Based on the query rule, predict the next query time of the user at the query location, and synchronize all the data in the target storage node to the query storage node at the next query time.
  • the next query time of the user at the query location can be preset based on the query rule, and all data in the target storage node is synchronized to the query storage node at the next query time.
  • the querying data node can directly provide the querying data without having to request the querying data from the target storage node, thereby reducing the time it takes to query the data.
  • the query rule generated in Shenzhen is 10 times and during the working day as an example, you can determine that the query location in Shenzhen is the closest query node to P5, and before the working day arrives, the target storage node is All the data in P1 are synchronized to the query storage node P5.
  • the user may work and live in another area that is different from the area to which the first physical location for data storage belongs for a long time due to relocation or work transfer. In this way, the user will be Data query is requested in other areas at time. Therefore, the number of data queries performed by users at the query location can be counted to generate query times to determine whether the query times are greater than the threshold.
  • the data storage system can consider the user Being in the query position for a long time, you can re-determine a new target storage node for the user at this query position, and migrate all the data stored by the user in the target storage node to the new target storage node, thereby ensuring the high efficiency of data query That is, the following step 116 is performed; if the number of queries is less than the threshold, it means that the current user's data query operation does not meet the criteria for data migration, and the current data storage system provides the user with data storage, data addition, and data query. Service, that is, The following step 217 rows.
  • the query storage node is used as the new target storage node, and all data in the target storage node is synchronized to the new target storage node. Based on the new target storage node, a preset number of new backup storage nodes are determined. To back up all data to a preset number of new backup storage nodes.
  • the number of queries is greater than the threshold, it means that all the data stored by the user in the target storage node can be migrated to the query location, so that the query storage node at the query location can be used as the new target storage.
  • Node synchronizing all data previously stored by the user in the target storage node to the new target storage node, and repeatedly performing the content shown in step 207 above, to determine a preset number of new backup storage nodes based on the new target storage node.
  • the data stored in the new target storage node is backed up to the new backup storage node, and when the user's data query request is received at the query location, the data to be queried can be obtained directly in the new target storage node. For example, suppose that the user previously stored data in Shanghai and the target storage node is P1 in Shanghai.
  • the query threshold is 100 times. If it is detected that the user has requested data query in Shenzhen more than 100 times, and the location of the data query request is closest to P5 in Shenzhen.
  • the user continues to receive the user's data query request, and performs data query and data acquisition.
  • the number of queries is less than the threshold, it means that the conditions for migrating all data about the user in the target storage node to the query location are currently not met. In this way, the user continues to receive data query requests from users, and based on The query storage node can perform data query and data acquisition operations.
  • the data storage method provided in the embodiment of the present application can determine the target storage node closest to the physical location to store the user's to-be-stored data according to the physical location of the data requested by the user, so that the data stored by users in different locations can achieve distributed storage. , The storage data of all users will not be stored in a storage cluster, so that when the user's data query request is received, the data that the user needs to query can be quickly obtained, the time consumed for querying the data is shortened, and the intelligence is better.
  • an embodiment of the present application provides a data storage device.
  • the device includes a first receiving module 301, a positioning module 302, and a first distance determining module 303.
  • the first receiving module 301 is configured to receive a user's data storage instruction.
  • the data storage instruction includes at least data to be stored and a terminal identification of the user's terminal.
  • the positioning module 302 is configured to locate the user's terminal based on the terminal identification.
  • the first distance determining module 303 is configured to determine at least one storage node according to the first physical location, and determine at least a first distance between the at least one storage node and the first physical location, At least one storage node is deployed in a storage resource pool indicated by a first physical location;
  • the first node determination module 304 is configured to extract a target distance from at least one first distance, and determine a target storage node indicated by the target distance, where the target distance is A first distance among at least one first distance that meets a first distance criterion;
  • the first storage module 305 is configured to obtain data to be stored in a data storage instruction, and store the data to be stored in a target storage node.
  • the data storage device provided in the embodiment of the present application can determine the target storage node closest to the physical location to store the user's to-be-stored data according to the physical location where the user requests data storage, so that the data stored by users in different locations can achieve distributed storage.
  • the storage data of all users will not be stored in a storage cluster, so that when the user's data query request is received, the data that the user needs to query can be quickly obtained, the time consumed for querying the data is shortened, and the intelligence is better.
  • the first node determination module 304 includes a sorting sub-module 3041 and a determination sub-module 3042.
  • the sorting sub-module 3041 is configured to sort at least one first distance from large to small to generate a first sorting result; and the determining sub-module 3042 is configured to extract a first-ranked first distance from the first sorting result As the target distance, the storage node indicated by the target distance is determined as the target storage node.
  • the device further includes a second distance determination module 306, a second node determination module 307, and a first backup module 308.
  • the second distance determining module 306 is configured to determine a plurality of second distances between the target storage node and other storage nodes in the at least one storage node.
  • the other storage nodes are storage nodes other than the target node among the at least one storage node.
  • a second node determining module 307 is configured to determine, according to a plurality of second distances, a preset number of backup storage nodes whose second distance meets the second distance standard; the first backup module 308 is configured to transmit data to be stored to a pre-stored node. Set a number of backup storage nodes and perform data backup.
  • the device further includes a second receiving module 309, a second storage module 310, and a first synchronization module 311.
  • the second receiving module 309 is configured to receive a user's data addition instruction to acquire a second physical location of the user, and the data addition instruction carries data to be added; and the second storage module 310 is configured to:
  • the storage node with a different location and a distance from the second physical location that satisfies the distance standard is any backup storage node of a preset number of backup storage nodes, and then stores the data to be added to the backup storage node; the first synchronization module 311 , Used to synchronize the data to be added to the target storage node based on the backup storage node.
  • the device further includes a position acquisition module 312, a first sending module 313, and a second sending module 314.
  • the location acquisition module 312 is configured to receive a user's data query request, to obtain the user's query location, and the data query request carries the data identifier of the data to be queried;
  • the first sending module 313 is configured to query the location if the query location is the same as the first physical location. If they are the same, a first data acquisition request is sent to the target storage node, and the first data acquisition request is used to instruct the target storage node to acquire the data to be queried indicated by the data identifier, and return the data to be queried to the user; the second sending module 314, If the query location is inconsistent with the first physical location, the query storage node is determined according to the query location, and a second data acquisition request is sent to the query storage node.
  • the second data acquisition request is used to instruct the query storage node to obtain the pending data through the target storage node. Query the data and return the data to be queried to the user.
  • the device further includes a first statistics module 315 and a prediction module 316.
  • the first statistics module 315 is configured to collect statistics on data queries performed by users at the query location to generate query rules of the user at the query location.
  • the query rule includes at least historical query times and historical query time.
  • the prediction module 316 is configured to be based on The query rule predicts the next query time of the user at the query location, and synchronizes all data in the target storage node to the query storage node at the next query time. As shown in FIG.
  • the device further includes a second statistics module 317, a third node determination module 318, a second synchronization module 319, and a second backup module 320.
  • the second statistics module is configured to count the number of times the user performs data query at the query location to generate the number of queries;
  • the third node determination module is configured to use the query storage node as a new target storage node if the number of query times is greater than the threshold of the number of times;
  • the second synchronization module is used to synchronize all data in the target storage node to the new target storage node;
  • the second backup module is used to determine a preset number of new backup storage nodes based on the new target storage node, and back up all data to A preset number of new backup storage nodes.
  • an embodiment of the present application further provides a storage device, which stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the data storage method shown in FIG. 2B to FIG. 2D is implemented.
  • a storage device which stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the data storage method shown in FIG. 2B to FIG. 2D is implemented.
  • An embodiment of the present application further provides a physical device for data storage.
  • the physical device includes a storage device and a processor; the storage device is configured to store computer-readable instructions; and the processor is configured to execute the computer-readable instructions.
  • the instruction is read to implement the data storage method shown in FIG. 2B to FIG. 2D.
  • the present application can be implemented by hardware, or by software plus necessary universal hardware platform.
  • the technical solution of this application can be embodied in the form of a software product, which can be stored in a non-volatile readable storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), It includes several computer-readable instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of this application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

A data storage method and apparatus, a computer device, and a computer storage medium, relating to the technical field of the Internet. According to a physical location of a user, a target storage node closest to the physical location can be determined to store data to be stored, so that users at different locations implement distributed storage, data of all the users would not be stored in a storage cluster, and thus, data can be queried quickly, thereby shortening the time of querying the data, and achieving good intelligence. The method comprises: receiving a data storage instruction of a user (101); positioning a terminal of the user on the basis of a terminal identifier to obtain a first physical location of the user (102); determining at least one storage node according to the first physical location, and determining at least one first distance between the at least one storage node and the first physical location (103); extracting a target distance from among the at least one first distance, and determining a target storage node indicated by the target distance (104); and obtaining, from the data storage instruction, data to be stored, and storing said data to the target storage node (105).

Description

数据存储方法、装置、计算机设备及计算机存储介质Data storage method, device, computer equipment and computer storage medium
本申请要求与2018年8月1日提交中国专利局、申请号为2018108656426、申请名称为“数据存储方法、装置、计算机设备及计算机存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。This application claims priority from the Chinese patent application filed on August 1, 2018 with the Chinese Patent Office, application number 2018108656426, and application name "Data Storage Method, Device, Computer Equipment, and Computer Storage Medium", the entire contents of which are incorporated by reference Incorporated in the application.
技术领域Technical field
本申请涉及互联网技术领域,特别是涉及一种数据存储方法、装置、计算机设备及计算机存储介质。The present application relates to the field of Internet technologies, and in particular, to a data storage method, device, computer device, and computer storage medium.
背景技术Background technique
随着移动设备、社交网络、物联网等多种应用的蓬勃发展,人类社会产生的数据呈爆炸式增长。传统的数据存储方式通常为磁盘存储,用户将需要存储的数均存储在磁盘中,以便随时随地可以对数据进行查看。但是随着待存储数据的数据量越来越大,传统的磁盘在容量、性能和带宽方面越来越难满足以海量数据为基础的用户的存储需求,因此,由云平台支持的数据存储系统应运而生。数据存储系统中部署有数据中心,用户可将待存储的数据上传至数据中心,由数据中心对待存储的数据进行存储。相关技术中,数据中心中设置有用于存储数据的存储集群,当用户将待存储数据上传到数据存储系统时,数据中心便会接收到该待存储数据,并由数据中心将接收到的待存储数据添加至存储集群中进行存储。在实现本申请的过程中,申请人发现相关技术至少存在以下问题:数据中心在进行数据存储时,将接收到的全部待存储数据均存储在同一个存储集群中,使得该存储集群中存储有海量的数据,进而在接收到用户的数据查询请求时,需要在海量的数据中进行数据查询,不能快速获取用户需要查询的数据,导致查询数据耗费的时间较长,智能性较差。With the rapid development of various applications such as mobile devices, social networks, and the Internet of Things, data generated by human society has exploded. The traditional data storage method is usually disk storage. Users store the data that needs to be stored on the disk so that the data can be viewed anytime, anywhere. However, with the increasing amount of data to be stored, traditional disks have become increasingly difficult to meet the storage needs of users based on massive data in terms of capacity, performance, and bandwidth. Therefore, data storage systems supported by cloud platforms Came into being. A data center is deployed in the data storage system. Users can upload the data to be stored to the data center, and the data center stores the data to be stored. In related technologies, a data center is provided with a storage cluster for storing data. When a user uploads data to be stored to a data storage system, the data center receives the data to be stored, and the data center receives the data to be stored. Data is added to the storage cluster for storage. During the implementation of this application, the applicant found that the related technology has at least the following problems: When the data center performs data storage, all the data to be stored are stored in the same storage cluster, so that the storage cluster stores Massive data, and then when receiving a user's data query request, data query needs to be performed in the massive data, and the data that the user needs to query cannot be obtained quickly, resulting in a long time consuming query data and poor intelligence.
发明内容Summary of the invention
有鉴于此,本申请提供了一种数据存储方法、装置、计算机设备及计算机存储介质,主要目的在于解决目前在接收到用户的数据查询请求时,需要在海量的数据中进行数据查询,不能快速获取用户需要查询的数据,导致查询数据耗费的时间较长,智能性较差的问题。In view of this, this application provides a data storage method, device, computer equipment, and computer storage medium. The main purpose is to solve the need to query data in a large amount of data when receiving a data query request from a user. Obtaining data that users need to query results in a longer time and poor intelligence.
依据本申请第一方面,提供了一种数据存储方法,该方法包括:接收用户的数据存储指令,所述数据存储指令中至少包括待存储数据以及所述用户的终端的终端标识;基于所述终端标识对所述用户的终端进行定位,获取所述用户的第一物理位置;根据所述第一物理位置,确定至少一个存储节点,并确定所述至少一个存储节点与所述第一物理位置之间的至少一个第一距离,所述至少一个存储节点部署于所述第一物理位置指示的存储资源池中;在所述至少一个第一距离中提取目标距离,确定所述目标距离指示的目标存储节点,所述目标距离为所述至少一个第一距离中满足第一距离标准的第一距离;在所述数据存储指令中获取所述待存储数据,将所述待存储数据存储至所述目标存储节点。依据本申请第二方面,提供了一种数据存储装置,该装置包括:第一接收模块,用于接收用户的数据存储指令,所述数据存储指令中至少包括待存储数据以及所述用户的终端的终端标识;定位模块,用于基于所述终端标识对所述用户的终端进行定位,获取所述用户的第一物理位置;第一距离确定模块,用于根据所述第一物理位置,确定至少一个存储节点,并确定所述至少一个存储节点与所述第一物理位置之间的至少一个第一距离,所述至少一个存储节点部署于所述第一物理位置指示的存储资源池中;第一节点确定模块,用于在所述至少一个第一距离中提取目标距离,确定所述目标距离指示的目标存储节点,所述目标距离为所述至少一个第一距离中满足第一距离标准的第一距离;第一存储模块,用于在所述数据存储指令中获取所述待存储数据,将所述待存储数据存储至所述目标存储节点。依据本申请第三方面,提供了一种计算机设备,包括存储器和 处理器,所述存储器中存储有计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现上述第一方面所述方法的步骤。依据本申请第四方面,提供了一种计算机非易失性可读存储介质,其上存储有计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现上述第一方面所述的方法的步骤。借由上述技术方案,本申请提供的一种数据存储方法及装置,与目前将接收到的全部待存储数据均存储在同一个存储集群中的方式相比,本申请根据用户请求进行数据存储的物理位置,确定与物理位置最近的目标存储节点存储用户的待存储数据,使得不同位置的用户存储的数据均实现分布式存储,不会将全部用户的存储数据均存储在一个存储集群中,使得在接收到用户的数据查询请求时,可以快速获取用户需要查询的数据,缩短了查询数据耗费的时间,智能性较好。上述说明仅是本申请技术方案的概述,为了能够更清楚了解本申请的技术手段,而可依照说明书的内容予以实施,并且为了让本申请的上述和其它目的、特征和优点能够更明显易懂,以下特举本申请的具体实施方式。According to a first aspect of the present application, a data storage method is provided. The method includes: receiving a data storage instruction of a user, where the data storage instruction includes at least data to be stored and a terminal identifier of a terminal of the user; The terminal identification locates the terminal of the user, and obtains the first physical location of the user; determines at least one storage node according to the first physical location, and determines the at least one storage node and the first physical location At least one first distance between them, the at least one storage node is deployed in a storage resource pool indicated by the first physical location; extracting a target distance from the at least one first distance, and determining a target distance indicated by the target distance A target storage node, where the target distance is a first distance among the at least one first distance that meets a first distance criterion; obtaining the data to be stored in the data storage instruction, and storing the data to be stored in the The target storage node is described. According to a second aspect of the present application, a data storage device is provided. The device includes a first receiving module configured to receive a user's data storage instruction. The data storage instruction includes at least data to be stored and a terminal of the user. A terminal identification; a positioning module configured to locate the user's terminal based on the terminal identification to obtain a first physical location of the user; a first distance determination module configured to determine based on the first physical location At least one storage node and determining at least a first distance between the at least one storage node and the first physical location, the at least one storage node being deployed in a storage resource pool indicated by the first physical location; A first node determining module, configured to extract a target distance from the at least one first distance, and determine a target storage node indicated by the target distance, where the target distance satisfies a first distance criterion among the at least one first distance A first distance; a first storage module, configured to obtain the data to be stored in the data storage instruction, To be stored in the data storage to the target storage node. According to a third aspect of the present application, there is provided a computer device including a memory and a processor, where the computer-readable instructions are stored in the memory, and the processor implements the computer-readable instructions to implement the first section. In one aspect the steps of the method. According to a fourth aspect of the present application, there is provided a computer non-volatile readable storage medium having computer-readable instructions stored thereon, characterized in that the computer-readable instructions implement the first aspect when executed by a processor. The steps of the method. With the above technical solution, a data storage method and device provided in this application is compared with a current method in which all received data to be stored are stored in the same storage cluster. Physical location, determine the target storage node closest to the physical location to store the user's data to be stored, so that the data stored by users in different locations is distributed, and the storage data of all users is not stored in a storage cluster. When a user's data query request is received, the data that the user needs to query can be quickly obtained, the time taken to query the data is shortened, and the intelligence is better. The above description is only an overview of the technical solution of this application. In order to understand the technical means of this application more clearly, it can be implemented in accordance with the content of the description, and in order to make the above and other purposes, features, and advantages of this application more obvious and understandable. The specific implementations of this application are listed below.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本申请的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:图1示出了本申请实施例提供的一种数据存储方法流程示意图;图2A示出了本申请实施例提供的一种数据存储系统结构示意图;图2B示出了本申请实施例提供的一种数据存储方法流程示意图;图2C示出了本申请实施例提供的一种数据存储方法流程示意图;图2D示出了本申请实施例提供的一种数据存储方法流程示意图;图3A示出了本申请实施例提供的一种数据存储装置结构示意图;图3B示出了本申请实施例提供的一种数据存储装置结构示意图;图3C示出了本申请实施例提供的一种数据存储装置结构示意图;图 3D示出了本申请实施例提供的一种数据存储装置结构示意图;图3E示出了本申请实施例提供的一种数据存储装置结构示意图;图3F示出了本申请实施例提供的一种数据存储装置结构示意图;图3G示出了本申请实施例提供的一种数据存储装置结构示意图。Various other advantages and benefits will become apparent to those of ordinary skill in the art upon reading the detailed description of the preferred embodiments below. The drawings are only for the purpose of illustrating preferred embodiments and are not to be considered as limiting the present application. Moreover, the same reference numerals are used throughout the drawings to refer to the same parts. In the drawings: FIG. 1 shows a schematic flowchart of a data storage method provided by an embodiment of the present application; FIG. 2A shows a schematic structure diagram of a data storage system provided by an embodiment of the present application; FIG. 2B shows the present application A schematic flow chart of a data storage method provided by the embodiment; FIG. 2C shows a schematic flow chart of a data storage method provided by an embodiment of the present application; FIG. 2D shows a schematic flow chart of a data storage method provided by an embodiment of the present application; FIG. 3A shows a schematic structural diagram of a data storage device provided by an embodiment of the present application; FIG. 3B shows a schematic structural diagram of a data storage device provided by an embodiment of the present application; FIG. 3C shows a A schematic diagram of a data storage device structure; FIG. 3D shows a schematic diagram of a data storage device structure provided in an embodiment of the present application; FIG. 3E shows a schematic diagram of a data storage device structure provided in an embodiment of the application; Schematic diagram of the structure of a data storage device provided by an embodiment of the present application; FIG. 3G shows the structure of a data storage device provided by an embodiment of the present application Intentions.
具体实施方式detailed description
下面将参照附图更详细地描述本公开的示例性实施例。虽然附图中显示了本公开的示例性实施例,然而应当理解,可以以各种形式实现本公开而不应被这里阐述的实施例所限制。相反,提供这些实施例是为了能够更透彻地理解本公开,并且能够将本公开的范围完整的传达给本领域的技术人员。本申请实施例提供了一种数据存储方法,如图1所示,该方法包括:101、接收用户的数据存储指令,数据存储指令中至少包括待存储数据以及用户的终端的终端标识。具体过程参见下述实施例中步骤203。102、基于终端标识对用户的终端进行定位,获取用户的第一物理位置。具体过程参见下述实施例中步骤203。103、根据第一物理位置,确定至少一个存储节点,并确定至少一个存储节点与第一物理位置之间的至少一个第一距离,至少一个存储节点部署于第一物理位置指示的存储资源池中。具体过程参见下述实施例中步骤204。104、在至少一个第一距离中提取目标距离,确定目标距离指示的目标存储节点,目标距离为至少一个第一距离中满足第一距离标准的第一距离。具体过程参见下述实施例中步骤205。105、在数据存储指令中获取待存储数据,将待存储数据存储至目标存储节点。具体过程参见下述实施例中步骤206。本申请实施例提供的数据存储方法,可以根据用户请求进行数据存储的物理位置,确定与物理位置最近的目标存储节点存储用户的待存储数据,使得不同位置的用户存储的数据均实现分布式存储,不会将全部用户的存储数据均存储在一个存储集群中,使得在接收到用户的数据查询请求时,可以快速获取用户需要查询的数据,缩短了查询数据耗费的时间,智能性较好。在对本申请实施例进行详细的解释说明之前,先对本申请实 施例涉及的数据存储系统的结构进行简单介绍。参见图2A,数据存储系统中在多个区域均部署了Endpoint(端点)和存储资源池。其中,Endpoint表示用户的终端连接到存储资源池时的目录系统;存储资源池用于存储接收到的用户上传的数据,存储资源池中包括至少一个存储节点,每个区域的存储资源池的存储都是高可用保存,即使存储资源池中某一个存储节点发生故障也不会导致该存储节点中存储的数据丢失。另外,每个区域的存储资源池均与资源同步通道连接,并由资源同步通道实现将某一区域的数据从当前区域的存储资源池同步到另一个区域的存储资源池中。本申请实施例提供了一种数据存储方法,可以达到快速获取用户需要查询的数据,缩短了查询数据耗费的时间,智能性较好的目的,如图2B所示,该方法包括:Hereinafter, exemplary embodiments of the present disclosure will be described in more detail with reference to the accompanying drawings. Although exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a thorough understanding of the present disclosure, and to fully convey the scope of the present disclosure to those skilled in the art. An embodiment of the present application provides a data storage method. As shown in FIG. 1, the method includes: 101. Receive a user's data storage instruction. The data storage instruction includes at least data to be stored and a terminal identifier of a user's terminal. For the specific process, refer to step 203 in the following embodiment. 102. The user's terminal is located based on the terminal identifier to obtain the first physical location of the user. For the specific process, refer to step 203 in the following embodiments. 103. Determine at least one storage node according to the first physical location, determine at least a first distance between the at least one storage node and the first physical location, and deploy at least one storage node. In the storage resource pool indicated by the first physical location. For the specific process, refer to step 204 in the following embodiments. 104. Extract the target distance from at least one first distance, and determine the target storage node indicated by the target distance. The target distance is the first of the at least one first distance that meets the first distance criterion. distance. For the specific process, refer to step 205 in the following embodiment. 105. Obtain the data to be stored in the data storage instruction, and store the data to be stored in the target storage node. For details, refer to step 206 in the following embodiments. The data storage method provided in the embodiment of the present application can determine the target storage node closest to the physical location to store the user's to-be-stored data according to the physical location of the data requested by the user, so that the data stored by users in different locations can achieve distributed storage. , The storage data of all users will not be stored in a storage cluster, so that when the user's data query request is received, the data that the user needs to query can be quickly obtained, the time consumed for querying the data is shortened, and the intelligence is better. Before explaining the embodiments of the present application in detail, the structure of the data storage system involved in the embodiments of the present application will be briefly introduced. Referring to FIG. 2A, an endpoint and a storage resource pool are deployed in a plurality of regions in a data storage system. Among them, Endpoint represents the directory system when the user's terminal is connected to the storage resource pool; the storage resource pool is used to store the data uploaded by the user. The storage resource pool includes at least one storage node, and the storage of each region's storage resource pool. They are all highly available saves, and even if a storage node in the storage resource pool fails, the data stored in the storage node will not be lost. In addition, the storage resource pool in each region is connected to the resource synchronization channel, and the resource synchronization channel is used to synchronize the data in a certain region from the storage resource pool in the current region to the storage resource pool in another region. The embodiment of the present application provides a data storage method, which can quickly obtain the data that a user needs to query, shorten the time required for querying the data, and have better intelligence. As shown in FIG. 2B, the method includes:
201、确定多个存储资源池,对于多个存储资源池中的每个存储资源池,基于预设数据通道,建立存储资源池与其他存储资源池之间的数据连接。在本申请实施例中,多个存储资源池中的每个存储资源池均包括至少一个存储节点,预设数据通道至少为公网通道或内网通道,公网通道具体可为VPN(Virtual Private Network,虚拟专用网络)通道。申请人认识到,为了使用户在存储数据时更加的便捷,且为用户选取最合适的存储节点进行数据存储,可以根据用户的地理位置来确定存储用户的待存储数据的存储节点,从而缩短用户存储以及获取数据的时间。另外,考虑到用户可能会在不同的区域进行数据查询,为了便于用户对数据的查询,需要将用户需要查询的数据从一个区域同步至另一个区域,因此,可以基于预设数据通道,建立一个区域的存储资源池与其他区域的存储资源池之间的数据连接。在建立一个区域的存储资源池与另一个区域的存储资源池之间的数据连接时,可以采用预设数据通道,分别建立一个区域的存储资源池和另一个区域的存储资源池与资源同步通道之间的数据连接,使得通过资源同步通道,可以实现数据从一个区域的资源存储池同步至另一个区域的资源存储池。其中,对于一个区域 中的至少一个存储节点来说,至少一个存储节点之间可以采用该区域的预设数据通道进行数据连接,从而保证对存储节点中存储的数据进行同步、备份等操作。201. Determine multiple storage resource pools. For each storage resource pool in the multiple storage resource pools, establish a data connection between the storage resource pool and other storage resource pools based on a preset data channel. In the embodiment of the present application, each storage resource pool in the multiple storage resource pools includes at least one storage node. The preset data channel is at least a public network channel or an internal network channel. The public network channel may specifically be a VPN (Virtual Private Network (Virtual Private Network) channel. The applicant recognizes that in order to make it more convenient for users to store data, and to select the most suitable storage node for data storage for the user, the storage node that stores the user's data to be stored can be determined according to the geographical location of the user, thereby shortening the user When to store and retrieve data. In addition, considering that users may perform data query in different regions, in order to facilitate the user's query of data, it is necessary to synchronize the data that the user needs to query from one region to another. Therefore, one can be established based on a preset data channel. Data connections between storage resource pools in a region and storage resource pools in other regions. When establishing a data connection between a storage resource pool in one region and a storage resource pool in another region, a preset data channel may be adopted to separately establish a storage resource pool in one region and a storage resource pool in another region and a resource synchronization channel. The data connection between them enables data synchronization from the resource storage pool in one region to the resource storage pool in another region through the resource synchronization channel. For at least one storage node in an area, at least one storage node may use a preset data channel of the area for data connection, thereby ensuring synchronization, backup, and other operations on data stored in the storage node.
202、对存储资源池与其他存储资源池之间的数据连接进行评级,生成评级结果。在本申请实施例中,由于存储资源池在与其他存储资源池之间建立数据连接时,可以采用公网通道或内网通道进行连接,而内网通道的安全系数较公网通道的安全系数高,因此,在存储资源池与其他存储资源池之间的数据连接建立成功后,可以对存储资源池与其他存储资源池之间的数据连接进行评级,生成评级结果,以便在后续可以根据评级结果确定同步数据时,确定最安全的存储节点进行同步,还可以提醒用户执行数据同步的安全性。其中,如果存储资源池与其他存储资源池之间的数据连接为公网通道,则生成的评级结果为三级,具体可以用C级表示,表示该区域的存储资源池与其他区域的存储资源池之间仅拥有公网通道,同步风险较高;如果存储资源池与其他存储资源池之间的数据连接为内网通道,则生成的评级结果为二级,具体可以用B级表示,表示该区域的存储资源池与其他区域的存储资源池之间仅拥有内网通道,同步风险较低;如果存储资源池与其他存储资源池之间的数据连接为公网通道和内网通道,则生成的评级结果为一级,具体可以用A级表示,表示该区域的存储资源池与其他区域的存储资源池之间拥有内网通道和公网通道两种通道,同步风险最低,且在进行数据同步时,会优先选择内网通道进行数据同步。202: Rate data connections between the storage resource pool and other storage resource pools, and generate a rating result. In the embodiment of the present application, when a storage resource pool establishes a data connection with another storage resource pool, a public network channel or an internal network channel may be used for connection, and the security coefficient of the internal network channel is higher than that of the public network channel. Therefore, after the data connection between the storage resource pool and other storage resource pools is successfully established, the data connection between the storage resource pool and other storage resource pools can be rated to generate a rating result, so that synchronization can be determined later based on the rating results. When data is being determined, the most secure storage node is synchronized, and users can also be reminded of the security of data synchronization. Among them, if the data connection between the storage resource pool and other storage resource pools is a public network channel, the generated rating result is three levels, which can be specifically expressed as level C, which indicates that the storage resource pool in this area is different from the storage resource pools in other areas. There is only a public network channel between them, and the risk of synchronization is high; if the data connection between the storage resource pool and other storage resource pools is an internal network channel, the generated rating result is a second-level, which can be specifically expressed as a B-level, indicating the area's The storage resource pool and the storage resource pools in other regions only have internal network channels, and the risk of synchronization is low. If the data connection between the storage resource pool and other storage resource pools is a public network channel and an internal network channel, the generated rating result is Level 1, which can be specifically expressed as level A, indicating that the storage resource pools in this region and the storage resource pools in other regions have two channels, the internal network channel and the public network channel. The synchronization risk is the lowest, and it will take precedence when synchronizing data. Select the intranet channel for data synchronization.
203、当接收到数据存储指令时,在数据存储指令中提取终端标识,基于终端标识对用户的终端进行定位,获取用户的第一物理位置。在本申请实施例中,数据存储指令中至少包括待存储数据以及用户的终端的终端标识。数据存储系统所搭载的服务器可以以客户端的形式为用户提供数据存储服务,在客户端中提供数据存储入口,用户可以在所持的终端中下载该客户端;进一步地,为了保证用户在后续可以准确获取已经存储的 数据,客户端可以为用户提供注册服务,并为每一个注册的用户分配注册标识,将该注册标识也作为终端标识。这样,当检测到用户触发该数据存储入口时,数据存储系统确定接收到数据存储指令,获取用户所持终端的终端标识,具体可为用户所持终端的手机号码以及用户的注册标识。当获取到终端的终端标识后,便可以根据终端标识对终端进行定位,进而获取终端的第一物理位置。其中,在对终端进行定位时,可以采用GPRS(General Packet Radio Service,通用分组无线服务技术)对终端进行定位。在实际应用的过程中,在对终端进行定位时,可以调用终端的操作系统中的GPRS功能对终端进行定位,进而获取终端的第一物理位置,本申请实施例对终端定位的方式不进行具体限定。203. When the data storage instruction is received, the terminal identification is extracted from the data storage instruction, and the user's terminal is located based on the terminal identification to obtain the first physical location of the user. In the embodiment of the present application, the data storage instruction includes at least data to be stored and a terminal identifier of a user's terminal. The server provided by the data storage system can provide users with data storage services in the form of clients. Data storage portals are provided in the clients, and users can download the clients in the terminals they hold; further, in order to ensure that users can be accurate in the future To obtain the stored data, the client can provide a registration service for the user, and assign a registration ID to each registered user, and use this registration ID as the terminal ID. In this way, when it is detected that the user triggers the data storage entry, the data storage system determines that the data storage instruction is received to obtain the terminal identification of the terminal held by the user, which may specifically be the mobile phone number of the terminal held by the user and the user's registration identification. After the terminal identifier of the terminal is obtained, the terminal can be located according to the terminal identifier, and then the first physical location of the terminal is obtained. Wherein, when positioning the terminal, the terminal may be positioned by using GPRS (General Packet Radio Service). In the actual application process, when positioning the terminal, the GPRS function in the operating system of the terminal can be called to locate the terminal, and then obtain the first physical location of the terminal. The embodiment of the present application does not specifically describe the terminal positioning method. limited.
204、根据第一物理位置,确定至少一个存储节点,并确定至少一个存储节点与第一物理位置之间的至少一个第一距离。在本申请实施例中,至少一个存储节点部署于第一物理位置指示的存储资源池中。当确定终端的第一物理位置后,便可以根据获取到的第一物理位置确定终端所在的区域,例如,第一物理位置可为上海的某个区、深圳的某个区等,这样,便可以确定第一物理位置的所属区域为上海、深圳。由于每个区域的存储资源池中均包括不止一个存储节点,为了在后续给用户选取最佳的存储节点,需要确定该区域内的至少一个存储节点。在确定了至少一个存储节点后,每个存储节点所处的位置是不同的,考虑到存储节点与用户所在的位置越近数据存储及查询的速度就会越快,进而减少数据在传输过程中的耗费时长,因此,可以确定至少一个存储节点与终端的第一物理位置之间的至少一个第一距离,进而根据至少一个第一距离确定距离终端最近的存储节点来存储用户的待存储数据。其中,在获取第一距离时,可以先对至少一个存储节点的节点位置进行定位;随后,计算至少一个存储节点的节点位置与第一物理位置之间的距离作为第一距离。由于一个区域的存储资源池中包括至少一个存储节点,因此,可以获取到至少一个第一距离。204. Determine at least one storage node according to the first physical location, and determine at least one first distance between the at least one storage node and the first physical location. In the embodiment of the present application, at least one storage node is deployed in a storage resource pool indicated by the first physical location. After the first physical location of the terminal is determined, the area where the terminal is located can be determined according to the obtained first physical location. For example, the first physical location may be a certain district in Shanghai, a certain district in Shenzhen, etc. It can be determined that the area to which the first physical location belongs is Shanghai and Shenzhen. Since the storage resource pool in each area includes more than one storage node, in order to select the best storage node for the user in the future, it is necessary to determine at least one storage node in the area. After determining at least one storage node, the location of each storage node is different. Considering that the closer the storage node is to the user's location, the faster the data storage and query speed will be, which will reduce the data during transmission. It takes a long time, therefore, at least one first distance between the at least one storage node and the first physical location of the terminal may be determined, and then the storage node closest to the terminal is determined according to the at least one first distance to store the user's data to be stored. Wherein, when acquiring the first distance, the node position of at least one storage node may be located first; then, the distance between the node position of the at least one storage node and the first physical position is calculated as the first distance. Because at least one storage node is included in the storage resource pool of an area, at least one first distance can be obtained.
205、将至少一个第一距离从大到小进行排序,生成第一排序结果,在第一排序结果中提取排在末位的第一距离作为目标距离,确定目标距离指示的存储节点作为目标存储节点。在本申请实施例中,当获取到至少一个第一距离后,将至少一个第一距离从大到小进行排序,生成第一排序结果,在第一排序结果中提取排在末位的第一距离作为目标距离,也即将最小的第一距离作为目标距离,并确定目标距离指示的存储节点作为目标存储节点。另外,还可以将至少一个第一距离从小到大进行排序,将排在首位的第一距离作为目标距离,并进一步确定目标存储节点。205. Sort at least one first distance from large to small to generate a first ranking result, and extract the first ranked first distance from the first ranking result as the target distance, and determine the storage node indicated by the target distance as the target storage. node. In the embodiment of the present application, when at least one first distance is obtained, the at least one first distance is sorted from large to small to generate a first ranking result, and the first ranked first is extracted from the first ranking result. The distance is used as the target distance, that is, the smallest first distance is used as the target distance, and the storage node indicated by the target distance is determined as the target storage node. In addition, it is also possible to sort at least one first distance from small to large, use the first distance ranked first as the target distance, and further determine the target storage node.
206、在数据存储指令中获取待存储数据,将待存储数据存储至目标存储节点。在本申请实施例中,当确定了目标存储节点后,便可以在数据存储指令中获取待存储数据,将待存储数据传输至目标存储节点,由目标存储节点对待存储数据进行存储。206: Obtain the data to be stored in the data storage instruction, and store the data to be stored in the target storage node. In the embodiment of the present application, after the target storage node is determined, the data to be stored can be obtained in the data storage instruction, the data to be stored is transmitted to the target storage node, and the target storage node stores the data to be stored.
207、确定目标存储节点与至少一个存储节点中其他存储节点之间的多个第二距离,将多个第二距离从大到小进行排序,生成第二排序结果,在第二排序结果中提取预设数目的末位第二距离,将预设数目的末位第二距离指示的存储节点作为备份存储节点。在本申请实施例中,其他存储节点为至少一个存储节点中除目标节点外的存储节点。每个存储资源池中的至少一个存储节点之间均存在数据连接,为了保证存储于某一存储节点的数据的安全性,可以根据目标存储节点确定多个备份存储节点,以便将存储节点中存储的数据同步至存储资源池中的多个备份存储节点,基于多个备份存储节点,实现对数据的备份。当确定目标存储节点后,便可以确定目标存储节点与当前存储资源池的至少一个存储节点中其他存储节点之间的多个第二距离,将多个第二距离从大到小进行排序,生成第二排序结果,在第二排序结果中提取预设数目的末位第二距离,也即提取预设数目的最小的第二距离,将预设数目的末位第二距离指示的存储节点作为备份存储节点,并在后续将待存储数据同步至预设数目的备份存储节点进行数据备份。其中,预 设数目可为2,这样,便可以选取与目标存储节点距离最小的2个存储节点作为备份存储节点。例如,如果目标存储节点为P1,在将待存储数据存储到P1后,选择距离P1最近的存储节点P2和P3作为备份存储节点,以便在后续基于P1与P2和P3之间的数据通道,将待存储数据传输至备份存储节点P2和P3进行备份。在实际应用的过程中,由于在步骤202中对存储资源池与其他存储资源池之间的数据连接进行了评级,并生成了评级结果,因此,在为目标存储节点确定备份存储节点时,还可以结合目标存储节点与其他存储节点之间的评级结果进行选取。例如,设P1为目标存储节点,P1和P2的连接方式是A级别,且网络平均延迟为100ms;P1和P3的连接方式为C级别,且平均延迟为300ms。,那么我们使用F(A)+G(100)计算得到P2的网络权值,使用F(C)+G(300)计算得到P3的网络权值。这样,在确定将哪一个存储节点作为备份存储节点时,对于其他存储节点中的任一存储节点来说,可以获取第二距离和网络权值的第一权重和第二权重,计算第二距离与第一权重的第一乘积,计算网络权值与第二权重的第二乘积,将第一乘积与第二乘积的和作为该存储节点的综合距离,并计算其他存储节点的全部综合距离,进而将综合距离最小的预设数目的存储节点作为备份存储节点。需要说明的是,由于存储资源池之间的数据通道可能发生变化,且各个存储节点之间的数据连接也可能发生变化,因此,可以周期性采用上述方式为每个目标存储节点确定新的备份存储节点,并调整对数据的备份位置,例如,可以每隔30天为每个目标存储节点确定新的备份存储节点。本申请实施例对为目标存储节点更新备份存储节点的时机不进行具体限定。207. Determine a plurality of second distances between the target storage node and other storage nodes in at least one storage node, sort the plurality of second distances from large to small, generate a second ranking result, and extract from the second ranking result. The preset number of the last second distances uses the storage nodes indicated by the preset number of the second last distances as backup storage nodes. In the embodiment of the present application, the other storage nodes are storage nodes other than the target node among the at least one storage node. There is a data connection between at least one storage node in each storage resource pool. In order to ensure the security of the data stored in a storage node, multiple backup storage nodes can be determined according to the target storage node in order to store the data in the storage node. The data is synchronized to multiple backup storage nodes in the storage resource pool, and data backup is implemented based on the multiple backup storage nodes. After the target storage node is determined, multiple second distances between the target storage node and other storage nodes in at least one storage node of the current storage resource pool can be determined, and the multiple second distances can be sorted from large to small to generate The second sorting result, extracting a preset number of last second distances from the second sorting result, that is, extracting a preset number of minimum second distances, and using the storage nodes indicated by the preset number of last second distances as Backup the storage nodes, and then synchronize the data to be stored to a preset number of backup storage nodes for data backup. Among them, the preset number can be two, so that two storage nodes with the smallest distance from the target storage node can be selected as backup storage nodes. For example, if the target storage node is P1, after storing the data to be stored in P1, select the storage nodes P2 and P3 that are closest to P1 as the backup storage nodes, so that in the future based on the data channel between P1 and P2 and P3, The data to be stored is transmitted to the backup storage nodes P2 and P3 for backup. In the actual application process, since the data connection between the storage resource pool and other storage resource pools is rated in step 202 and a rating result is generated, when determining the backup storage node for the target storage node, it is also possible to Select based on the rating results between the target storage node and other storage nodes. For example, suppose P1 is the target storage node, the connection mode of P1 and P2 is A level, and the average network delay is 100ms; the connection mode of P1 and P3 is C level, and the average delay is 300ms. Then, we use F (A) + G (100) to calculate the network weight of P2, and use F (C) + G (300) to obtain the network weight of P3. In this way, when determining which storage node is to be used as a backup storage node, for any storage node of other storage nodes, the first distance and the second weight of the second distance and the network weight can be obtained, and the second distance is calculated. Calculate the second product of the network weight and the second weight with the first product of the first weight, take the sum of the first product and the second product as the comprehensive distance of the storage node, and calculate the overall comprehensive distance of other storage nodes, Furthermore, a preset number of storage nodes with the smallest comprehensive distance is used as a backup storage node. It should be noted that, because the data channel between the storage resource pools may change and the data connections between the storage nodes may also change, the new backup storage can be determined periodically for each target storage node in the above manner. Node and adjust the backup location of the data. For example, a new backup storage node can be determined for each target storage node every 30 days. The embodiment of the present application does not specifically limit the timing for updating the backup storage node for the target storage node.
208、将待存储数据传输至预设数目的备份存储节点,并进行数据备份。在本申请实施例中,当根据目标存储节点确定预设数目的备份存储节点后,便可以将待存储数据传输至该预设数目的备份存储节点,基于预设数目的备份存储节点进行数据备份,进而保证存储至目标存储节点中数据的安全性。在实际应用的过程中,用户在日常工作中会 不时需要对存储至数据存储系统的数据进行追加,对数据追加的过程参见图2C,该过程包括步骤209至步骤211中的内容。208: Transfer the data to be stored to a preset number of backup storage nodes, and perform data backup. In the embodiment of the present application, after a preset number of backup storage nodes are determined according to the target storage node, data to be stored can be transmitted to the preset number of backup storage nodes, and data backup is performed based on the preset number of backup storage nodes. , Thereby ensuring the security of the data stored in the target storage node. In the actual application process, the user may need to add data stored in the data storage system from time to time in daily work. For the process of adding data, see FIG. 2C. The process includes the content in steps 209 to 211.
209、接收用户的数据追加指令,获取用户的第二物理位置,如果第二物理位置与第一物理位置相同,则执行下述步骤210;如果第二物理位置与第一物理位置不同,则执行下述步骤211。在本申请实施例中,数据追加指令携带待追加数据。考虑到用户在后续可能想要对之前存储的数据进行追加,追加一些新的数据进行存储,因此,数据存储系统所搭载的客户端可以提供数据追加入口,当检测到用户触发该数据查询入口时,显示数据追加页面,获取用户在数据追加页面上传的待追加数据,确定当前接收到用户的数据追加指令。其中,用户可能由于出差、旅行等原因,用户可能在区域中移动,使得用户在请求进行数据追加时所处的第二物理位置与之前进行数据存储的第一物理位置是不相同的,这样,导致距离用户第二物理位置的存储节点可能已经不是之前进行数据存储的目标存储节点,与第二物理位置最近的存储节点可能为根据目标存储节点确定的多个备份存储节点中的任一备份存储节点,因此,在接收到用户的数据追加指令时,需要获取用户的第二物理位置,将用户的第二物理位置与之前进行数据存储的第一物理位置进行比对,判断第二物理位置与第一物理位置是否相同,如果第二物理位置与之前进行数据存储的第一物理位置相同,则可以直接将待追加数据追加至目标存储节点中,也即执行下述步骤210;如果第二物理位置与之前进行数据存储的第一物理位置不相同,则需要基于备份存储节点进行数据追加,也即执行下述步骤211。209. Receive a user's data addition instruction to obtain the user's second physical location. If the second physical location is the same as the first physical location, execute the following step 210; if the second physical location is different from the first physical location, execute The following step 211. In the embodiment of the present application, the data addition instruction carries data to be added. Considering that the user may want to add the previously stored data in the future and add some new data for storage, therefore, the client provided by the data storage system can provide an additional data entry. When it is detected that the user triggers the data query entry, To display the data addition page, obtain the data to be added uploaded by the user on the data addition page, and determine that the user's data addition instruction is currently received. Among them, the user may move in the area due to business trips, travels, etc., so that when the user requests data addition, the second physical location is different from the first physical location where data was previously stored. The storage node from the user's second physical location may not be the target storage node for data storage before, and the storage node closest to the second physical location may be any one of the multiple backup storage nodes determined according to the target storage node. Therefore, when receiving a user's data addition instruction, it is necessary to obtain the second physical location of the user, compare the second physical location of the user with the first physical location where the data was previously stored, and determine the second physical location and the first physical location. Whether a physical location is the same. If the second physical location is the same as the first physical location where data was previously stored, the data to be added can be directly added to the target storage node, that is, the following step 210 is performed; if the second physical location is Different from the first physical location where the data was stored before, The need for additional data based on a backup storage node, i.e., step 211 performs the following.
210、如果第二物理位置与第一物理位置相同,则在目标存储节点中写入待追加数据。在本申请实施例中,如果用户请求进行数据追加的第二物理位置与之前进行数据存储的第一物理位置是相同的,则可以直接在目标存储节点中写入待追加数据即可。需要说明的是,在完成将待追加数据追加至目标存储节点后,需要将待追加数据同步至其他 的备份存储节点中,从而保证多个备份存储节点中存储的数据与目标存储节点中存储的数据是一致的。210: If the second physical location is the same as the first physical location, write data to be added in the target storage node. In the embodiment of the present application, if the second physical location for which the user requests data addition is the same as the first physical location for data storage before, the data to be added may be written directly in the target storage node. It should be noted that after the data to be added is added to the target storage node, the data to be added needs to be synchronized to other backup storage nodes, so as to ensure that the data stored in multiple backup storage nodes and the target storage node are The data is consistent.
211、如果第二物理位置与第一物理位置不同,则将待追加数据存储至备份存储节点,基于备份存储节点,将待追加数据同步至目标存储节点。在本申请实施例中,如果第二物理位置与第一物理位置不同,且与第二物理位置的距离满足距离标准的存储节点为目标存储节点的备份存储节点,则可以将待追加数据存储至备份存储节点中,并基于备份存储节点,将待追加数据同步至目标存储节点,实现将待追加数据追加至目标存储节点。例如,设目标存储节点为P1,备份存储节点为P2和P3,如果用户的第一新物理位置距离P2最近,则当接收到用户的数据追加指令时,将数据追加指令中携带的追加数据存储在P2中,并基于P2将追加数据同步至P1和P3。需要说明的是,在完成将待追加数据追加至目标存储节点后,需要将待追加数据同步至其他的备份存储节点中,从而保证多个备份存储节点中存储的数据与目标存储节点中存储的数据是一致的。另外,如果第二物理位置与第一物理位置不同,且与第一物理位置不在同一个存储资源池中,也即距离第二物理位置最近的节点并不是根据目标存储节点确定的备份存储节点,则重复执行上述步骤204至步骤205中所示的确定目标存储节点的过程,基于第二物理位置,确定临时存储节点,并将待追加数据传输至临时存储节点,基于临时存储节点,将待追加数据同步至目标存储节点和预设数目的备份存储节点。对于确定临时存储节点的过程,此处不再进行赘述。例如,设目标存储节点为P1,备份存储节点为P2和P3,P1、P2和P3均位于区域A,如果用户的第二物理位置在区域B,且距离第二物理位置最近的存储节点为P5,则将存储节点P5作为临时存储节点,将追加数据传输至P5,基于P5将追加数据传输至P1,并同步至P2和P3。在实际应用的过程中,用户在日常工作中会不时需要对存储至数据存储系统的数据进行查询,对数据查询的过程参见图2D, 该过程包括步骤212至步骤217中的内容。211. If the second physical location is different from the first physical location, store the data to be added to the backup storage node, and based on the backup storage node, synchronize the data to be added to the target storage node. In the embodiment of the present application, if the second physical location is different from the first physical location and the storage node whose distance from the second physical location satisfies the distance standard is a backup storage node of the target storage node, the data to be added may be stored in In the backup storage node, based on the backup storage node, the data to be added is synchronized to the target storage node, and the data to be added is added to the target storage node. For example, suppose the target storage node is P1, and the backup storage nodes are P2 and P3. If the user's first new physical location is closest to P2, when the user's data addition instruction is received, the additional data carried in the data addition instruction is stored. In P2, the additional data is synchronized to P1 and P3 based on P2. It should be noted that after the data to be added is added to the target storage node, the data to be added needs to be synchronized to other backup storage nodes, so as to ensure that the data stored in multiple backup storage nodes and the target storage node are The data is consistent. In addition, if the second physical location is different from the first physical location and is not in the same storage resource pool as the first physical location, that is, the node closest to the second physical location is not a backup storage node determined according to the target storage node, Then repeat the process of determining the target storage node shown in the above steps 204 to 205, determine the temporary storage node based on the second physical location, and transmit the data to be added to the temporary storage node. Based on the temporary storage node, the to-be-added Data is synchronized to the target storage node and a preset number of backup storage nodes. The process of determining the temporary storage node is not repeated here. For example, suppose the target storage node is P1, and the backup storage nodes are P2 and P3. P1, P2, and P3 are all located in area A. If the user's second physical location is in area B, and the storage node closest to the second physical location is P5 Then, the storage node P5 is used as a temporary storage node, and the additional data is transmitted to P5, and the additional data is transmitted to P1 based on P5, and synchronized to P2 and P3. In the process of practical application, the user needs to query the data stored in the data storage system from time to time in daily work. For the process of querying the data, see FIG. 2D. The process includes the content in steps 212 to 217.
212、接收用户的数据查询请求,获取用户的查询位置,如果查询位置与第一物理位置一致,则执行下述步骤213;如果查询位置与第一物理位置不一致,则执行下述步骤214。在本申请实施例中,数据查询请求中携带待查询数据的数据标识。考虑到用户在后续可能想要对之前存储的数据进行查询,因此,数据存储系统所搭载的客户端可以提供数据查询入口,当检测到用户触发该数据查询入口时,显示数据查询页面,获取用户在数据查询页面上输入的待查询数据的数据标识,确定当前接收到用户的数据查询请求。其中,用户可能由于出差、旅行等原因,用户可能并没有在之前进行数据存储的位置进行数据查询,使得距离用户查询数据的查询位置最近的存储节点并非之前进行数据存储的目标存储节点,因此,在接收到用户的数据查询请求时,需要获取用户进行数据查询的查询位置,将查询位置与之前进行数据存储的第一物理位置进行比对,判断查询位置与第一物理位置是否一致,如果查询位置与第一物理位置一致,则可以直接从目标存储节点中获取待查询数据,也即执行下述步骤213;如果查询位置与第一物理位置不一致,则需要确定与查询位置距离最近的存储节点,并基于该存储节点实现数据的查询,也即执行下述步骤214。212. Receive a user's data query request to obtain the user's query location. If the query location is consistent with the first physical location, perform the following step 213; if the query location is not consistent with the first physical location, perform the following step 214. In the embodiment of the present application, the data query request carries a data identifier of the data to be queried. Considering that the user may want to query the previously stored data in the future, the client provided by the data storage system can provide a data query entry. When it is detected that the user triggers the data query entry, the data query page is displayed to obtain the user. The data identifier of the data to be queried is input on the data query page, and it is determined that the user's data query request is currently received. Among them, the user may not perform data query at the previous data storage location due to business trips, trips, etc., so that the storage node closest to the user's query data location is not the target storage node for data storage. Therefore, When receiving a user's data query request, it is necessary to obtain the user's query location for data query, compare the query location with the first physical location where the data was previously stored, and determine whether the query location is consistent with the first physical location. If the location is consistent with the first physical location, you can directly obtain the data to be queried from the target storage node, that is, perform the following step 213; if the query location is not consistent with the first physical location, you need to determine the storage node that is closest to the query location And implement data query based on the storage node, that is, step 214 described below is performed.
213、如果查询位置与第一物理位置一致,则在目标存储节点中获取数据标识指示的待查询数据,将待查询数据返回给用户。在本申请实施例中,如果查询位置与第一物理位置一致,则在目标存储节点中获取数据标识指示的待查询数据,并直接将待查询数据返回给用户即可。例如,设之前用户在上海存储数据,且目标存储节点为上海的P1,当接收到用户的数据查询请求时,如果检测到用户当前所处的位置为上海,则在P1中获取待查询数据,将待查询数据返回给用户。213: If the query location is consistent with the first physical location, obtain the query data indicated by the data identifier in the target storage node, and return the query data to the user. In the embodiment of the present application, if the query location is consistent with the first physical location, the data to be queried indicated by the data identifier is acquired in the target storage node, and the data to be queried may be directly returned to the user. For example, suppose the user previously stored data in Shanghai, and the target storage node is Shanghai's P1. When a user's data query request is received, if it is detected that the user's current location is Shanghai, then the data to be queried is obtained in P1. Return the data to be queried to the user.
214、如果查询位置与第一物理位置不一致,则重复执行上述确定目标存储节点的 过程,根据查询位置,确定查询存储节点,基于查询存储节点向目标存储节点传输数据标识,并基于查询存储节点接收目标存储节点返回的待查询数据,将待查询数据返回给用户。在本申请实施例中,如果查询位置与第一物理位置不一致,则表示当前距离查询位置最近的存储节点并不是目标存储节点,需要确定与查询位置距离最近的存储节点作为查询存储节点,并基于查询存储节点向目标存储节点传输数据表示,使得目标存储节点可以根据数据标识获取待查询数据,进而将待查询数据返回给查询存储节点,由查询存储节点将待查询数据返回给用户。例如,设之前用户在上海存储数据,且目标存储节点为上海的P1,当接收到用户的数据查询请求时,如果检测到用户当前所处的位置为深圳,则在深圳确定与用户当前所处位置最近的存储节点P5作为查询存储节点,基于P5向P1发送待查询数据的数据标识,并基于P5接收P1返回的待查询数据。需要说明的是,考虑到用户可能多次在同一个查询位置进行数据查询,为了缩短用户进行数据查询的时间,数据存储系统可以对用户在查询位置进行数据查询进行统计,生成用户的查询规律,以便根据查询规律对用户下一次的查询行为进行预测,从而在用户进行数据查询之前做好查询准备,有效缩短用户进行数据查询的时间。具体地,生成用户的查询规律并对用户的查询行为进行预测可以通过下述步骤一至步骤二实现。步骤一、对用户在查询位置进行的数据查询进行统计,生成用户在查询位置的查询规律,查询规律至少包括历史查询次数和历史查询时间。其中,如果检测到用户并没有在之前进行数据存储的位置进行数据查询,则便可以保留本次进行数据查询的查询位置,并在后续持续对用户在该查询位置进行数据查询进行统计,生成用户在该查询位置的查询规律。例如,设之前用户在上海存储数据,且目标存储节点为上海的P1,如果检测到用户在工作日期间位于深圳请求查询数据10次,则在深圳生成的查询规律可为10次和工作日期间。步骤二、基于查询规律,预测用户在查询位置的下一次查询时间,并在下一次查询时间将目 标存储节点中的全部数据同步至查询存储节点中。在本申请实施例中,当生成查询规律后,便可以基于查询规律,预设用户在该查询位置的下一次查询时间,并在下一次查询时间将目标存储节点中的全部数据同步至查询存储节点中,以便用户下一次在该位置进行数据查询时,查询数据节点可以直接提供待查询数据,而无需向目标存储节点请求待查询数据,从而缩短数据查询耗费的时间。例如,继续以上述步骤一中,在深圳生成的查询规律为10次和工作日期间为例,则可以确定查询位置在深圳距离最近的查询节点为P5,在工作日到来之前,将目标存储节点P1中的数据全部同步至查询存储节点P5中。214. If the query location is inconsistent with the first physical location, repeat the above-mentioned process of determining the target storage node, determine the query storage node based on the query location, transmit the data identifier to the target storage node based on the query storage node, and receive based on the query storage node. The query data returned by the target storage node returns the query data to the user. In the embodiment of the present application, if the query location is inconsistent with the first physical location, it means that the storage node closest to the current query location is not the target storage node, and the storage node closest to the query location needs to be determined as the query storage node, and based on The query storage node transmits a data representation to the target storage node, so that the target storage node can obtain the data to be queried according to the data identifier, and then return the data to be queried to the query storage node, and the query storage node returns the data to be queried to the user. For example, suppose the previous user stored data in Shanghai, and the target storage node is P1 in Shanghai. When the user's data query request is received, if it is detected that the user's current location is Shenzhen, then it is determined in Shenzhen that the user is currently in The closest storage node P5 is the query storage node, and sends the data identifier of the data to be queried to P1 based on P5, and receives the data to be queried returned by P1 based on P5. It should be noted that, considering that a user may perform data query at the same query location multiple times, in order to shorten the time for the user to perform data query, the data storage system can perform statistics on the user's data query at the query location to generate the user's query rule. In order to predict the next query behavior of the user according to the query rule, thereby preparing the query before the user performs data query, and effectively shortening the user's time for data query. Specifically, generating a user's query rule and predicting the user's query behavior can be achieved through the following steps 1 to 2. Step 1: Statistic data query performed by the user at the query location to generate a query rule of the user at the query location. The query rule includes at least historical query times and historical query time. Among them, if it is detected that the user has not performed data query at the location where the data was stored previously, the query location for the current data query can be retained, and the user's data query at the query location will be continuously counted in the subsequent generation of users. The query pattern at this query position. For example, if the previous user stored data in Shanghai and the target storage node is P1 in Shanghai, if it is detected that the user requested to query data 10 times in Shenzhen during the working day, the query rule generated in Shenzhen may be 10 times and during the working day. . Step 2: Based on the query rule, predict the next query time of the user at the query location, and synchronize all the data in the target storage node to the query storage node at the next query time. In the embodiment of the present application, after the query rule is generated, the next query time of the user at the query location can be preset based on the query rule, and all data in the target storage node is synchronized to the query storage node at the next query time. So that the next time a user performs a data query at this location, the querying data node can directly provide the querying data without having to request the querying data from the target storage node, thereby reducing the time it takes to query the data. For example, continue to take the first step in the above step, the query rule generated in Shenzhen is 10 times and during the working day as an example, you can determine that the query location in Shenzhen is the closest query node to P5, and before the working day arrives, the target storage node is All the data in P1 are synchronized to the query storage node P5.
215、对用户在查询位置进行数据查询的次数进行统计,生成查询次数,如果查询次数大于次数阈值,则执行下述步骤216;如果查询次数小于次数阈值,则执行下述步骤217。在本申请实施例中,考虑到用户由于搬家或工作调动的原因,导致长时间处在与之前进行数据存储的第一物理位置所属的区域不同的其他区域工作及生活,这样,用户便会长时间在其他区域请求数据查询,因此,可以对用户在查询位置进行数据查询的次数进行统计,生成查询次数,判断查询次数是否大于次数阈值,如果查询次数大于次数阈值,则数据存储系统可以认为用户长时间处于该查询位置,可在该查询位置重新为用户确定新目标存储节点,并将用户在目标存储节点中存储的全部数据迁移至该新目标存储节点中,从而保证进行数据查询的高效率,也即执行下述步骤116;如果查询次数小于次数阈值,则表示当前用户的数据查询操作并不符合进行数据迁移的标准,保持当前数据存储系统对用户提供的数据存储、数据追加和数据查询服务即可,也即执行下述步骤217。215. Count the number of data queries performed by the user at the query location to generate the number of queries. If the number of queries is greater than the number threshold, perform the following step 216; if the number of queries is less than the number threshold, perform the following step 217. In the embodiment of the present application, it is considered that the user may work and live in another area that is different from the area to which the first physical location for data storage belongs for a long time due to relocation or work transfer. In this way, the user will be Data query is requested in other areas at time. Therefore, the number of data queries performed by users at the query location can be counted to generate query times to determine whether the query times are greater than the threshold. If the query times are greater than the threshold, the data storage system can consider the user Being in the query position for a long time, you can re-determine a new target storage node for the user at this query position, and migrate all the data stored by the user in the target storage node to the new target storage node, thereby ensuring the high efficiency of data query That is, the following step 116 is performed; if the number of queries is less than the threshold, it means that the current user's data query operation does not meet the criteria for data migration, and the current data storage system provides the user with data storage, data addition, and data query. Service, that is, The following step 217 rows.
216、如果查询次数大于次数阈值,则将查询存储节点作为新目标存储节点,将目标存储节点中的全部数据同步至新目标存储节点,基于新目标存储节点,确定预设数目 的新备份存储节点,将全部数据备份至预设数目的新备份存储节点中。在本申请实施例中,如果查询次数大于次数阈值,则表示当前可以将用户在目标存储节点中存储的全部数据迁移到查询位置,这样,便可以将该查询位置的查询存储节点作为新目标存储节点,将用户之前在目标存储节点中存储的全部数据同步至新目标存储节点中,并重复执行上述步骤207中所示的内容,基于新目标存储节点,确定预设数目的新备份存储节点,将存储至新目标存储节点中的数据备份至新备份存储节点中,进而在查询位置接收到用户的数据查询请求时,可以直接在新目标存储节点中获取待查询数据即可。例如,设之前用户在上海存储数据,且目标存储节点为上海的P1,查询阈值为100次,如果检测到用户在深圳请求查询数据超过100次,且发送数据查询请求的位置距离深圳的P5最近,则可将P5作为新目标存储节点,将P1中存储的全部数据均复制至P5中,并在P5附近确定新备份存储节点进行数据的备份。需要说明的是,当将全部数据迁移至新目标存储节点后,可以将目标存储节点中存储的有关该用户的全部数据删除,并如果后续接收到用户请求进行数据追加,则直接基于该新目标存储节点进行数据追加即可。216. If the number of queries is greater than the threshold, the query storage node is used as the new target storage node, and all data in the target storage node is synchronized to the new target storage node. Based on the new target storage node, a preset number of new backup storage nodes are determined. To back up all data to a preset number of new backup storage nodes. In the embodiment of the present application, if the number of queries is greater than the threshold, it means that all the data stored by the user in the target storage node can be migrated to the query location, so that the query storage node at the query location can be used as the new target storage. Node, synchronizing all data previously stored by the user in the target storage node to the new target storage node, and repeatedly performing the content shown in step 207 above, to determine a preset number of new backup storage nodes based on the new target storage node, The data stored in the new target storage node is backed up to the new backup storage node, and when the user's data query request is received at the query location, the data to be queried can be obtained directly in the new target storage node. For example, suppose that the user previously stored data in Shanghai and the target storage node is P1 in Shanghai. The query threshold is 100 times. If it is detected that the user has requested data query in Shenzhen more than 100 times, and the location of the data query request is closest to P5 in Shenzhen. , You can use P5 as the new target storage node, copy all data stored in P1 to P5, and determine a new backup storage node near P5 to back up the data. It should be noted that after all data is migrated to the new target storage node, all data related to the user stored in the target storage node can be deleted, and if subsequent user requests are received for data addition, it is directly based on the new target The storage node can add data.
217、如果查询次数小于次数阈值,则保持继续接收用户的数据查询请求,并进行数据查询及数据获取。在本申请实施例中,如果查询次数小于次数阈值,则表示当前不满足将目标存储节点中全部有关该用户的数据迁移至查询位置的条件,这样,保持继续接收用户的数据查询请求,并基于查询存储节点进行数据查询及数据获取的操作即可。本申请实施例提供的数据存储方法,可以根据用户请求进行数据存储的物理位置,确定与物理位置最近的目标存储节点存储用户的待存储数据,使得不同位置的用户存储的数据均实现分布式存储,不会将全部用户的存储数据均存储在一个存储集群中,使得在接收到用户的数据查询请求时,可以快速获取用户需要查询的数据,缩短了查询数据耗费的时间,智能性较好。217. If the number of queries is less than the threshold, the user continues to receive the user's data query request, and performs data query and data acquisition. In the embodiment of the present application, if the number of queries is less than the threshold, it means that the conditions for migrating all data about the user in the target storage node to the query location are currently not met. In this way, the user continues to receive data query requests from users, and based on The query storage node can perform data query and data acquisition operations. The data storage method provided in the embodiment of the present application can determine the target storage node closest to the physical location to store the user's to-be-stored data according to the physical location of the data requested by the user, so that the data stored by users in different locations can achieve distributed storage. , The storage data of all users will not be stored in a storage cluster, so that when the user's data query request is received, the data that the user needs to query can be quickly obtained, the time consumed for querying the data is shortened, and the intelligence is better.
进一步地,作为图2B至2D方法的具体实现,本申请实施例提供了一种数据存储装置,如图3A所示,装置包括:第一接收模块301,定位模块302,第一距离确定模块303,第一节点确定模块304和第一存储模块302。该第一接收模块301,用于接收用户的数据存储指令,数据存储指令中至少包括待存储数据以及用户的终端的终端标识;该定位模块302,用于基于终端标识对用户的终端进行定位,获取用户的第一物理位置;该第一距离确定模块303,用于根据第一物理位置,确定至少一个存储节点,并确定至少一个存储节点与第一物理位置之间的至少一个第一距离,至少一个存储节点部署于第一物理位置指示的存储资源池中;该第一节点确定模块304,用于在至少一个第一距离中提取目标距离,确定目标距离指示的目标存储节点,目标距离为至少一个第一距离中满足第一距离标准的第一距离;该第一存储模块305,用于在数据存储指令中获取待存储数据,将待存储数据存储至目标存储节点。本申请实施例提供的数据存储装置,可以根据用户请求进行数据存储的物理位置,确定与物理位置最近的目标存储节点存储用户的待存储数据,使得不同位置的用户存储的数据均实现分布式存储,不会将全部用户的存储数据均存储在一个存储集群中,使得在接收到用户的数据查询请求时,可以快速获取用户需要查询的数据,缩短了查询数据耗费的时间,智能性较好。如图3B所示,该第一节点确定模块304,包括排序子模块3041和确定子模块3042。该排序子模块3041,用于将至少一个第一距离从大到小进行排序,生成第一排序结果;该确定子模块3042,用于在第一排序结果中提取排在末位的第一距离作为目标距离,确定目标距离指示的存储节点作为目标存储节点。如图3C所示,该装置还包括第二距离确定模块306,第二节点确定模块307和第一备份模块308。该第二距离确定模块306,用于确定目标存储节点与至少一个存储节点中其他存储节点之间的多个第二距离,其他存储节点为至少一个存储节点中除目标节点外的存储节点;该第二节点确定模块307,用于根据多个第二 距离,确定第二距离满足第二距离标准的预设数目的备份存储节点;该第一备份模块308,用于将待存储数据传输至预设数目的备份存储节点,并进行数据备份。如图3D所示,该装置还包括第二接收模块309,第二存储模块310和第一同步模块311。该第二接收模块309,用于接收用户的数据追加指令,获取用户的第二物理位置,数据追加指令携带待追加数据;该第二存储模块310,用于如果第二物理位置与第一物理位置不同,且与第二物理位置的距离满足距离标准的存储节点为预设数目的备份存储节点中的任一备份存储节点,则将待追加数据存储至备份存储节点;该第一同步模块311,用于基于备份存储节点,将待追加数据同步至目标存储节点。如图3E所示,该装置还包括位置获取模块312,第一发送模块313和第二发送模块314。该位置获取模块312,用于接收用户的数据查询请求,获取用户的查询位置,数据查询请求中携带待查询数据的数据标识;该第一发送模块313,用于如果查询位置与第一物理位置一致,则向目标存储节点发送第一数据获取请求,第一数据获取请求用于指示目标存储节点获取数据标识指示的待查询数据,并将待查询数据返回给用户;该第二发送模块314,用于如果查询位置与第一物理位置不一致,则根据查询位置,确定查询存储节点,向查询存储节点发送第二数据获取请求,第二数据获取请求用于指示查询存储节点通过目标存储节点获取待查询数据并将待查询数据返回给用户。如图3F所示,该装置还包括第一统计模块315和预测模块316。该第一统计模块315,用于对用户在查询位置进行的数据查询进行统计,生成用户在查询位置的查询规律,查询规律至少包括历史查询次数和历史查询时间;该预测模块316,用于基于查询规律,预测用户在查询位置的下一次查询时间,并在下一次查询时间将目标存储节点中的全部数据同步至查询存储节点中。如图3G所示,该装置还包括第二统计模块317,第三节点确定模块318,第二同步模块319和第二备份模块320。第二统计模块,用于对用户在查询位置进行数据查询的次数进行统计,生成查 询次数;第三节点确定模块,用于如果查询次数大于次数阈值,则将查询存储节点作为新目标存储节点;第二同步模块,用于将目标存储节点中的全部数据同步至新目标存储节点;第二备份模块,用于基于新目标存储节点,确定预设数目的新备份存储节点,将全部数据备份至预设数目的新备份存储节点中。相应的,本申请实施例还提供了一种存储设备,其上存储有计算机可读指令,该计算机可读指令被处理器执行时实现上述如2B至图2D所示的数据存储方法。基于上述如图2B至图2D所示方法和图3A至图3G所示虚拟装置的实施例。本申请实施例还提供了一种数据存储的实体装置,该实体装置包括存储设备和处理器;所述存储设备,用于存储计算机可读指令;所述处理器,用于执行所述计算机可读指令以实现上述如图2B至图2D所示的数据存储方法。通过以上的实施方式的描述,可以清楚地了解到本申请可以通过硬件实现,也可以借助软件加必要的通用硬件平台的方式来实现。基于这样的理解,本申请的技术方案可以以软件产品的形式体现出来,该软件产品可以存储在一个非易失性可读存储介质(可以是CD-ROM,U盘,移动硬盘等)中,包括若干计算机可读指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本申请各个实施场景所述的方法。Further, as a specific implementation of the methods of FIGS. 2B to 2D, an embodiment of the present application provides a data storage device. As shown in FIG. 3A, the device includes a first receiving module 301, a positioning module 302, and a first distance determining module 303. The first node determination module 304 and the first storage module 302. The first receiving module 301 is configured to receive a user's data storage instruction. The data storage instruction includes at least data to be stored and a terminal identification of the user's terminal. The positioning module 302 is configured to locate the user's terminal based on the terminal identification. Obtaining a first physical location of a user; the first distance determining module 303 is configured to determine at least one storage node according to the first physical location, and determine at least a first distance between the at least one storage node and the first physical location, At least one storage node is deployed in a storage resource pool indicated by a first physical location; the first node determination module 304 is configured to extract a target distance from at least one first distance, and determine a target storage node indicated by the target distance, where the target distance is A first distance among at least one first distance that meets a first distance criterion; the first storage module 305 is configured to obtain data to be stored in a data storage instruction, and store the data to be stored in a target storage node. The data storage device provided in the embodiment of the present application can determine the target storage node closest to the physical location to store the user's to-be-stored data according to the physical location where the user requests data storage, so that the data stored by users in different locations can achieve distributed storage. , The storage data of all users will not be stored in a storage cluster, so that when the user's data query request is received, the data that the user needs to query can be quickly obtained, the time consumed for querying the data is shortened, and the intelligence is better. As shown in FIG. 3B, the first node determination module 304 includes a sorting sub-module 3041 and a determination sub-module 3042. The sorting sub-module 3041 is configured to sort at least one first distance from large to small to generate a first sorting result; and the determining sub-module 3042 is configured to extract a first-ranked first distance from the first sorting result As the target distance, the storage node indicated by the target distance is determined as the target storage node. As shown in FIG. 3C, the device further includes a second distance determination module 306, a second node determination module 307, and a first backup module 308. The second distance determining module 306 is configured to determine a plurality of second distances between the target storage node and other storage nodes in the at least one storage node. The other storage nodes are storage nodes other than the target node among the at least one storage node. A second node determining module 307 is configured to determine, according to a plurality of second distances, a preset number of backup storage nodes whose second distance meets the second distance standard; the first backup module 308 is configured to transmit data to be stored to a pre-stored node. Set a number of backup storage nodes and perform data backup. As shown in FIG. 3D, the device further includes a second receiving module 309, a second storage module 310, and a first synchronization module 311. The second receiving module 309 is configured to receive a user's data addition instruction to acquire a second physical location of the user, and the data addition instruction carries data to be added; and the second storage module 310 is configured to: The storage node with a different location and a distance from the second physical location that satisfies the distance standard is any backup storage node of a preset number of backup storage nodes, and then stores the data to be added to the backup storage node; the first synchronization module 311 , Used to synchronize the data to be added to the target storage node based on the backup storage node. As shown in FIG. 3E, the device further includes a position acquisition module 312, a first sending module 313, and a second sending module 314. The location acquisition module 312 is configured to receive a user's data query request, to obtain the user's query location, and the data query request carries the data identifier of the data to be queried; the first sending module 313 is configured to query the location if the query location is the same as the first physical location. If they are the same, a first data acquisition request is sent to the target storage node, and the first data acquisition request is used to instruct the target storage node to acquire the data to be queried indicated by the data identifier, and return the data to be queried to the user; the second sending module 314, If the query location is inconsistent with the first physical location, the query storage node is determined according to the query location, and a second data acquisition request is sent to the query storage node. The second data acquisition request is used to instruct the query storage node to obtain the pending data through the target storage node. Query the data and return the data to be queried to the user. As shown in FIG. 3F, the device further includes a first statistics module 315 and a prediction module 316. The first statistics module 315 is configured to collect statistics on data queries performed by users at the query location to generate query rules of the user at the query location. The query rule includes at least historical query times and historical query time. The prediction module 316 is configured to be based on The query rule predicts the next query time of the user at the query location, and synchronizes all data in the target storage node to the query storage node at the next query time. As shown in FIG. 3G, the device further includes a second statistics module 317, a third node determination module 318, a second synchronization module 319, and a second backup module 320. The second statistics module is configured to count the number of times the user performs data query at the query location to generate the number of queries; the third node determination module is configured to use the query storage node as a new target storage node if the number of query times is greater than the threshold of the number of times; The second synchronization module is used to synchronize all data in the target storage node to the new target storage node; the second backup module is used to determine a preset number of new backup storage nodes based on the new target storage node, and back up all data to A preset number of new backup storage nodes. Correspondingly, an embodiment of the present application further provides a storage device, which stores computer-readable instructions, and when the computer-readable instructions are executed by a processor, the data storage method shown in FIG. 2B to FIG. 2D is implemented. Based on the foregoing embodiments of the method shown in FIGS. 2B to 2D and the virtual device shown in FIGS. 3A to 3G. An embodiment of the present application further provides a physical device for data storage. The physical device includes a storage device and a processor; the storage device is configured to store computer-readable instructions; and the processor is configured to execute the computer-readable instructions. The instruction is read to implement the data storage method shown in FIG. 2B to FIG. 2D. From the description of the above embodiments, it can be clearly understood that the present application can be implemented by hardware, or by software plus necessary universal hardware platform. Based on this understanding, the technical solution of this application can be embodied in the form of a software product, which can be stored in a non-volatile readable storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), It includes several computer-readable instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of this application.

Claims (20)

  1. 一种数据存储方法,其特征在于,包括:A data storage method, comprising:
    接收用户的数据存储指令,所述数据存储指令中至少包括待存储数据以及所述用户的终端的终端标识;Receiving a user's data storage instruction, where the data storage instruction includes at least data to be stored and a terminal identifier of the user's terminal;
    基于所述终端标识对所述用户的终端进行定位,获取所述用户的第一物理位置;Locating the terminal of the user based on the terminal identifier, and acquiring a first physical location of the user;
    根据所述第一物理位置,确定至少一个存储节点,并确定所述至少一个存储节点与所述第一物理位置之间的至少一个第一距离,所述至少一个存储节点部署于所述第一物理位置指示的存储资源池中;Determining at least one storage node according to the first physical location, and determining at least a first distance between the at least one storage node and the first physical location, the at least one storage node being deployed at the first The storage resource pool indicated by the physical location;
    在所述至少一个第一距离中提取目标距离,确定所述目标距离指示的目标存储节点,所述目标距离为所述至少一个第一距离中满足第一距离标准的第一距离;Extracting a target distance from the at least one first distance, and determining a target storage node indicated by the target distance, where the target distance is a first distance among the at least one first distance that meets a first distance criterion;
    在所述数据存储指令中获取所述待存储数据,将所述待存储数据存储至所述目标存储节点。Acquiring the data to be stored in the data storage instruction, and storing the data to be stored to the target storage node.
  2. 根据权利要求1所述的方法,其特征在于,所述在所述至少一个第一距离中提取目标距离,确定所述目标距离指示的目标存储节点,包括:The method according to claim 1, wherein extracting a target distance from the at least one first distance and determining a target storage node indicated by the target distance comprises:
    将所述至少一个第一距离从大到小进行排序,生成第一排序结果;Ranking the at least one first distance from large to small to generate a first ranking result;
    在所述第一排序结果中提取排在末位的第一距离作为所述目标距离,确定所述目标距离指示的存储节点作为所述目标存储节点。A first distance ranked last in the first ranking result is extracted as the target distance, and a storage node indicated by the target distance is determined as the target storage node.
  3. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, further comprising:
    确定所述目标存储节点与所述至少一个存储节点中其他存储节点之间的多个第二距离,所述其他存储节点为所述至少一个存储节点中除所述目标节点外的存储节点;Determining a plurality of second distances between the target storage node and other storage nodes in the at least one storage node, where the other storage nodes are storage nodes other than the target node among the at least one storage node;
    根据所述多个第二距离,确定第二距离满足第二距离标准的预设数目的备份存储节点;Determining, according to the plurality of second distances, a preset number of backup storage nodes whose second distance meets the second distance criterion;
    将所述待存储数据传输至所述预设数目的备份存储节点,并进行数据备份。Transmitting the data to be stored to the preset number of backup storage nodes, and performing data backup.
  4. 根据权利要求3所述的方法,其特征在于,所述方法还包括:The method according to claim 3, further comprising:
    接收用户的数据追加指令,获取所述用户的第二物理位置,所述数据追加指令携带待追加数据;Receiving a user's data addition instruction to obtain a second physical location of the user, where the data addition instruction carries data to be added;
    如果所述第二物理位置与所述第一物理位置不同,且与所述第二物理位置的距离满足所述距离标准的存储节点为所述预设数目的备份存储节点中的任一备份存储节点,则将所述待追加数据存储至所述备份存储节点;If the second physical location is different from the first physical location, and the storage node whose distance from the second physical location satisfies the distance criterion is any backup storage of the preset number of backup storage nodes Node, storing the data to be added to the backup storage node;
    基于所述备份存储节点,将所述待追加数据同步至所述目标存储节点。Based on the backup storage node, the data to be added is synchronized to the target storage node.
  5. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, further comprising:
    接收所述用户的数据查询请求,获取所述用户的查询位置,所述数据查询请求中携带待查询数据的数据标识;Receiving a data query request of the user, obtaining a query position of the user, and the data query request carrying a data identifier of data to be queried;
    如果所述查询位置与所述第一物理位置一致,则向所述目标存储节点发送第一数据获取请求,所述第一数据获取请求用于指示所述目标存储节点获取所述数据标识指示的待查询数据,并将所述待查询数据返回给所述用户;If the query location is consistent with the first physical location, sending a first data acquisition request to the target storage node, where the first data acquisition request is used to instruct the target storage node to acquire the data identifier indication Data to be queried, and returning the data to be queried to the user;
    如果所述查询位置与所述第一物理位置不一致,则根据所述查询位置,确定查询存储节点,向所述查询存储节点发送第二数据获取请求,所述第二数据获取请求用于指示所述查询存储节点通过所述目标存储节点获取所述待查询数据并将所述待查询数据返回给所述用户。If the query location is inconsistent with the first physical location, determining a query storage node according to the query location, and sending a second data acquisition request to the query storage node, where the second data acquisition request is used to indicate the The query storage node obtains the query data through the target storage node and returns the query data to the user.
  6. 根据权利要求5所述的方法,其特征在于,所述方法还包括:The method according to claim 5, further comprising:
    对所述用户在所述查询位置进行的数据查询进行统计,生成所述用户在所述查询位置的查询规律,所述查询规律至少包括历史查询次数和历史查询时间;Collect statistics on data queries performed by the user at the query location, and generate a query rule of the user at the query location, where the query rule includes at least historical query times and historical query time;
    基于所述查询规律,预测所述用户在所述查询位置的下一次查询时间,并在下一 次查询时间将所述目标存储节点中的全部数据同步至所述查询存储节点中。Based on the query rule, predict the next query time of the user at the query location, and synchronize all data in the target storage node to the query storage node at the next query time.
  7. 根据权利要求5所述的方法,其特征在于,所述方法还包括:The method according to claim 5, further comprising:
    对所述用户在所述查询位置进行数据查询的次数进行统计,生成查询次数;Statistics the number of times that the user performs data query at the query location, and generates the query times;
    如果所述查询次数大于次数阈值,则将所述查询存储节点作为新目标存储节点;If the number of queries is greater than a threshold, the query storage node is used as a new target storage node;
    将所述目标存储节点中的全部数据同步至所述新目标存储节点;Synchronizing all data in the target storage node to the new target storage node;
    基于所述新目标存储节点,确定预设数目的新备份存储节点,将所述全部数据备份至所述预设数目的新备份存储节点中。Based on the new target storage node, a preset number of new backup storage nodes is determined, and the entire data is backed up to the preset number of new backup storage nodes.
  8. 一种数据存储装置,其特征在于,包括:A data storage device, comprising:
    第一接收模块,用于接收用户的数据存储指令,所述数据存储指令中至少包括待存储数据以及所述用户的终端的终端标识;A first receiving module, configured to receive a user's data storage instruction, where the data storage instruction includes at least data to be stored and a terminal identifier of the user's terminal;
    定位模块,用于基于所述终端标识对所述用户的终端进行定位,获取所述用户的第一物理位置;A positioning module, configured to locate the terminal of the user based on the terminal identifier, and obtain a first physical location of the user;
    第一距离确定模块,用于根据所述第一物理位置,确定至少一个存储节点,并确定所述至少一个存储节点与所述第一物理位置之间的至少一个第一距离,所述至少一个存储节点部署于所述第一物理位置指示的存储资源池中;A first distance determining module, configured to determine at least one storage node according to the first physical location, and determine at least a first distance between the at least one storage node and the first physical location, the at least one The storage node is deployed in a storage resource pool indicated by the first physical location;
    第一节点确定模块,用于在所述至少一个第一距离中提取目标距离,确定所述目标距离指示的目标存储节点,所述目标距离为所述至少一个第一距离中满足第一距离标准的第一距离;A first node determining module, configured to extract a target distance from the at least one first distance, and determine a target storage node indicated by the target distance, where the target distance satisfies a first distance criterion among the at least one first distance First distance
    第一存储模块,用于在所述数据存储指令中获取所述待存储数据,将所述待存储数据存储至所述目标存储节点。A first storage module is configured to obtain the data to be stored in the data storage instruction, and store the data to be stored in the target storage node.
  9. 根据权利要求8所述的装置,其特征在于,所述第一节点确定模块,包括:The apparatus according to claim 8, wherein the first node determining module comprises:
    排序子模块,用于将所述至少一个第一距离从大到小进行排序,生成第一排序结 果;A sorting submodule, configured to sort the at least one first distance from large to small to generate a first sorting result;
    确定子模块,用于在所述第一排序结果中提取排在末位的第一距离作为所述目标距离,确定所述目标距离指示的存储节点作为所述目标存储节点。A determining submodule, configured to extract a first-ranked first distance in the first ranking result as the target distance, and determine a storage node indicated by the target distance as the target storage node.
  10. 根据权利要求8所述的装置,其特征在于,所述装置还包括:The apparatus according to claim 8, further comprising:
    第二距离确定模块,用于确定所述目标存储节点与所述至少一个存储节点中其他存储节点之间的多个第二距离,所述其他存储节点为所述至少一个存储节点中除所述目标节点外的存储节点;A second distance determining module, configured to determine a plurality of second distances between the target storage node and other storage nodes in the at least one storage node, where the other storage nodes are in addition to the at least one storage node Storage nodes outside the target node;
    第二节点确定模块,用于根据所述多个第二距离,确定第二距离满足第二距离标准的预设数目的备份存储节点;A second node determining module, configured to determine, according to the plurality of second distances, a preset number of backup storage nodes whose second distances meet a second distance criterion;
    第一备份模块,用于将所述待存储数据传输至所述预设数目的备份存储节点,并进行数据备份。A first backup module is configured to transmit the data to be stored to the preset number of backup storage nodes, and perform data backup.
  11. 根据权利要求10所述的装置,其特征在于,所述装置还包括:The apparatus according to claim 10, further comprising:
    第二接收模块,用于接收用户的数据追加指令,获取所述用户的第二物理位置,所述数据追加指令携带待追加数据;A second receiving module, configured to receive a user's data addition instruction and obtain a second physical location of the user, where the data addition instruction carries data to be added;
    第二存储模块,用于如果所述第二物理位置与所述第一物理位置不同,且与所述第二物理位置的距离满足所述距离标准的存储节点为所述预设数目的备份存储节点中的任一备份存储节点,则将所述待追加数据存储至所述备份存储节点;A second storage module, configured to store the preset number of backup storage nodes if the second physical location is different from the first physical location and the distance from the second physical location meets the distance criterion Any backup storage node among the nodes, storing the data to be added to the backup storage node;
    第一同步模块,用于基于所述备份存储节点,将所述待追加数据同步至所述目标存储节点。A first synchronization module is configured to synchronize the data to be added to the target storage node based on the backup storage node.
  12. 根据权利要求8所述的装置,其特征在于,所述装置还包括:The apparatus according to claim 8, further comprising:
    位置获取模块,用于接收所述用户的数据查询请求,获取所述用户的查询位置,所述数据查询请求中携带待查询数据的数据标识;A location acquisition module, configured to receive a data query request of the user, and obtain a query location of the user, where the data query request carries a data identifier of data to be queried;
    第一发送模块,用于如果所述查询位置与所述第一物理位置一致,则向所述目标存储节点发送第一数据获取请求,所述第一数据获取请求用于指示所述目标存储节点获取所述数据标识指示的待查询数据,并将所述待查询数据返回给所述用户;A first sending module, configured to send a first data acquisition request to the target storage node if the query location is consistent with the first physical location, and the first data acquisition request is used to indicate the target storage node Acquiring the data to be queried indicated by the data identifier, and returning the data to be queried to the user;
    第二发送模块,用于如果所述查询位置与所述物理位置不一致,则根据所述查询位置,确定查询存储节点,向所述查询存储节点发送第二数据获取请求,所述第二数据获取请求用于指示所述查询存储节点通过所述目标存储节点获取所述待查询数据并将所述待查询数据返回给所述用户。A second sending module, configured to determine a query storage node according to the query location if the query location is inconsistent with the physical location, and send a second data acquisition request to the query storage node, the second data acquisition The request is used to instruct the query storage node to obtain the query data through the target storage node and return the query data to the user.
  13. 根据权利要求12所述的装置,其特征在于,所述装置还包括:The device according to claim 12, further comprising:
    第一统计模块,用于对所述用户在所述查询位置进行的数据查询进行统计,生成所述用户在所述查询位置的查询规律,所述查询规律至少包括历史查询次数和历史查询时间;A first statistics module, configured to collect statistics on data queries performed by the user at the query location, and generate a query rule of the user at the query location, where the query rule includes at least historical query times and historical query times;
    预测模块,用于基于所述查询规律,预测所述用户在所述查询位置的下一次查询时间,并在下一次查询时间将所述目标存储节点中的全部数据同步至所述查询存储节点中。A prediction module is configured to predict the next query time of the user at the query location based on the query rule, and synchronize all data in the target storage node to the query storage node at the next query time.
  14. 根据权利要求12所述的装置,其特征在于,所述装置还包括:The device according to claim 12, further comprising:
    第二统计模块,用于对所述用户在所述查询位置进行数据查询的次数进行统计,生成查询次数;A second statistics module, configured to count the number of data queries performed by the user at the query location to generate the query times;
    第三节点确定模块,用于如果所述查询次数大于次数阈值,则将所述查询存储节点作为新目标存储节点;A third node determining module, configured to use the query storage node as a new target storage node if the number of query times is greater than a threshold value;
    第二同步模块,用于将所述目标存储节点中的全部数据同步至所述新目标存储节点;A second synchronization module, configured to synchronize all data in the target storage node to the new target storage node;
    第二备份模块,用于基于所述新目标存储节点,确定预设数目的新备份存储节点, 将所述全部数据备份至所述预设数目的新备份存储节点中。A second backup module is configured to determine a preset number of new backup storage nodes based on the new target storage node, and back up the entire data to the preset number of new backup storage nodes.
  15. 一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现数据存储方法,包括:接收用户的数据存储指令,所述数据存储指令中至少包括待存储数据以及所述用户的终端的终端标识;基于所述终端标识对所述用户的终端进行定位,获取所述用户的第一物理位置;根据所述第一物理位置,确定至少一个存储节点,并确定所述至少一个存储节点与所述第一物理位置之间的至少一个第一距离,所述至少一个存储节点部署于所述第一物理位置指示的存储资源池中;在所述至少一个第一距离中提取目标距离,确定所述目标距离指示的目标存储节点,所述目标距离为所述至少一个第一距离中满足第一距离标准的第一距离;在所述数据存储指令中获取所述待存储数据,将所述待存储数据存储至所述目标存储节点。A computer device includes a memory and a processor. The memory stores computer-readable instructions, and the method of implementing data storage when the processor executes the computer-readable instructions includes receiving data storage of a user. An instruction, the data storage instruction includes at least data to be stored and a terminal identifier of the user's terminal; positioning the user's terminal based on the terminal identifier to obtain a first physical location of the user; A first physical location, determining at least one storage node, and determining at least a first distance between the at least one storage node and the first physical location, the at least one storage node being deployed at the first physical location indication A storage resource pool of the storage device; extracting a target distance from the at least one first distance, and determining a target storage node indicated by the target distance, the target distance being the first of the at least one first distance that meets a first distance criterion A distance; acquiring the data to be stored in the data storage instruction, and storing the data to be stored Storage to the target storage node.
  16. 根据权利要求15所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时实现所述在所述至少一个第一距离中提取目标距离,确定所述目标距离指示的目标存储节点,包括:将所述至少一个第一距离从大到小进行排序,生成第一排序结果;在所述第一排序结果中提取排在末位的第一距离作为所述目标距离,确定所述目标距离指示的存储节点作为所述目标存储节点。The computer device according to claim 15, wherein when the processor executes the computer-readable instructions, the processor extracts a target distance from the at least one first distance, and determines a target indicated by the target distance. The storage node includes: sorting the at least one first distance from large to small to generate a first ranking result; and extracting the first ranked first distance from the first ranking result as the target distance, and determining The storage node indicated by the target distance serves as the target storage node.
  17. 根据权利要求15所述的计算机设备,其特征在于,所述方法还包括:确定所述目标存储节点与所述至少一个存储节点中其他存储节点之间的多个第二距离,所述其他存储节点为所述至少一个存储节点中除所述目标节点外的存储节点;根据所述多个第二距离,确定第二距离满足第二距离标准的预设数目的备份存储节点;将所述待存储数据传输至所述预设数目的备份存储节点,并进行数据备份。The computer device according to claim 15, wherein the method further comprises: determining a plurality of second distances between the target storage node and other storage nodes in the at least one storage node, the other storage The node is a storage node other than the target node among the at least one storage node; according to the plurality of second distances, determining a preset number of backup storage nodes whose second distance satisfies a second distance criterion; The stored data is transmitted to the preset number of backup storage nodes, and data backup is performed.
  18. 一种计算机非易失性可读存储介质,其上存储有计算机可读指令,其特征在 于,所述计算机可读指令被处理器执行时实现数据存储方法,包括:接收用户的数据存储指令,所述数据存储指令中至少包括待存储数据以及所述用户的终端的终端标识;基于所述终端标识对所述用户的终端进行定位,获取所述用户的第一物理位置;根据所述第一物理位置,确定至少一个存储节点,并确定所述至少一个存储节点与所述第一物理位置之间的至少一个第一距离,所述至少一个存储节点部署于所述第一物理位置指示的存储资源池中;在所述至少一个第一距离中提取目标距离,确定所述目标距离指示的目标存储节点,所述目标距离为所述至少一个第一距离中满足第一距离标准的第一距离;在所述数据存储指令中获取所述待存储数据,将所述待存储数据存储至所述目标存储节点。A computer non-volatile readable storage medium having computer readable instructions stored thereon, characterized in that implementing the data storage method when the computer readable instructions are executed by a processor includes: receiving a user's data storage instruction, The data storage instruction includes at least data to be stored and a terminal identifier of the user's terminal; positioning the user's terminal based on the terminal identifier to obtain a first physical location of the user; and according to the first Physical location, determining at least one storage node, and determining at least a first distance between the at least one storage node and the first physical location, the at least one storage node being deployed at a storage indicated by the first physical location A resource pool; extracting a target distance from the at least one first distance, and determining a target storage node indicated by the target distance, the target distance being a first distance among the at least one first distance that meets a first distance criterion Obtaining the data to be stored in the data storage instruction, and storing the data to be stored in the destination Target storage node.
  19. 根据权利要求18所述的计算机非易失性可读存储介质,其特征在于,所述计算机可读指令被处理器执行时实现所述在所述至少一个第一距离中提取目标距离,确定所述目标距离指示的目标存储节点,包括:将所述至少一个第一距离从大到小进行排序,生成第一排序结果;在所述第一排序结果中提取排在末位的第一距离作为所述目标距离,确定所述目标距离指示的存储节点作为所述目标存储节点。The computer non-volatile readable storage medium according to claim 18, wherein when the computer-readable instructions are executed by a processor, the target distance is extracted from the at least one first distance, and the target distance is determined. The target storage node indicated by the target distance includes: sorting the at least one first distance from large to small to generate a first ranking result; and extracting the first distance ranked last in the first ranking result as For the target distance, a storage node indicated by the target distance is determined as the target storage node.
  20. 根据权利要求18所述的计算机非易失性可读存储介质,其特征在于,所述方法还包括:确定所述目标存储节点与所述至少一个存储节点中其他存储节点之间的多个第二距离,所述其他存储节点为所述至少一个存储节点中除所述目标节点外的存储节点;根据所述多个第二距离,确定第二距离满足第二距离标准的预设数目的备份存储节点;将所述待存储数据传输至所述预设数目的备份存储节点,并进行数据备份。The computer non-volatile readable storage medium according to claim 18, wherein the method further comprises: determining a plurality of first storage nodes between the target storage node and other storage nodes in the at least one storage node. Two distances, the other storage nodes are storage nodes other than the target node among the at least one storage node; and based on the plurality of second distances, determining a preset number of backups whose second distance meets a second distance criterion A storage node; transmitting the data to be stored to the preset number of backup storage nodes, and performing data backup.
PCT/CN2018/111119 2018-08-01 2018-10-21 Data storage method and apparatus, computer device, and computer storage medium WO2020024445A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810865642.6 2018-08-01
CN201810865642.6A CN109063121B (en) 2018-08-01 2018-08-01 Data storage method, device, computer equipment and computer storage medium

Publications (1)

Publication Number Publication Date
WO2020024445A1 true WO2020024445A1 (en) 2020-02-06

Family

ID=64832546

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/111119 WO2020024445A1 (en) 2018-08-01 2018-10-21 Data storage method and apparatus, computer device, and computer storage medium

Country Status (2)

Country Link
CN (1) CN109063121B (en)
WO (1) WO2020024445A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117389469A (en) * 2023-09-21 2024-01-12 华南理工大学 Internet data storage method, device, system and medium

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110012108A (en) * 2019-04-15 2019-07-12 深圳市网心科技有限公司 Data copy storage method, method for down loading, cloud storage system and relevant apparatus
CN110505277B (en) * 2019-07-18 2022-04-26 北京奇艺世纪科技有限公司 Data caching method and device and client
CN113177075B (en) * 2021-04-08 2023-10-03 中电鹰硕(深圳)智慧互联有限公司 Handwriting data storage method and system based on big data platform
CN113973118B (en) * 2021-10-18 2022-09-02 深圳国人无线通信有限公司 Data cloud storage service system and service method based on communication base station

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120166394A1 (en) * 2010-12-24 2012-06-28 Kim Mi-Jeom Distributed storage system and method for storing objects based on locations
CN103532999A (en) * 2012-07-05 2014-01-22 腾讯科技(深圳)有限公司 Data transmission method, mobile device and background service system
CN106970964A (en) * 2017-03-21 2017-07-21 深圳广联赛讯有限公司 Gps data information query method and system based on shared drive
CN107085501A (en) * 2016-02-16 2017-08-22 杭州海康威视数字技术股份有限公司 A kind of data storage, data migration method and device
CN108287666A (en) * 2018-01-16 2018-07-17 中国人民公安大学 Date storage method and device for cloud storage environment

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3015999A4 (en) * 2013-09-29 2016-08-17 Huawei Tech Co Ltd Data processing method, system and client
US9906596B2 (en) * 2015-01-23 2018-02-27 Kodiak Data Resource node interface protocol
CN107959702B (en) * 2016-10-17 2020-09-29 财付通支付科技有限公司 Routing method and device
CN107087038A (en) * 2017-06-29 2017-08-22 珠海市魅族科技有限公司 A kind of method of data syn-chronization, synchronizer, device and storage medium
CN107707616B (en) * 2017-08-21 2019-02-12 贵州白山云科技股份有限公司 A kind of data transmission method and system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120166394A1 (en) * 2010-12-24 2012-06-28 Kim Mi-Jeom Distributed storage system and method for storing objects based on locations
CN103532999A (en) * 2012-07-05 2014-01-22 腾讯科技(深圳)有限公司 Data transmission method, mobile device and background service system
CN107085501A (en) * 2016-02-16 2017-08-22 杭州海康威视数字技术股份有限公司 A kind of data storage, data migration method and device
CN106970964A (en) * 2017-03-21 2017-07-21 深圳广联赛讯有限公司 Gps data information query method and system based on shared drive
CN108287666A (en) * 2018-01-16 2018-07-17 中国人民公安大学 Date storage method and device for cloud storage environment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117389469A (en) * 2023-09-21 2024-01-12 华南理工大学 Internet data storage method, device, system and medium

Also Published As

Publication number Publication date
CN109063121A (en) 2018-12-21
CN109063121B (en) 2024-04-05

Similar Documents

Publication Publication Date Title
WO2020024445A1 (en) Data storage method and apparatus, computer device, and computer storage medium
WO2018000993A1 (en) Distributed storage method and system
CN106612301B (en) The method for pushing and device of more new data
JP6222680B2 (en) Method, apparatus and system for implementing location information services
US9392081B2 (en) Method and device for sending requests
KR20200083608A (en) Video live broadcasting method and device
JP2008516528A (en) Identifying service nodes in the network
US9787560B2 (en) Effective service node traffic routing
US20180013610A1 (en) File delivery method, apparatus and system
US20140337471A1 (en) Migration assist system and migration assist method
US12010164B2 (en) System for providing exact communication delay guarantee of request response for distributed service
KR20220141070A (en) Apparatus for container orchestration in geographically distributed multi cloud environment and method using the same
CN113811928B (en) Distributed memory space data storage for K nearest neighbor search
CN103607418A (en) Large-scale data partitioning system and partitioning method based on cloud service data characteristics
JP4867799B2 (en) Crawling method, program and device thereof, agent device, network system
CN109325056A (en) A kind of big data processing method and processing device, communication equipment
CN102739703A (en) Method and system for data migration in peer-to-peer network
US9350606B2 (en) System and method for assigning server to terminal and efficiently delivering messages to the terminal
CN110601891B (en) Alarm processing method and related device
CN114466031B (en) CDN system node configuration method, device, equipment and storage medium
CN108063832A (en) A kind of cloud storage system and its storage method
WO2013120412A1 (en) Data download method, terminal, server and system
CN109672721B (en) Media file pushing method and device, server and computer readable storage medium
US11206302B2 (en) Method and device for feeding back a resource file
US11606415B2 (en) Method, apparatus and system for processing an access request in a content delivery system

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: 18928199

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: 18928199

Country of ref document: EP

Kind code of ref document: A1