CN109635038A - A kind of double reading/writing methods in structural data strange land - Google Patents

A kind of double reading/writing methods in structural data strange land Download PDF

Info

Publication number
CN109635038A
CN109635038A CN201811383969.6A CN201811383969A CN109635038A CN 109635038 A CN109635038 A CN 109635038A CN 201811383969 A CN201811383969 A CN 201811383969A CN 109635038 A CN109635038 A CN 109635038A
Authority
CN
China
Prior art keywords
data
strange land
user
database table
major key
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.)
Granted
Application number
CN201811383969.6A
Other languages
Chinese (zh)
Other versions
CN109635038B (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.)
State Grid Information and Telecommunication Co Ltd
Fujian Yirong Information Technology Co Ltd
Original Assignee
State Grid Information and Telecommunication Co Ltd
Fujian Yirong Information Technology Co Ltd
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 State Grid Information and Telecommunication Co Ltd, Fujian Yirong Information Technology Co Ltd filed Critical State Grid Information and Telecommunication Co Ltd
Priority to CN201811383969.6A priority Critical patent/CN109635038B/en
Publication of CN109635038A publication Critical patent/CN109635038A/en
Application granted granted Critical
Publication of CN109635038B publication Critical patent/CN109635038B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The present invention provides a kind of double reading/writing methods in structural data strange land, include the following steps: step S10, user is divided into local grouping and strange land grouping;Step S20, database table is respectively created on the database server of local and remote side, and major key is respectively set using odd even separation strategy;Step S30, user initiates read-write request of data to operation system, and operation system identifies grouping where user, and assigns corresponding user right according to grouping;Step S40, database server of the data variation daily record reproduction that user's foundation permission is written and read data, and database table during read-write operation is generated to opposite end.The present invention has the advantages that realizing the bidirectional replication of strange land dual-active technology.

Description

