一種分布式系統(tǒng)數(shù)據(jù)一致性處理方法、裝置和系統(tǒng)的制作方法
【技術(shù)領(lǐng)域】
[0001]本發(fā)明涉及數(shù)據(jù)處理技術(shù)領(lǐng)域,特別是涉及一種分布式系統(tǒng)數(shù)據(jù)一致性處理方法、裝置和系統(tǒng)。
【背景技術(shù)】
[0002]數(shù)據(jù)庫(kù)是按照數(shù)據(jù)結(jié)構(gòu)來組織、存儲(chǔ)和管理數(shù)據(jù)的倉(cāng)庫(kù)。數(shù)據(jù)庫(kù)在數(shù)據(jù)存儲(chǔ)和處理得到了廣泛的應(yīng)用。目前大型互聯(lián)網(wǎng)應(yīng)用的分布式數(shù)據(jù)庫(kù)事務(wù)處理大多采用BASE模型,這種模型區(qū)別于關(guān)系數(shù)據(jù)庫(kù)的ACID模型的特點(diǎn)是采用異步更新的方式,允許數(shù)據(jù)狀態(tài)可以有一段時(shí)間不同步,只要達(dá)到數(shù)據(jù)的最終一致即可。也就是說,BASE模型通過犧牲實(shí)時(shí)高一致性,獲得了高可用性和高可靠性。因此,如何對(duì)不一致的數(shù)據(jù)進(jìn)行監(jiān)控和處理就成為了一個(gè)需要解決的問題。
[0003]現(xiàn)有技術(shù)中,存在一種監(jiān)控多數(shù)據(jù)庫(kù)之間數(shù)據(jù)一致性的方法,通過應(yīng)用系統(tǒng)發(fā)送驗(yàn)證請(qǐng)求來觸發(fā)數(shù)據(jù)的一致性監(jiān)控,根據(jù)所述驗(yàn)證請(qǐng)求中所述涉及的業(yè)務(wù)邏輯、數(shù)據(jù)庫(kù)地址以及關(guān)聯(lián)多數(shù)據(jù)庫(kù)的關(guān)鍵字段,到相應(yīng)的業(yè)務(wù)數(shù)據(jù)庫(kù)中取出具體的數(shù)據(jù),并匹配相應(yīng)的業(yè)務(wù)邏輯校驗(yàn)是否滿足一致性要求,以獲得校驗(yàn)結(jié)果。
[0004]然而,由于現(xiàn)有技術(shù)提供的方法需要根據(jù)應(yīng)用系統(tǒng)發(fā)送的驗(yàn)證請(qǐng)求才能夠觸發(fā)數(shù)據(jù)的一致性監(jiān)控,需要對(duì)舊有的應(yīng)用系統(tǒng)進(jìn)行改造才能夠?qū)崿F(xiàn)數(shù)據(jù)的一致性監(jiān)控,并不適合所有的應(yīng)用系統(tǒng)和數(shù)據(jù)庫(kù),成本較高。此外,由于在進(jìn)行數(shù)據(jù)一致性監(jiān)控時(shí),需要實(shí)時(shí)訪問、查詢業(yè)務(wù)數(shù)據(jù)庫(kù)以獲得具體的數(shù)據(jù),當(dāng)涉及數(shù)據(jù)量較大時(shí),將會(huì)對(duì)業(yè)務(wù)數(shù)據(jù)庫(kù)造成較大的壓力,實(shí)時(shí)讀取業(yè)務(wù)數(shù)據(jù)庫(kù)也會(huì)造成系統(tǒng)的性能損耗,進(jìn)而產(chǎn)生系統(tǒng)響應(yīng)慢、無法得到快速而準(zhǔn)確的監(jiān)控結(jié)果等缺陷。
【發(fā)明內(nèi)容】
[0005]為解決上述技術(shù)問題,本發(fā)明公開了一種分布式系統(tǒng)數(shù)據(jù)一致性處理方法、裝置和系統(tǒng),可用較低的成本和系統(tǒng)損耗實(shí)現(xiàn)數(shù)據(jù)快速、準(zhǔn)確的一致性比對(duì),并不會(huì)對(duì)業(yè)務(wù)數(shù)據(jù)庫(kù)產(chǎn)生壓力。
[0006]技術(shù)方案如下:
[0007]根據(jù)本發(fā)明實(shí)施例的第一方面,公開了一種分布式系統(tǒng)數(shù)據(jù)一致性處理裝置,所述裝置包括配置模塊、數(shù)據(jù)庫(kù)消息生成模塊和數(shù)據(jù)一致性比對(duì)任務(wù)模塊,其中:
[0008]所述配置模塊,用于預(yù)先配置監(jiān)控對(duì)象以及對(duì)應(yīng)所述監(jiān)控對(duì)象的監(jiān)控規(guī)則;
[0009]所述數(shù)據(jù)庫(kù)消息生成模塊,用于解析對(duì)應(yīng)所述監(jiān)控對(duì)象的事務(wù)日志文件,當(dāng)確定所述監(jiān)控對(duì)象發(fā)生變化時(shí),實(shí)時(shí)生成業(yè)務(wù)數(shù)據(jù)變更消息,向所述數(shù)據(jù)一致性比對(duì)任務(wù)模塊發(fā)送所述業(yè)務(wù)數(shù)據(jù)變更消息;其中,所述業(yè)務(wù)數(shù)據(jù)變更消息包含對(duì)應(yīng)所述監(jiān)控對(duì)象的待比對(duì)業(yè)務(wù)數(shù)據(jù);
[0010]所述數(shù)據(jù)一致性比對(duì)任務(wù)模塊,用于接收所述數(shù)據(jù)庫(kù)消息生成模塊發(fā)送的所述業(yè)務(wù)數(shù)據(jù)變更消息,根據(jù)所述對(duì)應(yīng)所述監(jiān)控對(duì)象的監(jiān)控規(guī)則對(duì)所述業(yè)務(wù)數(shù)據(jù)變更消息中包含的所述待比對(duì)業(yè)務(wù)數(shù)據(jù)實(shí)時(shí)進(jìn)行比對(duì),獲得比對(duì)結(jié)果。
[0011]優(yōu)選地,所述數(shù)據(jù)庫(kù)消息生成模塊具體用于:
[0012]當(dāng)預(yù)置的所述監(jiān)控對(duì)象來源于不同數(shù)據(jù)庫(kù)時(shí),分別解析各數(shù)據(jù)庫(kù)對(duì)應(yīng)所述監(jiān)控對(duì)象的事務(wù)日志文件,當(dāng)確定所述監(jiān)控對(duì)象在任一數(shù)據(jù)庫(kù)對(duì)應(yīng)的事務(wù)日志文件中發(fā)生變化時(shí),實(shí)時(shí)生成業(yè)務(wù)數(shù)據(jù)變更消息,向所述數(shù)據(jù)一致性比對(duì)任務(wù)模塊發(fā)送所述業(yè)務(wù)數(shù)據(jù)變更消息;其中,所述業(yè)務(wù)數(shù)據(jù)變更消息包含所述監(jiān)控對(duì)象在各數(shù)據(jù)庫(kù)中的事務(wù)日志文件對(duì)應(yīng)的業(yè)務(wù)數(shù)據(jù)。
[0013]優(yōu)選地,所述數(shù)據(jù)一致性比對(duì)任務(wù)模塊具體用于:
[0014]當(dāng)接收到所述數(shù)據(jù)庫(kù)消息生成模塊發(fā)送的業(yè)務(wù)數(shù)據(jù)變更消息時(shí),將所述數(shù)據(jù)變更消息包含的所述待比對(duì)業(yè)務(wù)數(shù)據(jù)存儲(chǔ)至本地?cái)?shù)據(jù)庫(kù),利用所述本地?cái)?shù)據(jù)庫(kù)根據(jù)所述對(duì)應(yīng)所述監(jiān)控對(duì)象的監(jiān)控規(guī)則對(duì)所述待比對(duì)業(yè)務(wù)數(shù)據(jù)實(shí)時(shí)進(jìn)行一致性比對(duì),獲得比對(duì)結(jié)果。
[0015]優(yōu)選地,所述數(shù)據(jù)一致性比對(duì)任務(wù)模塊還用于:
[0016]對(duì)所述待比對(duì)業(yè)務(wù)數(shù)據(jù)進(jìn)行哈希運(yùn)算,根據(jù)哈希運(yùn)算結(jié)果對(duì)所述待比對(duì)業(yè)務(wù)數(shù)據(jù)進(jìn)行分組,將不同組的業(yè)務(wù)數(shù)據(jù)分配到不同的任務(wù)機(jī)上以根據(jù)預(yù)置的所述監(jiān)控規(guī)則對(duì)所述業(yè)務(wù)數(shù)據(jù)實(shí)時(shí)進(jìn)行比對(duì)。
[0017]優(yōu)選地,所述裝置還包括:
[0018]海量存儲(chǔ)模塊,用于接收并存儲(chǔ)所述數(shù)據(jù)一致性比對(duì)任務(wù)模塊發(fā)送的比對(duì)結(jié)果;以及,接收查詢請(qǐng)求,返回與所述查詢請(qǐng)求對(duì)應(yīng)的比對(duì)數(shù)據(jù)。
[0019]優(yōu)選地,所述裝置還包括:
[0020]一致性恢復(fù)模塊,用于當(dāng)所述比對(duì)結(jié)果表明業(yè)務(wù)數(shù)據(jù)存在不一致時(shí),實(shí)現(xiàn)業(yè)務(wù)數(shù)據(jù)的一致性恢復(fù);其中,所述一致性恢復(fù)模塊具體用于:
[0021]根據(jù)所述配置模塊預(yù)先配置的業(yè)務(wù)應(yīng)用的遠(yuǎn)程接口和調(diào)用參數(shù),調(diào)用所述業(yè)務(wù)應(yīng)用以實(shí)現(xiàn)業(yè)務(wù)數(shù)據(jù)的一致性恢復(fù)。
[0022]優(yōu)選地,所述裝置還包括:
[0023]監(jiān)控模塊,配置用于監(jiān)控所述數(shù)據(jù)一致性比對(duì)任務(wù)模塊的運(yùn)行狀態(tài),當(dāng)所述運(yùn)行狀態(tài)表明未比對(duì)數(shù)據(jù)的數(shù)量超過預(yù)設(shè)閾值時(shí),輸出報(bào)警信息。
[0024]根據(jù)本發(fā)明實(shí)施例的第二方面,公開了一種分布式系統(tǒng),所述分布式系統(tǒng)包括數(shù)據(jù)一致性處理裝置和業(yè)務(wù)數(shù)據(jù)庫(kù),其中:
[0025]所述業(yè)務(wù)數(shù)據(jù)庫(kù)用于存儲(chǔ)業(yè)務(wù)數(shù)據(jù);
[0026]所述數(shù)據(jù)一致性處理裝置用于預(yù)先配置監(jiān)控對(duì)象以及對(duì)應(yīng)所述監(jiān)控對(duì)象的監(jiān)控規(guī)則;解析對(duì)應(yīng)所述監(jiān)控對(duì)象的業(yè)務(wù)數(shù)據(jù)庫(kù)的事務(wù)日志文件,當(dāng)確定所述監(jiān)控對(duì)象發(fā)生變化時(shí),實(shí)時(shí)生成業(yè)務(wù)數(shù)據(jù)變更消息;其中,所述業(yè)務(wù)數(shù)據(jù)變更消息包含對(duì)應(yīng)所述監(jiān)控對(duì)象的待比對(duì)業(yè)務(wù)數(shù)據(jù);以及,根據(jù)所述對(duì)應(yīng)所述監(jiān)控對(duì)象的監(jiān)控規(guī)則對(duì)所述業(yè)務(wù)數(shù)據(jù)變更消息中包含的所述待比對(duì)業(yè)務(wù)數(shù)據(jù)實(shí)時(shí)進(jìn)行比對(duì),獲得比對(duì)結(jié)果。
[0027]優(yōu)選地,所述數(shù)據(jù)一致性處理裝置具體用于:
[0028]當(dāng)預(yù)置的所述監(jiān)控對(duì)象來源于不同數(shù)據(jù)庫(kù)時(shí),分別解析各數(shù)據(jù)庫(kù)對(duì)應(yīng)所述監(jiān)控對(duì)象的事務(wù)日志文件,當(dāng)確定所述監(jiān)控對(duì)象在任一數(shù)據(jù)庫(kù)對(duì)應(yīng)的事務(wù)日志文件中發(fā)生變化時(shí),實(shí)時(shí)生成業(yè)務(wù)數(shù)據(jù)變更消息,向所述數(shù)據(jù)一致性比對(duì)任務(wù)模塊發(fā)送所述業(yè)務(wù)數(shù)據(jù)變更消息;其中,所述業(yè)務(wù)數(shù)據(jù)變更消息包含所述監(jiān)控對(duì)象在各數(shù)據(jù)庫(kù)中的事務(wù)日志文件對(duì)應(yīng)的業(yè)務(wù)數(shù)據(jù)。
[0029]根據(jù)本發(fā)明實(shí)施例的第三方面,公開了一種分布式系統(tǒng)數(shù)據(jù)一致性處理方法,應(yīng)用于分布式系統(tǒng)數(shù)據(jù)一致性處理裝置,所述裝置包括配置模塊、數(shù)據(jù)庫(kù)消息生成模塊和數(shù)據(jù)一致性比對(duì)任務(wù)模塊,則所述方法包括:
[0030]所述配置模塊預(yù)先配置監(jiān)控對(duì)象以及對(duì)應(yīng)所述監(jiān)控對(duì)象的監(jiān)控規(guī)則;
[0031]所述數(shù)據(jù)庫(kù)消息生成模塊解析對(duì)應(yīng)所述監(jiān)控對(duì)象對(duì)應(yīng)的事務(wù)日志文件,當(dāng)確定所述監(jiān)控對(duì)象發(fā)生變化時(shí),實(shí)時(shí)生成業(yè)務(wù)數(shù)據(jù)變更消息,向所述數(shù)據(jù)一致性比對(duì)任務(wù)模塊發(fā)送所述業(yè)務(wù)數(shù)據(jù)變更消息;其中,所述業(yè)務(wù)數(shù)據(jù)變更消息包含對(duì)應(yīng)所述監(jiān)控對(duì)象的待比對(duì)業(yè)務(wù)數(shù)據(jù);
[0032]所述數(shù)據(jù)一致性比對(duì)任務(wù)模塊接收所述數(shù)據(jù)庫(kù)消息生成模塊發(fā)送的業(yè)務(wù)數(shù)據(jù)變更消息,根據(jù)所述對(duì)應(yīng)所述監(jiān)控對(duì)象的監(jiān)控規(guī)則對(duì)所述業(yè)務(wù)數(shù)據(jù)變更消息中包含的所述待比對(duì)業(yè)務(wù)數(shù)據(jù)實(shí)時(shí)進(jìn)行比對(duì),獲得比對(duì)結(jié)果。
[0033]優(yōu)選地,所述數(shù)據(jù)庫(kù)消息生成模塊解析對(duì)應(yīng)所述監(jiān)控對(duì)象對(duì)應(yīng)的事務(wù)日志文件,當(dāng)確定所述監(jiān)控對(duì)象發(fā)生變化時(shí),實(shí)時(shí)生成業(yè)務(wù)數(shù)據(jù)變更消息,向所述數(shù)據(jù)一致性比對(duì)任務(wù)模塊發(fā)送所述業(yè)務(wù)數(shù)據(jù)變更消息包括:
[0034]當(dāng)預(yù)置的所述監(jiān)控對(duì)象來源于不同數(shù)據(jù)庫(kù)時(shí),所述數(shù)據(jù)庫(kù)消息生成模塊分別解析各數(shù)據(jù)庫(kù)對(duì)應(yīng)所述監(jiān)控對(duì)象的事務(wù)日志文件,當(dāng)確定所述監(jiān)控對(duì)象在任一數(shù)據(jù)庫(kù)對(duì)應(yīng)的事務(wù)日志文件中發(fā)生變化時(shí),實(shí)時(shí)生成業(yè)務(wù)數(shù)據(jù)變更消息,向所述數(shù)據(jù)一致性比對(duì)任務(wù)模塊發(fā)送所述業(yè)務(wù)數(shù)據(jù)變更消息;其中,所述業(yè)務(wù)數(shù)據(jù)變更消息包含所述監(jiān)控對(duì)象在各數(shù)據(jù)庫(kù)中的事務(wù)日志文件對(duì)應(yīng)的業(yè)務(wù)數(shù)據(jù)。
[0035]優(yōu)選地,所述數(shù)據(jù)一致性比對(duì)任務(wù)模塊接收所述數(shù)據(jù)庫(kù)消息生成模塊發(fā)送的業(yè)務(wù)數(shù)據(jù)變更消息,根據(jù)預(yù)置的監(jiān)控規(guī)則對(duì)所述業(yè)務(wù)數(shù)據(jù)變更消息中包含的待比對(duì)業(yè)務(wù)數(shù)據(jù)實(shí)時(shí)進(jìn)行比對(duì),獲得比對(duì)結(jié)果包括:
[0036]當(dāng)接收到所述數(shù)據(jù)庫(kù)消息生成模塊發(fā)送的業(yè)務(wù)數(shù)據(jù)變更消息時(shí),所述數(shù)據(jù)一致性比對(duì)任務(wù)模塊將所述數(shù)據(jù)變更消息包含的所述待比對(duì)業(yè)務(wù)數(shù)據(jù)存儲(chǔ)至本地?cái)?shù)據(jù)庫(kù),利用所述本地?cái)?shù)據(jù)庫(kù)根據(jù)預(yù)置的所述對(duì)應(yīng)所述監(jiān)控對(duì)象的監(jiān)控規(guī)則對(duì)所述待比對(duì)業(yè)務(wù)數(shù)據(jù)實(shí)時(shí)進(jìn)行比對(duì),獲得比對(duì)結(jié)果。
[0037]優(yōu)選地,所述方法還包括:
[0038]所述數(shù)據(jù)一致性比對(duì)任務(wù)模塊對(duì)接收的所述待比對(duì)業(yè)務(wù)數(shù)據(jù)進(jìn)行哈希運(yùn)算,根據(jù)哈希運(yùn)算結(jié)果對(duì)所述待比對(duì)業(yè)務(wù)數(shù)據(jù)進(jìn)行分組,將不同組的業(yè)務(wù)數(shù)據(jù)分配到不同的任務(wù)機(jī)上以根據(jù)預(yù)置的所述監(jiān)控規(guī)則對(duì)所述業(yè)務(wù)數(shù)據(jù)實(shí)時(shí)進(jìn)行比對(duì)。
[0039]優(yōu)選地,所述方法還包括:
[0040]數(shù)據(jù)一致性比對(duì)任務(wù)模塊向海量存儲(chǔ)模塊發(fā)送所述比對(duì)結(jié)果,所述海量存儲(chǔ)模塊接收并存儲(chǔ)所述比對(duì)結(jié)果;以及,所述海量存儲(chǔ)模塊接收查詢請(qǐng)求,返回與所述查詢請(qǐng)求對(duì)應(yīng)的比對(duì)數(shù)據(jù)。
[0041 ] 優(yōu)選地,所述方法還包括:
[0042]當(dāng)所述比對(duì)結(jié)果表明業(yè)務(wù)數(shù)據(jù)存在不一致時(shí),一致性恢復(fù)模塊實(shí)現(xiàn)業(yè)務(wù)數(shù)據(jù)的一致性恢復(fù);
[0043]其中,所述一致性恢復(fù)模塊實(shí)現(xiàn)業(yè)務(wù)數(shù)據(jù)的一致性恢復(fù)包括:
[0044]—致性恢復(fù)模塊根據(jù)預(yù)先配置的業(yè)務(wù)應(yīng)用的遠(yuǎn)程接口和調(diào)用參數(shù),調(diào)用所述業(yè)務(wù)應(yīng)用以實(shí)現(xiàn)業(yè)務(wù)數(shù)據(jù)的一致性恢復(fù)。
[0045]優(yōu)選地,所述方法還包括:
[0046]監(jiān)控所述數(shù)據(jù)一致性比對(duì)任務(wù)模塊的運(yùn)行狀態(tài),當(dāng)所述運(yùn)行狀態(tài)表明未比對(duì)數(shù)據(jù)的數(shù)量超過預(yù)設(shè)閾值時(shí),輸出報(bào)警信息。
[0047]本發(fā)明實(shí)施例的一個(gè)方面能夠達(dá)到的有益效果為:在本發(fā)明實(shí)施例中,配置模塊預(yù)先配置了監(jiān)控對(duì)象和監(jiān)控規(guī)則,由數(shù)據(jù)庫(kù)消息生成模塊對(duì)預(yù)置的監(jiān)控對(duì)象對(duì)應(yīng)的數(shù)據(jù)庫(kù)事務(wù)日志文件進(jìn)行監(jiān)控和解析,當(dāng)發(fā)現(xiàn)監(jiān)控對(duì)象在任一數(shù)據(jù)庫(kù)的事務(wù)日志