Movatterモバイル変換


[0]ホーム

URL:


CN110688426B - Second-level heartbeat synchronization method for block chain big database - Google Patents

Second-level heartbeat synchronization method for block chain big database
Download PDF

Info

Publication number
CN110688426B
CN110688426BCN201910774618.6ACN201910774618ACN110688426BCN 110688426 BCN110688426 BCN 110688426BCN 201910774618 ACN201910774618 ACN 201910774618ACN 110688426 BCN110688426 BCN 110688426B
Authority
CN
China
Prior art keywords
database
file
blockchain
newly added
data
Prior art date
Legal status (The legal status 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 status listed.)
Expired - Fee Related
Application number
CN201910774618.6A
Other languages
Chinese (zh)
Other versions
CN110688426A (en
Inventor
王知康
皮人杰
张玉成
刘文建
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing University of Posts and Telecommunications
Original Assignee
Beijing University of Posts and Telecommunications
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 Beijing University of Posts and TelecommunicationsfiledCriticalBeijing University of Posts and Telecommunications
Priority to CN201910774618.6ApriorityCriticalpatent/CN110688426B/en
Publication of CN110688426ApublicationCriticalpatent/CN110688426A/en
Application grantedgrantedCritical
Publication of CN110688426BpublicationCriticalpatent/CN110688426B/en
Expired - Fee Relatedlegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Images

Classifications

Landscapes

Abstract

Translated fromChinese

本发明涉及一种区块链大数据库的秒级心跳同步方法。包括以下步骤:根据区块链大数据库中的数据大小与传输速度,定义同步周期为2n秒,n等于区块链大数据库中的数据大小除以传输速度;定义现有区块链大数据库中的数据为file 0;从2n秒开始同步file 0,到2n‑1秒时file 0同步完成,2n秒~2n‑1秒内现有区块链大数据库中新增加的数据为file 1,……,直到20秒时将file n写入新加区块链大数据库中,至此所有数据同步完成;新加区块链大数据库与现有区块链大数据库同步完成后,投入运行。本发明按照2的倍数进行数据同步,使同步过程中的区块链大数据库能够持续运行,以秒级更新的区块链大数据库同步。

Figure 201910774618

The invention relates to a second-level heartbeat synchronization method for a large blockchain database. It includes the following steps: According to the data size and transmission speed in the large blockchain database, define the synchronization period as 2n seconds, where n is equal to the data size in the large blockchain database divided by the transmission speed; define the existing large blockchain database The data in file 0 is file 0; the synchronization of file 0 starts from 2n seconds, and the synchronization of file 0 is completed at 2 n 1 seconds, and the newly added data in the existing blockchain large database within 2n seconds to 2n‑1 seconds It is file 1, ..., until20 seconds later, file n is written into the newly added blockchain database, and all data synchronization is completed; after the synchronization of the newly added blockchain database and the existing blockchain database is completed ,put into service. The invention performs data synchronization according to a multiple of 2, so that the large blockchain database in the synchronization process can run continuously, and the large blockchain database updated in seconds is synchronized.

Figure 201910774618

Description

Second-level heartbeat synchronization method for block chain big database
Technical Field
The invention relates to the technical field of computers, in particular to a second-level heartbeat synchronization method for a large block chain database.
Background
In the blockchain system, when a database server provides services, a plurality of independent big data servers are usually deployed to cooperate in a synchronous manner, so as to ensure the accuracy, reliability and incapability of modifying data. Therefore, it becomes a challenge to quickly synchronize and store these data in multiple databases.
In the prior art, when data synchronization is performed on a plurality of independent large databases, the service of the large databases is often required to be stopped temporarily during the synchronization. When the database becomes very large and a new server needs to be added, a long time of data transmission is needed to establish the synchronized database, so that the service may be stopped for tens of minutes each time the database is synchronized, and the service can be provided only after the database synchronization is completed, which seriously affects the use of users. Therefore, the expectations of users cannot be met in a global service.
Disclosure of Invention
Aiming at the defects in the prior art, the invention aims to provide a second-level heartbeat synchronization method for a large block chain database. The invention is suitable for a plurality of independent synchronous large databases, can enable the large-capacity independent databases to achieve second-level synchronization, and is particularly suitable for data synchronization of uninterrupted and single-center-free block chain databases.
In order to achieve the above purposes, the technical scheme adopted by the invention is as follows:
a second-level heartbeat synchronization method for a block chain big database comprises the following steps:
s1, defining the synchronous period T of data synchronization in the large database of block chain according to the size and transmission speed of the data stored in the large database of block chain1=2nSecond, each block chain big database can only start to synchronize according to the synchronization period when synchronizing; the n is equal to the size of the data stored in the existing blockchain big database divided by the transmission speed;
s2, defining the data in the existing block chain big database as file 0;
s3, fromsynchronization cycle 2n-1The second begins to write the file 0 in the existing block chain big database into the newly added block chain big database to 2nSecond time file 0 write is complete, will 2n-1Second-2nDefining newly added data in the existing block chain big database within second time asfile 1;
s4, from 2n-2Second begins writingfile 1 into the newly added blockchain big database to 2n-1Second time file 1 write is completed, will 2n-2Second-2n-1Defining newly added data in the existing block chain big database within second time asfile 2;
s5, and so on, from 20The file n-1 of the existing block chain big database is written into the newly added block chain big database to 21When the second file n-1 write is completed, will20Second-21Defining newly added data in the existing block chain big database within second time as file n;
s6, from 20The file n of the existing block chain big database is written into the newly added block chain big database when the file n is written, and all data in the block chain big database are synchronously finished;
s7, when data transmission error occurs in the data synchronization process, starting to perform data synchronization again from the next synchronization period; when no data transmission error occurs in the data synchronization process, putting the newly added block chain large database into operation;
and S8, after the newly added blockchain big database is put into operation, the regenerated new data is updated in the newly synchronized blockchain big database and the existing blockchain big database at the same time.
On the basis of the technical scheme, defining the actual time required for completing synchronization of the large database of the block chain as T; in step S1, the actual time T required for completing synchronization of the large database of the block chain is less than or equal to the synchronization period T1
On the basis of the technical scheme, in the data synchronization process, the existing block chain big database does not need to stop service, and the data updating speed of the existing block chain big database is 1 time/second.
On the basis of the above technical solution, in step S3, when file 0 to file n are written into the newly added blockchain big database, it needs to be determined whether the operating system of the existing blockchain big database is consistent with the operating system of the newly added blockchain big database; if the file is consistent with the file system directory specified by the newly added large block chain database, directly writing the files 0 to n into the file system directory specified by the newly added large block chain database; and if not, converting the files 0 to the files n to enable the files 0 to the files n to be in line with the operating system of the newly added large block chain database, and writing the converted files 0 to files n into a file system directory specified by the newly added large block chain database.
On the basis of the above technical solution, in step S3, when file 0 to file n are written into the newly added blockchain big database, it needs to be determined whether the type of the configuration file of the existing blockchain big database is consistent with the type of the configuration file of the newly added blockchain big database; if the file is consistent with the file system directory specified by the newly added large block chain database, directly writing the files 0 to n into the file system directory specified by the newly added large block chain database; and if not, converting the configuration file types of the newly added large block chain database, and writing the converted files 0-file n into a file system directory specified by the newly added large block chain database.
Based on the above technical solution, in step S8, the regenerated new data will be updated in the newly added blockchain big database and the existing blockchain big database at the same time, and the updating speed is 1 time/second.
The second-level heartbeat synchronization method for the block chain big database has the following beneficial effects:
1. the time required for synchronizing the large database of the block chain at each time is at most 2 synchronization periodsnSecond, and the existing blockchain large database does not need to be out of service during database synchronization.
2. The transmission speed of the newly added large block chain database can be optimized and is synchronous with the data of each stage in the existing large block chain database.
3. And in the operation process of the block chain large database, the data updating speed is 1 time/second.
4. The invention utilizes a hierarchical synchronization mode to ensure that the large block chain database with any size can run simultaneously with the existing large block chain database, and the database updated in a second level is synchronized.
Drawings
The invention has the following drawings:
FIG. 1 is a diagram illustrating the data block partitioning and transmission time of a large database of a prior art block chain in the method of the present invention;
FIG. 2 is a schematic diagram of a data transmission time axis in a newly added large database with block chains in the method of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings.
As shown in fig. 1 and fig. 2, the second-level heartbeat synchronization method for a large block chain database according to the present invention includes the following steps:
s1, defining the synchronous period T of data synchronization in the large database of block chain according to the size and transmission speed of the data stored in the large database of block chain1=2nSecond, each block chain big database can only start to synchronize according to the synchronization period when synchronizing; the n is equal to the size of the data stored in the existing blockchain big database divided by the transmission speed;
s2, defining the data in the existing block chain big database as file 0;
s3, fromsynchronization cycle 2n-1The second begins to write the file 0 in the existing block chain big database into the newly added block chain big database to 2nSecond time file 0 write is complete, will 2n-1Second-2nDefining newly added data in the existing block chain big database within second time asfile 1;
s4, from 2n-2Second begins writingfile 1 into the newly added blockchain big database to 2n-1Second time file 1 write is completed, will 2n-2Second-2n-1Defining newly added data in the existing block chain big database within second time asfile 2;
s5, and so on, from 20The file n-1 of the existing block chain big database is written into the newly added block chain big database to 21When the second file n-1 is written, 2 is written0Second-21Defining newly added data in the existing block chain big database within second time as file n;
s6, from 20The file n of the existing block chain big database is written into the newly added block chain big database when the file n is written, and all data in the block chain big database are synchronously finished;
s7, when data transmission error occurs in the data synchronization process, starting to perform data synchronization again from the next synchronization period; when no data transmission error occurs in the data synchronization process, putting the newly added block chain large database into operation;
and S8, after the newly added blockchain big database is put into operation, the regenerated new data is updated in the newly synchronized blockchain big database and the existing blockchain big database at the same time.
On the basis of the technical scheme, defining the actual time required for completing synchronization of the large database of the block chain as T; in step S1, the actual time T required for completing synchronization of the large database of the block chain is less than or equal to the synchronization period T1
On the basis of the technical scheme, in the data synchronization process, the existing block chain big database does not need to stop service, and the data updating speed of the existing block chain big database is 1 time/second.
On the basis of the above technical solution, in step S3, when file 0 to file n are written into the newly added blockchain big database, it needs to be determined whether the operating system of the existing blockchain big database is consistent with the operating system of the newly added blockchain big database; if the file is consistent with the file system directory specified by the newly added large block chain database, directly writing the files 0 to n into the file system directory specified by the newly added large block chain database; and if not, converting the files 0 to the files n to enable the files 0 to the files n to be in line with the operating system of the newly added large block chain database, and writing the converted files 0 to files n into a file system directory specified by the newly added large block chain database.
On the basis of the above technical solution, in step S3, when file 0 to file n are written into the newly added blockchain big database, it needs to be determined whether the type of the configuration file of the existing blockchain big database is consistent with the type of the configuration file of the newly added blockchain big database; if the file is consistent with the file system directory specified by the newly added large block chain database, directly writing the files 0 to n into the file system directory specified by the newly added large block chain database; and if not, converting the configuration file types of the newly added large block chain database, and writing the converted files 0-file n into a file system directory specified by the newly added large block chain database.
Based on the above technical solution, in step S8, the regenerated new data will be updated in the newly added blockchain big database and the existing blockchain big database at the same time, and the updating speed is 1 time/second.
Example (b):
step 1, if the data size in the existing block chain big database is 100Gb, and the data transmission speed is 200Mb/s, the prediction time required for completing the synchronization of the block chain big database is 512s, namely T1=29And second.
Step 2, defining the data in the large database of the existing block chain as file 0;
the operating system and the configuration file type of the existing block chain big database are consistent with those of the newly added block chain big database;
step 3, fromstep 28The second begins to write the file 0 of the existing block chain big database into the newly added block chain big database to 29Second time file 0 write is complete, will 28Second-29Defining newly added data in the existing block chain big database within second time asfile 1;
step 4, from 27The second begins to writefile 1 of the existing block chain big database into the newly added block chain big database to 28Second time file 1 write is completed, will 27Second-28Defining newly added data in the existing block chain big database within second time asfile 2;
step 5, analogizing fromstep 20The file 8 of the existing block chain big database is written into the newly added block chain big database from second to 21Second time file 8 write is complete, will 20Second-21Defining newly added data in the existing block chain big database within second time as file 9;
step 6, from 20The file 9 of the existing block chain big database is written into the newly added block chain big database at the beginning of the second till the file 9 is written, and all data in the block chain big database are synchronously finished;
step 7, when no data transmission error occurs in the data synchronization process of the whole block chain big database, putting the newly added block chain big database into operation;
and 8, after the newly added block chain big database is put into operation, the regenerated new data is updated in the newly synchronized block chain big database and the existing block chain big database at the updating speed of 1 time/second.
When the method of the invention is adopted to carry out synchronization of the large database of the block chain, the time required by each synchronization is at most 2nSecond, and in a blockchain big databaseThe existing blockchain large database does not need to stop service in the synchronization process. And after the synchronization of the newly added block chain big database and the existing block chain big database is completed, putting into operation, and simultaneously updating the regenerated new data in the newly synchronized block chain big database and the existing block chain big database.
The method of the invention synchronizes data according to multiple of 2 until the last 1 second data in the large database of the existing block chain is synchronized. After the data synchronization is finished, the block chain database with any size can run simultaneously with the existing block chain large database, and the block chain large database synchronization of second-level updating is realized.
Those not described in detail in this specification are within the skill of the art.

Claims (6)

Translated fromChinese
1.一种区块链大数据库的秒级心跳同步方法,其特征在于,包括以下步骤:1. a second-level heartbeat synchronization method for a large database of block chain, is characterized in that, comprises the following steps:S1,根据现有区块链大数据库中所存储数据的大小与传输速度,定义区块链大数据库中数据同步的同步周期T1=2n秒,每个区块链大数据库进行同步时只能按同步周期开始进行同步;所述n等于现有区块链大数据库中所存储数据的大小除以传输速度;S1, according to the size and transmission speed of the data stored in the existing large blockchain database, define the synchronization period T1 =2n seconds for data synchronization in the large blockchain database. The synchronization can be started according to the synchronization cycle; the n is equal to the size of the data stored in the existing blockchain large database divided by the transmission speed;S2,将现有区块链大数据库中的数据定义为file 0;S2, define the data in the existing blockchain database as file 0;S3,从同步周期2n-1秒开始将现有区块链大数据库中的file 0写入新加区块链大数据库,到2n秒时file 0写入完成,将2n-1秒~2n秒时间内现有区块链大数据库中新增加的数据定义为file 1;S3, from the synchronization period of 2n-1 seconds, the file 0 in the existing blockchain large database is written into the newly added blockchain large database, and the writing of file 0 is completed at 2n seconds, and the 2n-1 seconds The newly added data in the existing blockchain large database within ~2n seconds is defined as file 1;S4,从2n-2秒开始将file 1写入新加区块链大数据库中,到2n-1秒时file 1写入完成,将2n-2秒~2n-1秒时间内现有区块链大数据库中新增加的数据定义为file 2;S4, write file 1 into the large database of the newly added blockchain from 2n-2 seconds, and complete the writing of file 1 at 2n-1 seconds, and write file 1 within 2n-2 seconds to 2n-1 seconds The newly added data in the existing blockchain database is defined as file 2;S5,以此类推,从20秒开始将现有区块链大数据库的file n-1写入新加区块链大数据库,到21秒时file n-1写入完成,将20秒~21秒时间内现有区块链大数据库中新增加的数据定义为file n;S5, and so on, from20 seconds, the file n-1 of the existing blockchain database is written into the newly added blockchain database, and the file n-1 is written in 21 seconds, and the20 The newly added data in the existing blockchain large database within seconds to 21 seconds is defined as file n;S6,从20秒开始将现有区块链大数据库的file n写入新加区块链大数据库,到file n写入完成,至此区块链大数据库中的所有数据同步完成;S6, from20 seconds, the file n of the existing blockchain database is written into the newly added blockchain database, until the file n is written, and all data in the blockchain database is synchronized.S7,当数据同步过程中出现数据传输错误时,从下一个同步周期开始重新进行数据同步;当数据同步过程中没有出现数据传输错误时,则将新加区块链大数据库投入运行;S7, when there is a data transmission error during the data synchronization process, the data synchronization will be restarted from the next synchronization cycle; when there is no data transmission error during the data synchronization process, the newly added blockchain database will be put into operation;S8,新加区块链大数据库投入运行后,再产生的新数据将在新同步的区块链大数据库和现有区块链大数据库中同时更新。S8, after the newly added blockchain database is put into operation, the new data generated will be updated in the newly synchronized blockchain database and the existing blockchain database at the same time.2.如权利要求1所述的区块链大数据库的秒级心跳同步方法,其特征在于,定义完成区块链大数据库同步所需的实际时间为T;步骤S1中,完成区块链大数据库同步所需的实际时间T≤同步周期T12. The second-level heartbeat synchronization method of the blockchain large database according to claim 1, wherein the actual time required to complete the synchronization of the blockchain large database is defined as T; in step S1, the completion of the blockchain large database is T. The actual time T required for database synchronization ≤ synchronization period T1 .3.如权利要求1所述的区块链大数据库的秒级心跳同步方法,其特征在于,在数据同步过程中,现有区块链大数据库不需停止服务,现有区块链大数据库的数据更新速度为1次/秒。3. The second-level heartbeat synchronization method of the blockchain large database as claimed in claim 1, characterized in that, in the data synchronization process, the existing blockchain large database does not need to stop service, and the existing blockchain large database does not need to stop service. The data update rate is 1 time/second.4.如权利要求1所述的区块链大数据库的秒级心跳同步方法,其特征在于,步骤S3中,将file 0~file n写入新加区块链大数据库时,需要判断现有区块链大数据库的操作系统与新加区块链大数据库的操作系统是否一致;如果一致,则直接将file 0~file n写入新加区块链大数据库指定的文件系统目录下;如果不一致,则对file 0~file n进行转换使其符合新加区块链大数据库的操作系统,将转换后的file 0~file n写入新加区块链大数据库指定的文件系统目录下。4. The second-level heartbeat synchronization method for a large blockchain database according to claim 1, wherein in step S3, when writing file 0 to file n into the newly added large blockchain database, it is necessary to judge the existing Whether the operating system of the large blockchain database is consistent with the operating system of the newly added large blockchain database; if they are the same, directly write file 0 to file n to the file system directory specified by the newly added large blockchain database; if If they are inconsistent, convert file 0 to file n to make it conform to the operating system of the newly added blockchain database, and write the converted file 0 to file n into the file system directory specified by the newly added blockchain database.5.如权利要求1所述的区块链大数据库的秒级心跳同步方法,其特征在于,步骤S3中,将file 0~file n写入新加区块链大数据库时,需要判断现有区块链大数据库的配置文件类型与新加区块链大数据库的配置文件类型是否一致;如果一致,则直接将file 0~filen写入新加区块链大数据库指定的文件系统目录下;如果不一致,则对新加区块链大数据库的配置文件类型进行转换,将转换后的file 0~file n写入新加区块链大数据库指定的文件系统目录下。5. The second-level heartbeat synchronization method for a large blockchain database according to claim 1, wherein in step S3, when writing file 0 to file n into the newly added large blockchain database, it is necessary to judge the existing Whether the configuration file type of the large blockchain database is consistent with the configuration file type of the newly added large blockchain database; if they are the same, directly write file 0~filen to the file system directory specified by the newly added large blockchain database; If it is inconsistent, convert the configuration file type of the newly added blockchain database, and write the converted file 0 to file n into the file system directory specified by the newly added blockchain database.6.如权利要求1所述的区块链大数据库的秒级心跳同步方法,其特征在于,步骤S8中,再产生的新数据将在新加区块链大数据库和现有区块链大数据库中同时更新,更新速度为1次/秒。6. The second-level heartbeat synchronization method of the block chain large database as claimed in claim 1, is characterized in that, in step S8, the new data generated again will be added in the new block chain large database and the existing block chain large database. The database is updated at the same time, and the update speed is 1 time/second.
CN201910774618.6A2019-08-212019-08-21Second-level heartbeat synchronization method for block chain big databaseExpired - Fee RelatedCN110688426B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201910774618.6ACN110688426B (en)2019-08-212019-08-21Second-level heartbeat synchronization method for block chain big database

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201910774618.6ACN110688426B (en)2019-08-212019-08-21Second-level heartbeat synchronization method for block chain big database

Publications (2)

Publication NumberPublication Date
CN110688426A CN110688426A (en)2020-01-14
CN110688426Btrue CN110688426B (en)2021-12-10

Family

ID=69108392

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201910774618.6AExpired - Fee RelatedCN110688426B (en)2019-08-212019-08-21Second-level heartbeat synchronization method for block chain big database

Country Status (1)

CountryLink
CN (1)CN110688426B (en)

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN106506493A (en)*2016-10-272017-03-15摩登大道时尚电子商务有限公司Data processing method based on block platform chain
CN107317842B (en)*2017-05-312019-11-22北京大学深圳研究生院 NDN-based blockchain synchronization method and device
US20190197130A1 (en)*2017-12-212019-06-27Microsoft Technology Licensing, LlcEnsuring consistency in distributed incremental content publishing
CN108810112B (en)*2018-05-272020-10-27佛山市虚拟现实大数据产业研究院有限公司Node synchronization method and device for market supervision block chain system
CN109727132B (en)*2018-12-282021-03-23合肥达朴汇联科技有限公司Method and device for acquiring block chain consensus node, electronic equipment and storage medium

Also Published As

Publication numberPublication date
CN110688426A (en)2020-01-14

Similar Documents

PublicationPublication DateTitle
CN105243067B (en)A kind of method and device for realizing real-time incremental synchrodata
CN109271452B (en) DB2 database data synchronization update method and device
CN105468475A (en)Backup method and backup device of database
CN104750773A (en)Index maintenance based on a comparison of rebuild vs. update
US20090204570A1 (en)Method and apparatus for performing multi-stage table updates
CN109947801A (en)Database in phase system, method and device
CN105404536B (en)Method for updating terminal software and terminal software upgrading device
CN105512171A (en)Database synchronizing method and apparatus
CN102722579A (en)Bisynchronous method for internal database of cluster memory system
CN108319617A (en)Determine the method, apparatus and method for handover control, device of database principal and subordinate's difference
CN112383610A (en)Synchronous processing method and system for block chain state data
CN115080666A (en) Data synchronization method, system, electronic device and storage medium
WO2025189868A1 (en)Distributed database query system and method supporting multi-replica consistent read, device, and medium
CN110688426B (en)Second-level heartbeat synchronization method for block chain big database
CN113297230B (en)Data verification method and device
EP3147789B1 (en)Method for re-establishing standby database, and apparatus thereof
CN116150126A (en)Data processing method, device, electronic equipment and storage medium
CN108984337A (en)A kind of restorative procedure of data synchronous abnormality, prosthetic device, medium and calculate equipment
CN110083372B (en)Block chain data version upgrading method
CN115587114A (en)System and query method
CN113051248B (en) Fragmentation defragmentation method, device, equipment and storage medium based on master-slave database
CN112231324B (en)System and method for realizing incremental data comparison
CN115391457B (en)Cross-database data synchronization method, device and storage medium
CN117851508A (en)Incremental data synchronization breakpoint continuous transmission method and system
CN110147355B (en)Data synchronization method, device and server

Legal Events

DateCodeTitleDescription
PB01Publication
PB01Publication
SE01Entry into force of request for substantive examination
SE01Entry into force of request for substantive examination
GR01Patent grant
GR01Patent grant
CF01Termination of patent right due to non-payment of annual fee
CF01Termination of patent right due to non-payment of annual fee

Granted publication date:20211210


[8]ページ先頭

©2009-2025 Movatter.jp