A kind of double reading/writing methods in structural data strange land
Technical field
The present invention relates to information technology fields, refer in particular to a kind of double reading/writing methods in structural data strange land.
Background technique
As calamity is for the fast development of technology, data have been copied into a fast-developing stage, in particular for knot Structure data (such as Oracle), the technical products such as RAC, ADG, OGG successively occur: RAC is for realizing the mostly real of Oracle Example cluster, ADG is standby for realizing same city dual-active strange land calamity, and OGG is for realizing strange land dual-active.
Along with the core business of every profession and trade to the high request of business continuance, the quick hair of strange land dual-active technology is promoted Exhibition and application, may be implemented the strange land dual-active logic copy to structured database based on strange land dual-active technology.
But traditional strange land dual-active technology presence has the disadvantage that traditional strange land dual-active technology can only realize folk prescription To duplication, generally only master library is read-write, read-only from library, needs to manually adjust duplication direction after dual-active switching occurs, increases The risk of service switching also increases the time of service switching at the same time, affects calamity for index (RTO).
Summary of the invention
The technical problem to be solved in the present invention is to provide a kind of double reading/writing methods in structural data strange land, realizes strange land The bidirectional replication of dual-active technology.
The present invention is implemented as follows: a kind of double reading/writing methods in structural data strange land, described method includes following steps:
Step S10, user is divided into local grouping and strange land is grouped;
Step S20, database table is respectively created on the database server of local and remote side, and plan is separated using odd even Major key is slightly respectively set;
Step S30, user initiates read-write request of data to operation system, and operation system identifies grouping where user, and root Corresponding user right is assigned according to grouping;
Step S40, user is written and read data according to permission, and database table during read-write operation is generated Data variation daily record reproduction to opposite end database server.
Further, the step S10 specifically:
User is divided into local grouping by scheduling controlling service and strange land is grouped.
Further, the step S20 specifically:
A first database table, the odd-numbered line setting of the first database table are created on local database server For the first major key;One second database table, the even number line of second database table are created on the database server in strange land It is set as the second major key.
Further, the odd-numbered line of the first database table is set as the first major key specifically: first database table Odd-numbered line is set as the first major key, each first major key spacer step a length of 2;
The even number line of second database table is set as the second major key specifically: the even number line of the second database table is arranged For the second major key, each second major key spacer step a length of 2.
Further, the step S30 specifically:
User initiates the request of the data in read-write database server to operation system, and operation system passes through scheduling controlling It services the grouping where judging user and assigns user right.
Further, the permission is access limit or read-only authority.
Further, the step S40 specifically:
If step S41, user belongs to local grouping, user is written and read data according to permission, local data Library server generates the first major key in odd-numbered line during reading and writing data, according to first database table, increases newly or changes Data;
Step S42, data copying program timing scan first database table, and the log of data variation is grabbed, by log It stores into caching;
Step S43, loader reads the log in caching, and converts SQL statement for log, and loader passes through SQL language The log of data variation is loaded into the odd-numbered line of the second database table by sentence.
Further, the step S40 specifically:
If step S410, user belongs to strange land grouping, user is written and read data according to permission, the data in strange land Library server generates the second major key in even number line during reading and writing data, according to the second database table, increases newly or changes Data;
Step S420, the second database table of data copying program timing scan, and the log of data variation is grabbed, by log It stores into caching;
Step S430, loader reads the log in caching, and converts SQL statement for log, and loader passes through SQL language The log of data variation is loaded into the even number line of first database table by sentence.
Further, the data copying program is Logmnr.
The present invention has the advantages that
1, the bidirectional replication of strange land dual-active technology is realized.
2, the first major key is set as by the odd-numbered line of first database table, the even number line of the second database table is set as Two major keys, i.e., the local strategy for using odd even to separate with the major key in strange land, have prevented to lead to the problem of fissure in data reproduction process, I.e. same major key it is local done simultaneously with strange land change cause data copying program can not decision be subject to which part data.
3, the strategy for using odd even to separate with the major key in strange land by local, realizes local and two, strange land database takes Business device reads while write operation, and then is greatly improved business continuance index, and upgrading is low in cost.
4, by setting 2 for the step-length of each first major key, 2 are set by the step-length of each second major key, it is effective to save System resource.
5, user is grouped by scheduling controlling service, realizes the load that rationally effective distribution is global.
6, by the way that the first major key of even number behavior of first database table is arranged, the odd number behavior second of the second database table is main Key realizes that strange land switches duplication direction at any time.
Detailed description of the invention
The present invention is further illustrated in conjunction with the embodiments with reference to the accompanying drawings.
Fig. 1 is a kind of flow chart of the double reading/writing methods in structural data strange land of the present invention.
Fig. 2 is a kind of functional block diagram of the double reading/writing methods in structural data strange land of the present invention.
Specific embodiment
It please refers to shown in Fig. 1 to Fig. 2, a kind of preferred embodiment of the double reading/writing methods in structural data strange land of the present invention, packet Include following steps:
Step S10, user is divided into local grouping and strange land is grouped;
Step S20, database table is respectively created on the database server of local and remote side, and plan is separated using odd even Major key is slightly respectively set;
Step S30, user initiates read-write request of data to operation system, and operation system identifies grouping where user, and root Corresponding user right is assigned according to grouping;By the way that user right is arranged, the safety of database server is improved;
Step S40, user is written and read data according to permission, and database table during read-write operation is generated Data variation daily record reproduction to opposite end database server.
The step S10 specifically:
User is divided into local grouping by scheduling controlling service and strange land is grouped.It can be by region or modulus rule etc. It is grouped, is grouped user by scheduling controlling service, realize the load that rationally effective distribution is global.
The step S20 specifically:
A first database table, the odd-numbered line setting of the first database table are created on local database server For the first major key;One second database table, the even number line of second database table are created on the database server in strange land It is set as the second major key.The i.e. local strategy for using odd even to separate with the major key in strange land, has prevented to generate in data reproduction process Fissure problem, i.e. same major key locally done simultaneously with strange land change cause data copying program can not decision with which part data be It is quasi-;And it realizes local and reads while write operation with two, strange land database server, and then be greatly improved business continuance Index, and upgrading is low in cost.
Database key, refers to the combination of a column or multiple row, and value can uniquely identify every a line in table, pass through It can enforced table entity integrity, major key be mainly used for other tables external key association and this record modification and deletion.
The odd-numbered line of the first database table is set as the first major key specifically: the odd-numbered line of first database table is arranged For the first major key, each first major key spacer step a length of 2;
The even number line of second database table is set as the second major key specifically: the even number line of the second database table is arranged For the second major key, each second major key spacer step a length of 2.
By setting 2 for the step-length of each first major key, 2 are set by the step-length of each second major key, it is effective to save System resource.
The step S30 specifically:
User initiates the request of the data in read-write database server to operation system, and operation system passes through scheduling controlling It services the grouping where judging user and assigns user right.
The permission is access limit or read-only authority.
The step S40 specifically:
If step S41, user belongs to local grouping, user is written and read data according to permission, local data Library server generates the first major key in odd-numbered line during reading and writing data, according to first database table, increases newly or changes Data;
Step S42, data copying program timing scan first database table, and the log of data variation is grabbed, by log It stores into caching;
Step S43, loader reads the log in caching, and converts SQL statement for log, and loader passes through SQL language The log of data variation is loaded into the odd-numbered line of the second database table by sentence.
The step S40 specifically:
If step S410, user belongs to strange land grouping, user is written and read data according to permission, the data in strange land Library server generates the second major key in even number line during reading and writing data, according to the second database table, increases newly or changes Data;
Step S420, the second database table of data copying program timing scan, and the log of data variation is grabbed, by log It stores into caching;
Step S430, loader reads the log in caching, and converts SQL statement for log, and loader passes through SQL language The log of data variation is loaded into the even number line of first database table by sentence.
The data copying program is Logmnr.Logmnr is the included Web log mining tool of oracle, be can be used for pair Problem diagnosis is done in oracle data DDL and DML operation.
When needing to switch duplication direction, by the way that the first major key of even number behavior of first database table, the second data are arranged The second major key of odd number behavior of library table.
In conclusion the present invention has the advantages that
1, the bidirectional replication of strange land dual-active technology is realized.
2, the first major key is set as by the odd-numbered line of first database table, the even number line of the second database table is set as Two major keys, i.e., the local strategy for using odd even to separate with the major key in strange land, have prevented to lead to the problem of fissure in data reproduction process, I.e. same major key it is local done simultaneously with strange land change cause data copying program can not decision be subject to which part data.
3, the strategy for using odd even to separate with the major key in strange land by local, realizes local and two, strange land database takes Business device reads while write operation, and then is greatly improved business continuance index, and upgrading is low in cost.
4, by setting 2 for the step-length of each first major key, 2 are set by the step-length of each second major key, it is effective to save System resource.
5, user is grouped by scheduling controlling service, realizes the load that rationally effective distribution is global.
6, by the way that the first major key of even number behavior of first database table is arranged, the odd number behavior second of the second database table is main Key realizes that strange land switches duplication direction at any time.
Although specific embodiments of the present invention have been described above, those familiar with the art should be managed Solution, we are merely exemplary described specific embodiment, rather than for the restriction to the scope of the present invention, it is familiar with this The technical staff in field should be covered of the invention according to modification and variation equivalent made by spirit of the invention In scope of the claimed protection.

Claims (9)

1. a kind of double reading/writing methods in structural data strange land, it is characterised in that: described method includes following steps:
Step S10, user is divided into local grouping and strange land is grouped;
Step S20, database table is respectively created on the database server of local and remote side, and using odd even separation strategy point It She Zhi not major key;
Step S30, user to operation system initiate read-write request of data, operation system identify user where grouping, and according to point Group assigns corresponding user right;
Step S40, user is written and read data according to permission, and the number that database table during read-write operation is generated The database server of opposite end is copied to according to change journal.
2. the double reading/writing methods in a kind of structural data strange land as described in claim 1, it is characterised in that: the step S10 tool Body are as follows:
User is divided into local grouping by scheduling controlling service and strange land is grouped.
3. the double reading/writing methods in a kind of structural data strange land as described in claim 1, it is characterised in that: the step S20 tool Body are as follows:
Create a first database table on local database server, the odd-numbered line of the first database table is set as the One major key;One second database table, the even number line setting of second database table are created on the database server in strange land For the second major key.
4. the double reading/writing methods in a kind of structural data strange land as claimed in claim 3, it is characterised in that: the first database The odd-numbered line of table is set as the first major key specifically: the odd-numbered line of first database table is set as the first major key, each first major key Spacer step a length of 2;
The even number line of second database table is set as the second major key specifically: the even number line of the second database table is set as Two major keys, each second major key spacer step a length of 2.
5. the double reading/writing methods in a kind of structural data strange land as claimed in claim 3, it is characterised in that: the step S30 tool Body are as follows:
User initiates the request of the data in read-write database server to operation system, and operation system passes through scheduling controlling service Judge the grouping where user and assigns user right.
6. the double reading/writing methods in a kind of structural data strange land as described in claim 1, it is characterised in that: the permission is read-write Permission or read-only authority.
7. the double reading/writing methods in a kind of structural data strange land as claimed in claim 3, it is characterised in that: the step S40 tool Body are as follows:
If step S41, user belongs to local grouping, user is written and read data according to permission, local database clothes Device be engaged in during reading and writing data, the first major key is generated in odd-numbered line according to first database table, increases or change data newly;
Step S42, data copying program timing scan first database table, and the log of data variation is grabbed, log is stored Into caching;
Step S43, loader reads the log in caching, and converts SQL statement for log, and loader will by SQL statement The log of data variation is loaded into the odd-numbered line of the second database table.
8. the double reading/writing methods in a kind of structural data strange land as claimed in claim 3, it is characterised in that: the step S40 tool Body are as follows:
If step S410, user belongs to strange land grouping, user is written and read data according to permission, the database clothes in strange land Device be engaged in during reading and writing data, the second major key is generated in even number line according to the second database table, increases or change data newly;
Step S420, the second database table of data copying program timing scan, and the log of data variation is grabbed, log is stored Into caching;
Step S430, loader reads the log in caching, and converts SQL statement for log, and loader will by SQL statement The log of data variation is loaded into the even number line of first database table.
9. the double reading/writing methods in a kind of structural data strange land as described in claim 1, it is characterised in that: the data replicate journey Sequence is Logmnr.
CN201811383969.6A 2018-11-20 2018-11-20 Remote double-reading and writing method for structured data Active CN109635038B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811383969.6A CN109635038B (en) 2018-11-20 2018-11-20 Remote double-reading and writing method for structured data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811383969.6A CN109635038B (en) 2018-11-20 2018-11-20 Remote double-reading and writing method for structured data

Publications (2)

Publication Number Publication Date
CN109635038A true CN109635038A (en) 2019-04-16
CN109635038B CN109635038B (en) 2022-08-19

Family

ID=66068453

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811383969.6A Active CN109635038B (en) 2018-11-20 2018-11-20 Remote double-reading and writing method for structured data

Country Status (1)

Country Link
CN (1) CN109635038B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110489092A (en) * 2019-08-27 2019-11-22 四川长虹电器股份有限公司 The solution of data latency issues is read under a kind of data base read-write separation architecture

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060274898A1 (en) * 2005-06-07 2006-12-07 Pedlow Leo M Jr Key table and authorization table management
US7313657B1 (en) * 2005-03-24 2007-12-25 Sprint Communications Company L.P. Conflict avoidance in data store replication
CN102025753A (en) * 2009-09-17 2011-04-20 阿里巴巴集团控股有限公司 Load balancing method and equipment for data resources of servers
CN103106200A (en) * 2011-11-09 2013-05-15 上海盛霄云计算技术有限公司 Synchronization system of non-relational type database and double-writing synchronization method
CN103488721A (en) * 2013-09-12 2014-01-01 京信通信系统(中国)有限公司 Database bisynchronous method and system for master and slave boards
CN104243195A (en) * 2013-06-19 2014-12-24 国家电网公司 Remote disaster recovery processing method and device
CN105205182A (en) * 2015-10-28 2015-12-30 北京奇虎科技有限公司 System deployed in multiple computer rooms and cross-computer-room business data processing method
CN106254100A (en) * 2016-07-27 2016-12-21 腾讯科技(深圳)有限公司 A kind of data disaster tolerance methods, devices and systems
CN106802891A (en) * 2015-11-26 2017-06-06 中国电信股份有限公司 The querying method of the non-burst field of distributed data base, system and equipment
CN108228755A (en) * 2017-12-21 2018-06-29 江苏瑞中数据股份有限公司 The data of MySQL database based on daily record analytic technique to Hadoop platform synchronize clone method
CN108595485A (en) * 2018-03-14 2018-09-28 北京用友政务软件有限公司 A kind of data-updating method and system at Double Data center

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7313657B1 (en) * 2005-03-24 2007-12-25 Sprint Communications Company L.P. Conflict avoidance in data store replication
US7899998B1 (en) * 2005-03-24 2011-03-01 Sprint Communications Company L.P. Conflict avoidance in data store replication
US20060274898A1 (en) * 2005-06-07 2006-12-07 Pedlow Leo M Jr Key table and authorization table management
CN102025753A (en) * 2009-09-17 2011-04-20 阿里巴巴集团控股有限公司 Load balancing method and equipment for data resources of servers
CN103106200A (en) * 2011-11-09 2013-05-15 上海盛霄云计算技术有限公司 Synchronization system of non-relational type database and double-writing synchronization method
CN104243195A (en) * 2013-06-19 2014-12-24 国家电网公司 Remote disaster recovery processing method and device
CN103488721A (en) * 2013-09-12 2014-01-01 京信通信系统(中国)有限公司 Database bisynchronous method and system for master and slave boards
CN105205182A (en) * 2015-10-28 2015-12-30 北京奇虎科技有限公司 System deployed in multiple computer rooms and cross-computer-room business data processing method
CN106802891A (en) * 2015-11-26 2017-06-06 中国电信股份有限公司 The querying method of the non-burst field of distributed data base, system and equipment
CN106254100A (en) * 2016-07-27 2016-12-21 腾讯科技(深圳)有限公司 A kind of data disaster tolerance methods, devices and systems
CN108228755A (en) * 2017-12-21 2018-06-29 江苏瑞中数据股份有限公司 The data of MySQL database based on daily record analytic technique to Hadoop platform synchronize clone method
CN108595485A (en) * 2018-03-14 2018-09-28 北京用友政务软件有限公司 A kind of data-updating method and system at Double Data center

Non-Patent Citations (5)

* Cited by examiner, † Cited by third party
Title
MRR: "详解MySQL双活同步复制四种解决方案", 《HTTPS://WWW.JB51.NET/ARTICLE/146131.HTM》 *
WEIXIN_34138056: "数据库异地多活解决方案", 《HTTPS://BLOG.CSDN.NET/WEIXIN_34138056/ARTICLE/DETAILS/86132315》 *
ZHENGDL126: "解决两个mysql数据库双向同步的键值冲突问题(奇偶)", 《HTTPS://BLOG.CSDN.NET/ZHENGDL126/ARTICLE/DETAILS/83881035》 *
一天不进步,就是退步!: "数据库异地多活解决方案", 《HTTPS://WWW.CNBLOGS.COM/DAVIDWANG456/ARTICLES/9591907.HTML》 *
无: "mysql 双向同步的键值冲突问题的解决方法分享", 《HTTPS://WWW.JB51.NET/ARTICLE/28395.HTM》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110489092A (en) * 2019-08-27 2019-11-22 四川长虹电器股份有限公司 The solution of data latency issues is read under a kind of data base read-write separation architecture

Also Published As

Publication number Publication date
CN109635038B (en) 2022-08-19

Similar Documents

Publication Publication Date Title
US10445321B2 (en) Multi-tenant distribution of graph database caches
US10169606B2 (en) Verifiable data destruction in a database
Monk et al. Schema evolution in OODBs using class versioning
Schwartz et al. High performance MySQL: optimization, backups, and replication
CN104657382B (en) Method and apparatus for MySQL principal and subordinate's server data consistency detections
CN101183322B (en) Method for deferred logging and apparatus thereof
Tsai et al. Towards a scalable and robust multi-tenancy SaaS
JP2020502626A (en) Formation and operation of test data in a database system
CN107122355A (en) Data mover system and method
US20120317078A1 (en) Replication Support for Structured Data
CN107122360A (en) Data mover system and method
CN107122361A (en) Data mover system and method
WO2016192496A1 (en) Data migration processing method and device
US10733057B2 (en) Techniques for application undo and redo using SQL patchsets or changesets
KR20030094328A (en) System and method for reorganizing stored data
CN113868028A (en) Method for replaying log on data node, data node and system
CN106155832A (en) Method, device and the Android device that a kind of data are recovered
CN114048370A (en) Python-based archive file processing, storage and one-stop management platform
CN109635038A (en) A kind of double reading/writing methods in structural data strange land
US20090282083A1 (en) configuration of multiple database audits
CN100369038C (en) Method for implementing realtime database routine operation
US20200409939A1 (en) Systems and methods for scalable database technology
WO2016117007A1 (en) Database system and database management method
Pandagale et al. Hadoop-HBase for finding association rules using Apriori MapReduce algorithm
CN115658391A (en) Backup recovery method of WAL mechanism based on QianBase MPP database

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant