KR101989074B1 - Migration based on replication log in database sharding environment - Google Patents

Migration based on replication log in database sharding environment Download PDF

Info

Publication number
KR101989074B1
KR101989074B1 KR1020170101458A KR20170101458A KR101989074B1 KR 101989074 B1 KR101989074 B1 KR 101989074B1 KR 1020170101458 A KR1020170101458 A KR 1020170101458A KR 20170101458 A KR20170101458 A KR 20170101458A KR 101989074 B1 KR101989074 B1 KR 101989074B1
Authority
KR
South Korea
Prior art keywords
database
data
group
shard
group identifier
Prior art date
Application number
KR1020170101458A
Other languages
Korean (ko)
Other versions
KR20190017127A (en
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 네이버 주식회사
Priority to KR1020170101458A priority Critical patent/KR101989074B1/en
Publication of KR20190017127A publication Critical patent/KR20190017127A/en
Application granted granted Critical
Publication of KR101989074B1 publication Critical patent/KR101989074B1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/21Design, administration or maintenance of databases
    • G06F16/214Database migration support

Abstract

데이터베이스 샤딩 환경에서의 복제 로그 기반의 마이그레이션 기술을 제공한다. 일실시예에 따른 마이그레이션 방법은 샤딩(sharding)된 데이터의 샤드키(shardkey)들을 분류하여 생성된 기설정된 수의 복수의 그룹들 각각의 그룹 식별자들과 트랜잭션 로그를 이용하여 데이터베이스간 마이그레이션을 처리할 수 있다.Provides replication log-based migration technology in database sharding environment. The migration method according to an exemplary embodiment of the present invention classifies shardkeys of sharded data and processes database migration using group identifiers and a transaction log of each of a predetermined number of groups .

Description

데이터베이스 샤딩 환경에서의 복제 로그 기반의 마이그레이션{MIGRATION BASED ON REPLICATION LOG IN DATABASE SHARDING ENVIRONMENT}MIGRATION BASED ON REPLICATION LOG IN DATABASE SHARDING ENVIRONMENT In the database sharding environment,

아래의 설명은 데이터베이스 샤딩 환경에서의 복제 로그 기반의 마이그레이션 기술에 관한 것이다.The discussion below relates to a replication log-based migration technique in a database sharding environment.

데이터베이스들 간의 데이터 마이그레이션(migration)을 위한 기술들이 존재한다. 예를 들어, 한국등록특허 제10-1748912호는 소스(source) 저장소의 데이터를 타겟(target) 저장소로 이전(migration)하는 기술을 개시하고 있다.There are techniques for data migration between databases. For example, Korean Patent No. 10-1748912 discloses a technique for migrating data from a source repository to a target repository.

이때, 제1 데이터베이스에서 제2 데이터베이스로 데이터를 복제하는 도중에도 트랜잭션이 발생할 수 있다. 종래기술에서는 이러한 트랜잭션을 소스 데이터베이스인 제1 데이터베이스에 먼저 반영한 후, 트랜잭션 로그를 제2 데이터베이스로 전달하며, 제2 데이터베이스는 트랜잭션 로그에 따라 트랜잭션들을 순차적으로 반영함으로써, 제1 데이터베이스와 제2 데이터베이스가 동기화될 수 있다.At this time, a transaction may occur even while data is being copied from the first database to the second database. In the prior art, the transaction is first reflected in the first database, which is the source database, and then the transaction log is transferred to the second database. The second database sequentially reflects the transactions in accordance with the transaction log so that the first database and the second database Can be synchronized.

그러나, 제2 데이터베이스에서는 데이터의 마이그레이션이 완료된 이후에 트랜잭션 로그에 따른 트랜잭션들이 트랜잭션들의 순서에 따라 순차적으로 진행되기 때문에 복제 지연이 발생할 수 있으며, 마이그레이션을 위한 데이터로의 접근 차단 시간이 길어지게 되는 문제점이 있다.However, in the second database, after the completion of the data migration, the transactions according to the transaction log sequentially proceed according to the order of the transactions, so that the replication delay may occur and the access blocking time to the data for migration may become longer .

제1 데이터베이스와 제2 데이터베이스간의 데이터 마이그레이션(migration) 도중에 제1 데이터베이스에 반영되는 트랜잭션을 트랜잭션 로그를 이용하여 제2 데이터베이스에 동시 반영함으로써, 복제 지연 시간을 줄일 수 있으며, 마이그레이션되는 데이터로의 접근 차단 시간을 줄일 수 있는 데이터 마이그레이션 방법 및 데이터 마이그레이션 방법을 수행하는 컴퓨터 장치, 그리고 컴퓨터와 결합되어 본 발명의 실시예들에 따른 데이터 마이그레이션 방법을 컴퓨터에 실행시키기 위해 컴퓨터 판독 가능한 기록매체에 저장된 컴퓨터 프로그램과 그 기록매체를 제공한다.The transaction reflected in the first database during the data migration between the first database and the second database is concurrently reflected in the second database using the transaction log so that the replication delay time can be reduced and the access to the migrated data can be prevented A computer program for performing a data migration method and a data migration method capable of reducing time and a computer program stored in a computer readable recording medium for causing a computer to execute a data migration method according to embodiments of the present invention, And provides the recording medium.

트랜잭션을 동시에 반영하면서 데이터의 마이그레이션이 종료되는 시점에 제1 데이터베이스와 제2 데이터베이스에서 각각 관리되는 그룹 식별자들을 변경함에 따라 마이그레이션되는 데이터로의 접근 차단 시간을 최소화할 수 있는 데이터 마이그레이션 방법 및 데이터 마이그레이션 방법을 수행하는 컴퓨터 장치, 그리고 컴퓨터와 결합되어 본 발명의 실시예들에 따른 데이터 마이그레이션 방법을 컴퓨터에 실행시키기 위해 컴퓨터 판독 가능한 기록매체에 저장된 컴퓨터 프로그램과 그 기록매체를 제공한다.A data migration method and a data migration method capable of minimizing access blocking time to migrated data by changing group identifiers managed in the first database and the second database at the time when data migration is terminated while simultaneously reflecting transactions And a computer program stored in a computer-readable recording medium for causing a computer to execute a data migration method according to embodiments of the present invention, and a recording medium therefor.

데이터 마이그레이션(migration) 방법에 있어서, 샤딩(sharding)된 데이터의 샤드키(shardkey)들을 분류하여 생성된 기설정된 수의 복수의 그룹들 각각의 그룹 식별자들과 관련하여, 제1 데이터베이스의 그룹 식별자와 제2 데이터베이스의 그룹 식별자를 관리하는 단계; 상기 제1 데이터베이스에서 상기 제2 데이터베이스로 복제하고자 하는 데이터를 위한 샤드키들을 식별하는 단계; 상기 식별된 샤드키들에 대응하는 데이터를 상기 제1 데이터베이스에서 상기 제2 데이터베이스로 마이그레이션하는 단계; 상기 마이그레이션 도중에, 상기 제1 데이터베이스에 반영된 트랜잭션을, 트랜잭션 로그를 이용하여 상기 제2 데이터베이스에 동시 반영하는 단계; 및 상기 데이터의 마이그레이션에 따라 상기 제1 데이터베이스 및 상기 제2 데이터베이스 각각에서 관리되는 그룹 식별자들을 변경하는 단계를 포함하는 것을 특징으로 하는 데이터 마이그레이션 방법을 제공한다.A data migration method comprising the steps of: associating group identifiers of a first database with group identifiers of respective groups of a predetermined number of groups generated by sorting shardkeys of sharded data; Managing a group identifier of a second database; Identifying shard keys for data to be replicated from the first database to the second database; Migrating data corresponding to the identified shard keys from the first database to the second database; Simultaneously reflecting the transaction reflected in the first database in the second database using the transaction log during the migration; And changing the group identifiers managed in the first database and the second database in accordance with the migration of the data.

상기 데이터 마이그레이션 방법을 컴퓨터에 실행시키기 위한 컴퓨터 프로그램이 기록되어 있는 것을 특징으로 하는 컴퓨터 판독 가능한 기록매체를 제공한다.And a computer program for causing the computer to execute the data migration method is recorded.

컴퓨터와 결합하여 상기 데이터 마이그레이션 방법을 컴퓨터에 실행시키기 위해 컴퓨터 판독 가능한 기록매체에 저장된 컴퓨터 프로그램을 제공한다.There is provided a computer program stored in a computer-readable recording medium for causing a computer to execute the data migration method in combination with a computer.

컴퓨터 장치에 있어서, 컴퓨터에서 판독 가능한 명령을 실행하도록 구현되는 적어도 하나의 프로세서를 포함하고, 상기 적어도 하나의 프로세서는, 샤딩(sharding)된 데이터의 샤드키(shardkey)들을 분류하여 생성된 기설정된 수의 복수의 그룹들 각각의 그룹 식별자들과 관련하여, 제1 데이터베이스의 그룹 식별자와 제2 데이터베이스의 그룹 식별자를 관리하고, 상기 제1 데이터베이스에서 상기 제2 데이터베이스로 복제하고자 하는 데이터를 위한 샤드키들을 식별하고, 상기 식별된 샤드키들에 대응하는 데이터를 상기 제1 데이터베이스에서 상기 제2 데이터베이스로 마이그레이션하고, 상기 마이그레이션 도중에, 상기 제1 데이터베이스에 반영된 트랜잭션을, 트랜잭션 로그를 이용하여 상기 제2 데이터베이스에 동시 반영하고, 상기 데이터의 마이그레이션에 따라 상기 제1 데이터베이스 및 상기 제2 데이터베이스 각각에서 관리되는 그룹 식별자들을 변경하는 것을 특징으로 하는 데이터 컴퓨터 장치를 제공한다.CLAIMS What is claimed is: 1. A computer device comprising: at least one processor implemented to execute computer-readable instructions, the at least one processor being configured to classify shardkeys of sharded data, Managing a group identifier of a first database and a group identifier of a second database in association with the group identifiers of the plurality of groups of the plurality of groups and managing shard keys for data to be copied from the first database to the second database Migrate data corresponding to the identified shard keys from the first database to the second database, and transfer, during the migration, transactions reflected in the first database to the second database And the data of the above data Depending on the computer and provides the data and wherein changing the first database and the group identifiers that are managed by the second database, respectively.

제1 데이터베이스와 제2 데이터베이스간의 데이터 마이그레이션(migration) 도중에 제1 데이터베이스에 반영되는 트랜잭션을 트랜잭션 로그를 이용하여 제2 데이터베이스에 동시 반영함으로써, 복제 지연 시간을 줄일 수 있으며, 마이그레이션되는 데이터로의 접근 차단 시간을 줄일 수 있다.The transaction reflected in the first database during the data migration between the first database and the second database is concurrently reflected in the second database using the transaction log so that the replication delay time can be reduced and the access to the migrated data can be prevented Time can be reduced.

트랜잭션을 동시에 반영하면서 데이터의 마이그레이션이 종료되는 시점에 제1 데이터베이스와 제2 데이터베이스에서 각각 관리되는 그룹 식별자들을 변경함에 따라 마이그레이션되는 데이터로의 접근 차단 시간을 최소화할 수 있다.The access blocking time to the migrated data can be minimized by changing the group identifiers managed in the first database and the second database at the time when the migration of the data is ended while simultaneously reflecting the transactions.

도 1은 본 발명의 일실시예에 있어서, 데이터베이스에 저장된 데이터의 예를 도시한 도면이다.
도 2는 본 발명의 일실시예에 있어서, 데이터의 샤딩 예를 도시한 도면이다.
도 3은 본 발명의 일실시예에 있어서, 데이터 마이그레이션의 과정의 예를 도시한 도면이다.
도 4는 본 발명의 일실시예에 있어서, 그룹 식별자의 활용 예를 도시한 도면이다.
도 5는 본 발명의 일실시예에 있어서, 컴퓨터 장치의 내부 구성을 설명하기 위한 블록도이다.
도 6은 본 발명의 일실시예에 있어서, 데이터 마이그레이션 방법의 예를 도시한 흐름도이다.
도 7 및 도 8은 본 발명의 일실시예에 따른 데이터 마이그레이션 방법이 적용되는 과정의 예를 도시한 도면들이다.
1 is a diagram showing an example of data stored in a database in an embodiment of the present invention.
2 is a diagram showing an example of shading of data in an embodiment of the present invention.
3 is a diagram illustrating an example of a process of data migration in an embodiment of the present invention.
4 is a diagram illustrating an example of utilization of a group identifier in an embodiment of the present invention.
5 is a block diagram for explaining an internal configuration of a computer apparatus according to an embodiment of the present invention.
6 is a flowchart showing an example of a data migration method in an embodiment of the present invention.
FIG. 7 and FIG. 8 are views illustrating an example of a process of applying the data migration method according to an embodiment of the present invention.

이하, 실시예를 첨부한 도면을 참조하여 상세히 설명한다.Hereinafter, embodiments will be described in detail with reference to the accompanying drawings.

본 발명의 실시예들에 따른 데이터 마이그레이션(migration) 방법은 컴퓨터 장치에 의해 수행될 수 있다. 일례로, 컴퓨터 장치에는 컴퓨터 장치가 데이터 마이그레이션 방법을 수행하도록 제어하기 위한 컴퓨터 프로그램이 설치 및 구동될 수 있으며, 컴퓨터 프로그램은 컴퓨터 장치와 결합되어 데이터 마이그레이션 방법을 컴퓨터 장치에 실행시키기 위해 컴퓨터 판독 가능한 기록매체에 저장될 수 있다.A data migration method according to embodiments of the present invention can be performed by a computer apparatus. In one example, a computer program may be installed and run on a computer device for controlling a computer device to perform a data migration method, the computer program being coupled to the computer device to cause the computer device to execute a data migration method, Can be stored in the medium.

도 1은 본 발명의 일실시예에 있어서, 데이터베이스에 저장된 데이터의 예를 도시한 도면이고, 도 2는 본 발명의 일실시예에 있어서, 데이터의 샤딩 예를 도시한 도면이다. 도 1 및 도 2는 데이터베이스(110)에 저장된 데이터에 대한 데이터베이스 샤딩(database sharding)에 의해, 데이터들이 n 개의 샤드 노드들(210, 220 및 230)로 분산된 예를 나타내고 있다. 예를 들어, 도 1 및 도 2에서는 레코드들을 식별하기 위한 식별자인 'id1', 'id2', 'id3', 'id4'를 샤드키(shardkey)로 이용하여 동일한 샤드키의 레코드들을 모아서 n 개의 샤드들(210, 220 및 230)로 분산한 예를 나타내고 있다. 이때, 샤드키 단위의 데이터는 동일한 샤드키를 통해 식별되는 데이터를 의미할 수 있다. 예를 들어, 도 2에서는 샤드키 'id2'를 통해 식별되는 데이터를 굵은 실선(240)을 통해 표시하고 있다.FIG. 1 is a diagram illustrating an example of data stored in a database according to an embodiment of the present invention. FIG. 2 is a diagram illustrating an example of data sharding in an embodiment of the present invention. 1 and 2 show an example in which data is distributed to n shard nodes 210, 220 and 230 by database sharding of data stored in the database 110. [ For example, in FIG. 1 and FIG. 2, records of the same shard key are collected by using the identifiers 'id1', 'id2', 'id3', and 'id4' Shards 210, 220, and 230, respectively. In this case, the data in units of the shard key may mean data identified through the same shard key. For example, in FIG. 2, the data identified through the shard key 'id2' is indicated by a thick solid line 240.

샤드키 단위의 데이터는 용량과 QPS(Query Per Second)는 상대적으로 작은 편이나, 샤드키의 개수가 매우 많고, 따라서 결과적으로 데이터베이스 전체 용량과 QPS는 매우 크다는 특징을 갖는다. 또한, 샤드키를 통해 식별되는 데이터간의 관계(relation)은 의미가 있지만, 서로 다른 샤드키를 통해 식별되는 데이터간의 관계는 의미가 없다는 특징을 갖는다. 다시 말해, 하나의 샤드키를 통해 식별되는 데이터는 다른 샤드키를 통해 식별되는 데이터에 대해 의존성을 갖지 않으며, 샤드키 단위로 독립적인 개별 연산(트랜잭션)의 처리가 가능하다.The data of the shard key unit has a relatively small capacity and QPS (Query Per Second), but the number of the shard key is very large, and as a result, the database overall capacity and the QPS are very large. Further, the relation between the data identified through the shard key is meaningful, but the relationship between the data identified through the different shard keys is meaningless. In other words, the data identified through one shard key has no dependency on the data identified by the other shard keys, and it is possible to process independent individual operations (transactions) on a shard key basis.

n 개의 샤드 노드들(210, 220 및 230) 각각은 제1 샤드 노드(210)을 통해 나타나는 바와 같이, 하나의 샤드키에 대응하는 데이터를 포함할 수도 있으나, 제2 샤드 노드(220)을 통해 나타나는 바와 같이, 다수의 샤드키에 대응하는 데이터를 포함할 수도 있다.Each of the n shard nodes 210,220 and 230 may include data corresponding to one shard key, as shown through the first shard node 210, As shown, it may include data corresponding to a plurality of shard keys.

이때, 본 발명의 실시예들에서는 앞서 설명한 샤드키 단위의 데이터와 관련하여 샤드키들을 기설정된 수의 복수의 그룹으로 분류하고, 복수의 그룹들의 그룹 식별자들을 통해 데이터에 대한 정합성 검사를 처리할 수 있다. 이때, 각각의 데이터베이스 서버들은 자신이 관리하는 샤드키가 분류된 그룹의 그룹 식별자들을 관리할 수 있다.At this time, in the embodiments of the present invention, the shard keys are classified into a plurality of groups of a predetermined number in relation to the data of the shard key described above, and the consistency check of the data is performed through the group identifiers of the plurality of groups have. At this time, each of the database servers can manage the group identifiers of the group in which the shard key managed by the database servers is classified.

도 3은 본 발명의 일실시예에 있어서, 데이터 마이그레이션의 과정의 예를 도시한 도면이다. 도 3은 데이터베이스 m(310)의 데이터를 데이터베이스 n(320)으로 마이그레이션(330)하는 예를 나타내고 있다.3 is a diagram illustrating an example of a process of data migration in an embodiment of the present invention. FIG. 3 shows an example of migrating (330) the data of the database m 310 to the database n 320.

이때, 마이그레이션(330) 도중에 데이터베이스 m(310)에 반영되는 트랜잭션은 트랜잭션 로그(311)를 이용하여 데이터베이스 n(320)에 동시 반영될 수 있다. 예를 들어, 마이그레이션(330) 도중에 제1 연산이 데이터베이스 m(310)의 특정 데이터에 대해 반영되는 경우, 제1 연산에 대한 트랜잭션 로그를 분석하여 제1 연산이 제2 데이터베이스에도 동시에 반영될 수 있다. 따라서, 복제 지연 시간을 줄일 수 있으며, 해당 데이터에 대한 접근 차단 시간을 줄일 수 있게 된다.At this time, the transaction reflected in the database m 310 during the migration 330 may be simultaneously reflected in the database n 320 using the transaction log 311. For example, if during the migration 330 the first operation is reflected on the specific data of the database m 310, the transaction log for the first operation may be analyzed so that the first operation may be simultaneously reflected in the second database . Accordingly, the replication delay time can be reduced and the access blocking time for the data can be reduced.

이러한 트랜잭션의 동시 반영을 가능하게 하기 위한 기술들에 대해 보다 자세히 설명한다.Techniques for enabling simultaneous reflection of such transactions are described in more detail.

이미 설명한 바와 같이, 샤드키 단위의 데이터는 독립적으로 연산 처리가 가능하다. 따라서, 샤드키 단위로 데이터를 마이그레이션하는 경우, 이미 마이그레이션된 샤드키 단위의 데이터에 대해서는 트랜잭션을 동시 반영할 수 있게 된다. 예를 들어, 데이터베이스 m(310)에서 샤드키 'a'를 통해 식별되는 데이터가 데이터베이스 n(320)으로 마이그레이션된 경우를 고려할 수 있다. 이때, 샤드키 'a'와 연관된 제1 연산이 요청되는 경우, 데이터베이스 m(310)에 샤드키 'a'에 대응하는 데이터에 제1 연산을 수행할 수 있으며, 트랜잭션 로그의 분석을 통해 데이터베이스 n(320)에도 샤드키 'a'에 대응하는 마이그레이션된 데이터에 제1 연산을 수행할 수 있다.As described above, the data in units of the shard key can be independently processed. Therefore, when data is migrated in units of shard keys, transactions can be simultaneously reflected on the data of the shard key units already migrated. For example, consider the case where the data identified by the shard key 'a' in database m 310 has been migrated to database n 320. At this time, if a first operation associated with the shard key 'a' is requested, a first operation can be performed on the data corresponding to the shard key 'a' in the database m 310, The first operation may be performed on the migrated data corresponding to the shard key 'a'.

이를 위해, 본 발명의 실시예들에 따른 컴퓨터 장치는 샤드키 단위로 데이터베이스 m(310)에 저장된 데이터를 셀렉트(select)하고, 셀렉트된 데이터를 데이터베이스 n(320)에 인서트(insert)할 수 있다.To this end, a computer device according to embodiments of the present invention may select data stored in database m 310 on a shard key basis and insert selected data into database n 320 .

한편, 본 발명의 실시예들에서는 정합성 검사를 위해 그룹 식별자가 활용될 수 있다.Meanwhile, in the embodiments of the present invention, a group identifier may be utilized for the consistency check.

도 4는 본 발명의 일실시예에 있어서, 그룹 식별자의 활용 예를 도시한 도면이다. 본 실시예들에 따른 데이터베이스 서버들 각각은 삽입(INSERT), 갱신(UPDATE), 삭제(DELETE)와 같은 모든 DML(Data Manipulation Language) 질의 수행 시 샤딩 데이터에 대한 정합성 검사를 수행할 수 있다.4 is a diagram illustrating an example of utilization of a group identifier in an embodiment of the present invention. Each of the database servers according to the present embodiments can perform consistency checking on sharding data when performing all DML (Data Manipulation Language) queries such as INSERT, UPDATE, and DELETE.

도 4의 실시예에서는 입력된 쿼리문(410)에서 JDBC(Java DataBase Connectivity, 420)가 샤드키 'id1'을 추출하고, 샤드키 'id1'을 해싱하여 해시값 '3'을 획득하는 예를 나타내고 있다. 이때, 해시값 '3'은 샤드키 'id1'이 포함된 그룹의 그룹 식별자가 될 수 있다. 예를 들어, 모든 샤드키들 각각이 기설정된 해시 함수의 파라미터로 이용되어 모든 샤드키들 각각을 위한 그룹 식별자들이 계산될 수 있다. 보다 구체적인 예로, 100만 개의 샤드키들이 해시 함수를 거쳐 1만 개의 그룹 식별자들이 계산될 수 있고, 그룹 식별자 각각에 대한 1만개의 그룹으로 분류될 수 있다.4, an example of JDBC (Java DataBase Connectivity) 420 extracting a shard key 'id1' and hashing a shard key 'id1' to obtain a hash value '3' in an input query statement 410 Respectively. At this time, the hash value '3' may be the group identifier of the group including the shard key 'id1'. For example, each of the shard keys may be used as a parameter of a predetermined hash function so that group identifiers for each shard key may be computed. In a more specific example, one million group identifiers may be computed through a hash function of one million shard keys, and grouped into 10,000 groups for each group identifier.

이 경우, 새로운 샤드키가 추가된다 하더라도 해시 함수를 통해 해시되는 과정에서 1만개의 그룹 중 하나로 분류되기 때문에 그룹이나 그룹 식별자는 추가되지 않는다. 따라서, 각각의 데이터베이스 서버들은 100만개의 샤드키들 중 자신이 관리하는 샤드키들을 관리하는 것이 아니라, 1만개의 그룹 식별자들 중 자신이 관리하는 그룹 식별자만을 관리함으로써, 특정 샤드키가 자신이 관리하는 그룹에 포함되어 있는지 여부를 확인할 수 있다.In this case, even if a new shard key is added, a group or group identifier is not added because it is classified as one of the 10,000 groups in the process of hashing through the hash function. Therefore, each database server does not manage the shard keys managed by itself among the 1 million shard keys but manages only the group identifier managed by itself among the 10,000 group identifiers, so that the specific shard key is managed by itself Group is included in the group.

이때, 데이터베이스 서버들간의 데이터 이동은 그룹 식별자 또는 샤드키에 대응하는 데이터 단위로 이루어질 수 있다. 예를 들어, 하나의 그룹 식별자에 대응하는 데이터를 이동시킴에 있어서, 해당 그룹 식별자의 그룹에 포함된 샤드키의 단위로 데이터들이 셀렉트 및 인서트될 수 있다. 예를 들어, 데이터베이스 서버 a이 그룹 식별자 1에 대한 데이터를 저장할 때, 데이터베이스 서버 a에서 데이터베이스 서버 b로의 데이터의 이동은 그룹 식별자 1에 대응하는 데이터의 단위로 이루어질 수 있으며, 이때, 그룹 식별자 1에 대응하는 그룹의 샤드키들의 단위로 데이터들이 셀렉트 및 인서트될 수 있다.At this time, the data movement between the database servers may be performed in units of data corresponding to the group identifier or the shard key. For example, in moving data corresponding to one group identifier, data may be selected and inserted in units of a shard key included in the group of the group identifier. For example, when the database server a stores data for the group identifier 1, the movement of data from the database server a to the database server b may be performed in units of data corresponding to the group identifier 1, Data may be selected and inserted in units of the shard keys of the corresponding group.

한편, 도 3에 도시된 바와 같이 데이터베이스 서버(430)는 그룹 식별자들 각각에 대해 자신이 관리하는 데이터에 대응하는 그룹 식별자와 자신이 관리하지 않는 데이터에 대응하는 그룹 식별자를 나타내기 위한 그룹 식별자 비트맵(440)을 관리할 수 있다. 예를 들어, 도 4에서 데이터베이스 서버(430)는 그룹 식별자 1, 3, n에 대응하는 데이터를 데이터베이스 j(450)에 저장하여 관리하며(그룹 식별자 1, 3, n의 값이 1로 설정됨), 그룹 식별자 2에 대응하는 데이터는 관리하지 않음(그룹 식별자 2의 값이 0으로 설정됨)을 알 수 있다.3, the database server 430 includes a group identifier bit for indicating a group identifier corresponding to data managed by the group identifier, and a group identifier corresponding to data not managed by the database server 430, The map 440 can be managed. For example, in FIG. 4, the database server 430 stores and manages data corresponding to the group identifiers 1, 3, and n in the database J 450 (the values of the group identifiers 1, 3, and n are set to 1 ), The data corresponding to the group identifier 2 is not managed (the value of the group identifier 2 is set to 0).

이때, 앞서 설명한 바와 같이, JDBC(420)는 쿼리문(410)에서 샤드키 'id1'를 추출하고, 추출된 샤드키 'id1'를 해시 함수를 통해 해싱하여 그룹 식별자 '3'을 추출할 수 있다. 이때, 추출된 그룹 식별자 '3'은 데이터베이스 서버(430)로 전달될 수 있고, 데이터베이스 서버(430)은 추출된 그룹 식별자 '3'을 그룹 식별자 비트맵(440)에서 검색하여 그룹 식별자 '3'에 대응하는 데이터가 데이터베이스 j(450)에 저장되어 데이터베이스 서버(430)에 의해 관리됨을 확인할 수 있다. 다시 말해, 데이터베이스 서버(430)는 요구된 연산과 연계된 데이터의 정합성을 검사할 수 있게 된다. 만약, 추출되어 수신된 그룹 식별자가 '2'라면, 데이터베이스 서버(430)는 잘못된 데이터의 변경 요구가 입력되었음을 파악할 수 있게 된다.At this time, as described above, the JDBC 420 extracts the shard key 'id1' from the query statement 410 and extracts the group identifier '3' by hashing the extracted shard key 'id1' through the hash function have. At this time, the extracted group identifier '3' may be transmitted to the database server 430, and the database server 430 searches the group identifier bitmap 440 for the extracted group identifier '3' Is stored in the database J (450) and managed by the database server (430). In other words, the database server 430 can check the consistency of the data associated with the requested operation. If the extracted group identifier is '2', the database server 430 can recognize that a wrong data change request has been input.

이러한 그룹 식별자는 데이터의 정합성을 검사하기 위해 활용되며, 샤드키와 대응하는 그룹 식별자가 서로 연계되어 관리되는 샤드키-그룹 식별자 테이블이 활용될 수 있다. 예를 들어, 도 3을 통해 설명한 컴퓨터 장치는 샤드키-그룹 식별자 테이블에서 이동할 그룹 식별자에 대응하는 샤드키들을 식별할 수 있으며, 샤드키별로 각 테이블에서 셀렉트(SELECT)와 인서트(INSERT)를 수행함으로써 샤드키 단위의 데이터 이동을 처리할 수 있다. 이러한 샤드키 단위의 데이터의 이동은 적어도 하나의 그룹 식별자에 대응하는 데이터에 대해 수행될 수 있다. 다시 말해, 데이터의 이동은 적어도 하나의 그룹 식별자에 대응하는 데이터들의 이동이 될 수 있으며, 이때, 하나의 그룹 식별자에 대응하는 데이터들은 샤드키 단위로 셀렉트(SELECT)와 인서트(INSERT)를 반복하면서 이루어질 수 있다.Such a group identifier is utilized for checking the consistency of data, and a shard key-group identifier table in which a shard key and a corresponding group identifier are managed in association with each other can be utilized. For example, the computer device illustrated in FIG. 3 may identify the shard keys corresponding to the group identifier to be moved in the shard key-group identifier table, and perform a SELECT and an INSERT in each table according to the shard key. So that data movement in shad key units can be processed. The movement of the data in units of the shard key may be performed for data corresponding to at least one group identifier. In other words, the movement of data may be the movement of data corresponding to at least one group identifier. At this time, data corresponding to one group identifier is repeatedly selected (SELECT) and insert (INSERT) Lt; / RTI >

이때, 그룹 식별자는 마이그레이션이 종료되는 시점에 변경될 수 있다. 앞서 도 4를 통해 설명한 바와 같이 그룹 식별자는 데이터의 정합성을 위해 이용된다. 반면, 도 3에서는 이미 설명한 바와 같이 이미 이전된 샤드키 단위의 데이터에 대해 데이터베이스 m(310)에 먼저 트랜잭션을 적용한다. 이 경우, 데이터베이스 m(310)에서 데이터의 마이그레이션에 따라 바로 특정 그룹 식별자를 변경해버리면, 해당 그룹 식별자에 대한 연산은 데이터베이스 m(310)과 관련하여 정합성 측면의 오류가 발생하게 된다. 예를 들어, 데이터베이스 m(310)이 그룹 식별자 1의 데이터를 관리(일례로, 그룹 식별자 비트맵에서 그룹 식별자 1에 대응하는 값이 '1'로 설정된 상태)하고 있었다고 가정한다. 또한, 도 3에서 데이터베이스 m(310)이 그룹 식별자 1의 데이터를 데이터베이스 n(320)으로 마이그레이션한 직후, 그룹 식별자 비트맵에서 그룹 식별자 1에 대응하는 값을 '0'으로 설정하였다고 가정한다.At this time, the group identifier may be changed at the time when the migration is terminated. As described above with reference to FIG. 4, the group identifier is used for data consistency. On the other hand, in FIG. 3, the transaction is first applied to the database m (310) with respect to the data of the shard key unit already transferred as described above. In this case, if the specific group identifier is immediately changed in accordance with the migration of data in the database m 310, an error in terms of consistency with respect to the database m (310) occurs for the group identifier. For example, it is assumed that the database m 310 manages data of the group identifier 1 (for example, a value corresponding to the group identifier 1 in the group identifier bitmap is set to '1'). 3, it is assumed that a value corresponding to the group identifier 1 is set to '0' in the group identifier bitmap immediately after the database m 310 migrates the data of the group identifier 1 to the database n 320.

이 경우, 그룹 식별자 1과 연관된 연산(실제로는 그룹 식별자 1의 그룹에 포함된 샤드키와 연관된 연산)은 데이터베이스 m(310)에 적용될 수 없기 때문에(정합성 오류), 데이터베이스 m(310)과 데이터베이스 n(320)의 데이터는 동기화될 수 없게 된다. 이 경우 데이터의 동기화를 위해서는 마이그레이션되는 데이터로의 접근을 차단해야만 하고, 따라서 이용자의 SQL 진입을 막는 구간이 길어지게 된다.In this case, since the operation associated with group identifier 1 (actually an operation associated with the shard key contained in the group of group identifier 1) can not be applied to database m 310 (consistency error), database m 310 and database n The data in the memory 320 can not be synchronized. In this case, access to the data to be migrated must be blocked in order to synchronize the data, and thus, the section for preventing the entry of the user into the SQL becomes longer.

이에, 도 3의 실시예에서는 데이터의 마이그레이션이 종료되는 시점에 데이터베이스 m(310)과 데이터베이스 n(320) 각각에서 관리되는 그룹 식별자들을 변경함으로써, 마이그레이션되는 데이터로의 접근 차단 시간을 최소화할 수 있다.In the embodiment of FIG. 3, by changing the group identifiers managed in the database m 310 and the database n 320 at the time when the migration of data ends, the access blocking time to the migrated data can be minimized .

도 5는 본 발명의 일실시예에 있어서, 컴퓨터 장치의 내부 구성을 설명하기 위한 블록도이다. 컴퓨터 장치(500)는 메모리(510), 프로세서(520), 통신 인터페이스(530) 그리고 입출력 인터페이스(540)를 포함할 수 있다. 메모리(510)는 컴퓨터에서 판독 가능한 기록매체로서, RAM(random access memory), ROM(read only memory) 및 디스크 드라이브와 같은 비소멸성 대용량 기록장치(permanent mass storage device)를 포함할 수 있다. 여기서 ROM과 디스크 드라이브와 같은 비소멸성 대용량 기록장치는 메모리(510)와는 구분되는 별도의 영구 저장 장치로서 컴퓨터 장치(500)에 포함될 수도 있다. 또한, 메모리(510)에는 운영체제와 적어도 하나의 프로그램 코드가 저장될 수 있다. 이러한 소프트웨어 구성요소들은 메모리(510)와는 별도의 컴퓨터에서 판독 가능한 기록매체로부터 메모리(510)로 로딩될 수 있다. 이러한 별도의 컴퓨터에서 판독 가능한 기록매체는 플로피 드라이브, 디스크, 테이프, DVD/CD-ROM 드라이브, 메모리 카드 등의 컴퓨터에서 판독 가능한 기록매체를 포함할 수 있다. 다른 실시예에서 소프트웨어 구성요소들은 컴퓨터에서 판독 가능한 기록매체가 아닌 통신 인터페이스(530)를 통해 메모리(510)에 로딩될 수도 있다. 예를 들어, 소프트웨어 구성요소들은 네트워크(560)를 통해 수신되는 파일들에 의해 설치되는 컴퓨터 프로그램에 기반하여 컴퓨터 장치(500)의 메모리(510)에 로딩될 수 있다.5 is a block diagram for explaining an internal configuration of a computer apparatus according to an embodiment of the present invention. The computer device 500 may include a memory 510, a processor 520, a communication interface 530, and an input / output interface 540. The memory 510 may be a computer-readable recording medium and may include a permanent mass storage device such as a random access memory (RAM), a read only memory (ROM), and a disk drive. The non-decaying mass storage device, such as a ROM and a disk drive, may be included in the computer device 500 as a separate persistent storage device separate from the memory 510. The memory 510 may also store an operating system and at least one program code. These software components may be loaded into the memory 510 from a computer readable recording medium separate from the memory 510. [ Such a computer-readable recording medium may include a computer-readable recording medium such as a floppy drive, a disk, a tape, a DVD / CD-ROM drive, and a memory card. In other embodiments, the software components may be loaded into the memory 510 via the communication interface 530 rather than a computer-readable recording medium. For example, the software components may be loaded into the memory 510 of the computer device 500 based on the computer program installed by the files received via the network 560.

프로세서(520)는 기본적인 산술, 로직 및 입출력 연산을 수행함으로써, 컴퓨터 프로그램의 명령을 처리하도록 구성될 수 있다. 명령은 메모리(510) 또는 통신 인터페이스(530)에 의해 프로세서(520)로 제공될 수 있다. 예를 들어 프로세서(520)는 메모리(510)와 같은 기록 장치에 저장된 프로그램 코드에 따라 수신되는 명령을 실행하도록 구성될 수 있다.The processor 520 may be configured to process instructions of a computer program by performing basic arithmetic, logic, and I / O operations. The instructions may be provided to the processor 520 by the memory 510 or the communication interface 530. For example, processor 520 may be configured to execute instructions received in accordance with program code stored in a recording device, such as memory 510. [

통신 인터페이스(530)은 네트워크(560)를 통해 컴퓨터 장치(500)가 다른 장치(일례로, 앞서 설명한 저장 장치들)와 서로 통신하기 위한 기능을 제공할 수 있다. 일례로, 컴퓨터 장치(500)의 프로세서(520)가 메모리(510)와 같은 기록 장치에 저장된 프로그램 코드에 따라 생성한 요청이나 명령, 데이터, 파일 등이 통신 인터페이스(530)의 제어에 따라 네트워크(560)를 통해 다른 장치들로 전달될 수 있다. 역으로, 다른 장치로부터의 신호나 명령, 데이터, 파일 등이 네트워크(560)를 거쳐 컴퓨터 장치(500)의 통신 인터페이스(530)를 통해 컴퓨터 장치(500)로 수신될 수 있다. 통신 인터페이스(530)를 통해 수신된 신호나 명령, 데이터 등은 프로세서(520)나 메모리(510)로 전달될 수 있고, 파일 등은 컴퓨터 장치(500)가 더 포함할 수 있는 저장 매체(상술한 영구 저장 장치)로 저장될 수 있다.The communication interface 530 may provide functionality for the computer device 500 to communicate with another device (e. G., The storage devices described above) via the network 560. [ For example, a request or command, data, file, or the like, generated by the processor 520 of the computer device 500 according to the program code stored in the recording device such as the memory 510, 560 to other devices. Conversely, signals, commands, data, files, etc., from other devices may be received by the computer device 500 via the network 560 and the communication interface 530 of the computer device 500. Data or the like received via the communication interface 530 may be transferred to the processor 520 or the memory 510 and the file or the like may be transferred to a storage medium Permanent storage).

입출력 인터페이스(540)는 입출력 장치(550)와의 인터페이스를 위한 수단일 수 있다. 예를 들어, 입력 장치는 마이크, 키보드 또는 마우스 등의 장치를, 그리고 출력 장치는 디스플레이, 스피커와 같은 장치를 포함할 수 있다. 다른 예로 입출력 인터페이스(540)는 터치스크린과 같이 입력과 출력을 위한 기능이 하나로 통합된 장치와의 인터페이스를 위한 수단일 수도 있다. 입출력 장치(550)는 컴퓨터 장치(500)와 하나의 장치로 구성될 수도 있다.The input / output interface 540 may be a means for interfacing with the input / output device 550. For example, the input device may include a device such as a microphone, a keyboard or a mouse, and an output device may include a device such as a display, a speaker, and the like. As another example, the input / output interface 540 may be a means for interfacing with a device having integrated functions for input and output, such as a touch screen. The input / output device 550 may be composed of the computer device 500 and one device.

또한, 다른 실시예들에서 컴퓨터 장치(500)는 도 5의 구성요소들보다 더 적은 혹은 더 많은 구성요소들을 포함할 수도 있다. 그러나, 대부분의 종래기술적 구성요소들을 명확하게 도시할 필요성은 없다. 예를 들어, 컴퓨터 장치(500)는 상술한 입출력 장치(550) 중 적어도 일부를 포함하도록 구현되거나 또는 트랜시버(transceiver), GPS(Global Positioning System) 모듈, 카메라, 각종 센서, 데이터베이스 등과 같은 다른 구성요소들을 더 포함할 수도 있다.Also, in other embodiments, the computer device 500 may include fewer or more components than the components of FIG. However, there is no need to clearly illustrate most prior art components. For example, the computer device 500 may be implemented to include at least some of the input / output devices 550 described above, or may include other components such as a transceiver, Global Positioning System (GPS) module, camera, As shown in FIG.

이러한 컴퓨터 장치(500)는 일례로, 도 3 및 도 4를 통해 설명한 데이터베이스 서버들(330, 410, 420)에 대응할 수 있다. Such a computer device 500 may correspond to the database servers 330, 410, and 420 described with reference to FIGS. 3 and 4, for example.

도 6은 본 발명의 일실시예에 있어서, 데이터 마이그레이션 방법의 예를 도시한 흐름도이다. 본 실시예에 따른 데이터 마이그레이션 방법은 앞서 설명한 컴퓨터 장치(500)에 의해 수행될 수 있다. 예를 들어, 컴퓨터 장치(500)의 프로세서(520)는 메모리(510)에 로딩된 운영체제의 코드나 적어도 하나의 프로그램의 코드에 따른 제어 명령(instruction)을 실행하도록 구현될 수 있다. 여기서, 프로세서(520)는 이러한 제어 명령에 따라 컴퓨터 장치(500)가 도 6의 데이터 마이그레이션 방법이 포함하는 단계들(610 및 650)을 수행하도록 컴퓨터 장치(500)를 제어할 수 있다.6 is a flowchart showing an example of a data migration method in an embodiment of the present invention. The data migration method according to the present embodiment can be performed by the computer apparatus 500 described above. For example, the processor 520 of the computer device 500 may be implemented to execute a control instruction according to code of an operating system loaded in the memory 510 or code of at least one program. Here, the processor 520 may control the computer apparatus 500 so that the computer apparatus 500 performs the steps 610 and 650 included in the data migration method of FIG. 6 according to this control instruction.

단계(610)에서 컴퓨터 장치(500)는 샤딩(sharding)된 데이터의 샤드키(shardkey)들을 분류하여 생성된 기설정된 수의 복수의 그룹들 각각의 그룹 식별자들과 관련하여, 제1 데이터베이스의 그룹 식별자와 제2 데이터베이스의 그룹 식별자를 관리할 수 있다.In step 610, the computer device 500 generates a group of sharded data, in association with the group identifiers of each of the predetermined number of groups generated by classifying the shardkeys of the sharded data, And can manage the identifier and the group identifier of the second database.

단계(620)에서 컴퓨터 장치(500)는 제1 데이터베이스에서 제2 데이터베이스로 복제하고자 하는 데이터를 위한 샤드키들을 식별할 수 있다. 예를 들어, 컴퓨터 장치(500)는 그룹에 포함된 샤드키들과 그룹의 그룹 식별자를 연계하여 저장하는 샤드키-그룹 식별자 테이블에서 제1 데이터베이스가 관리하는 그룹 식별자를 통해 복제하고자 하는 데이터를 위한 샤드키들을 식별할 수 있다. 도 4를 통해 설명한 바와 같이 각각의 데이터베이스를 위한 그룹 식별자들이 관리될 수 있으며, 이러한 그룹 식별자들과 샤드키-그룹 식별자 테이블을 통해 마이그레이션되어야 할 데이터의 샤드키들이 식별될 수 있다.In step 620, the computing device 500 may identify the shard keys for data to be replicated from the first database to the second database. For example, in the computer device 500, a shard key-group identifier table in which a shard key included in a group is stored in association with a group identifier of a group, a shard key for data to be duplicated through a group identifier managed by the first database, Keys can be identified. As described with reference to FIG. 4, the group identifiers for each database can be managed, and the shard keys of the data to be migrated through the group identifiers and the shard key-group identifier table can be identified.

단계(630)에서 컴퓨터 장치(500)는 식별된 샤드키들에 대응하는 데이터를 제1 데이터베이스에서 제2 데이터베이스로 마이그레이션할 수 있다. 이미 설명한 바와 같이 컴퓨터 장치(500)는 식별된 샤드키를 이용하여 제1 데이터베이스에서 복제하고자 하는 데이터를 셀렉트(select)하고, 셀렉트된 데이터를 제2 데이터베이스로 인서트(insert)하는 방식을 통해 샤드키 단위로 데이터를 마이그레이션할 수 있다.In step 630, the computer device 500 may migrate data corresponding to the identified shard keys from the first database to the second database. As described above, the computer device 500 selects the data to be duplicated in the first database using the identified shard key, inserts the selected data into the second database, You can migrate data in units.

단계(640)에서 컴퓨터 장치(500)는 마이그레이션 도중에, 제1 데이터베이스에 반영된 트랜잭션을, 트랜잭션 로그를 이용하여 제2 데이터베이스에 동시 반영할 수 있다. 이때, 컴퓨터 장치(500)는 상기 제1 데이터베이스에서 상기 제2 데이터베이스로 마이그레이션이 완료된 샤드키의 데이터에 대한 트랜잭션을 상기 트랜잭션 로그에 대한 분석을 통해 확인하여 상기 제2 데이터베이스에 반영할 수 있다. 이미 설명한 바와 같이, 샤드키 단위의 데이터는 독립적인 연산이 가능하기 때문에 마이그레이션이 완료된 샤드키의 데이터에 대해서는 제1 데이터베이스와 제2 데이터베이스 모두에 트랜잭션의 적용이 가능하다. 이를 통해 마이그레이션이 완료된 샤드키의 데이터에 대한 접근을 차단하지 않고, 마이그레이션 도중에 연산을 바로 제1 데이터베이스와 제2 데이터베이스의 데이터 모두에 수행하여 데이터를 동기화시킬 수 있게 된다.At step 640, during the migration, the computer device 500 may concurrently reflect the transaction reflected in the first database to the second database using the transaction log. At this time, the computer device 500 can confirm the transaction of the data of the shard key migrated from the first database to the second database through the analysis of the transaction log and reflect the transaction to the second database. As described above, since the shad key unit data can be independently operated, the transaction can be applied to both the first database and the second database with respect to the data of the shard key that has been migrated. Accordingly, the data can be synchronized by performing operations on both data of the first database and the second database during the migration without blocking access to the data of the shard key that has been migrated.

단계(650)에서 컴퓨터 장치(500)는 데이터의 마이그레이션에 따라 제1 데이터베이스 및 제2 데이터베이스 각각에서 관리되는 그룹 식별자들을 변경할 수 있다. 앞서 설명한 바와 같이, 컴퓨터 장치(500)는 마이그레이션되는 데이터로의 접근 차단 시간을 최소화하기 위해, 데이터의 마이그레이션이 종료되는 시점에 제1 데이터베이스와 제2 데이터베이스의 그룹 식별자들을 변경할 수 있다.At step 650, the computer device 500 may change the group identifiers managed in the first database and the second database, respectively, in accordance with the migration of data. As described above, the computer device 500 may change the group identifiers of the first database and the second database at the time when the migration of data ends, in order to minimize the access blocking time to the migrated data.

예를 들어, 컴퓨터 장치(500)는 소스 데이터베이스인 제1 데이터베이스와 타겟 데이터베이스인 제2 데이터베이스에서 그룹 식별자 비트맵(일례로, 도 4에서 설명한 그룹 식별자 비트맵(440))의 하나의 비트(bit)를 서로 바꾸는 연산을 마이그레이션하고자 하는 그룹의 개수만큼 반복할 수 있다. 이때, 마이그레이션은 그룹에 속하는 복수의 샤드키에 대응하는 데이터를 순차적으로 이동시키는 과정과 그룹에 속하는 트랜잭션 로그를 반영하는 과정의 두 가지 과정을 마이그레이션하고자 하는 그룹의 개수만큼 반복하여 진행될 수 있다.For example, the computer device 500 may store one bit of a group identifier bitmap (e.g., the group identifier bitmap 440 described in FIG. 4) in a first database that is a source database and a second database that is a target database. ) Can be repeated by the number of groups to be migrated. In this case, the migration may be repeated as many times as the number of groups to be migrated, that is, the process of sequentially moving the data corresponding to the plurality of shard keys belonging to the group and the process of reflecting the transaction log belonging to the group.

이때, 샤드키에 대응하는 데이터를 이동시키는 과정은 앞서 설명한 바와 같이, 제1 데이터베이스에서 해당 샤드키에 대응하는 데이터가 있는 다수의 테이블들에 대해서 각 테이블마다 데이터를 셀렉트(SELECT)해서 셀렉트된 데이터를 제2 데이터베이스의 해당 테이블로 인서트(INSERT)하는 것일 수 있다. 이 경우, 컴퓨터 장치(500)는 제1 데이터베이스에서 특정 샤드키를 조건으로 데이터를 셀렉트할 때에는 배타적 셀렉트(예를 들어, SQL에서 업데이트를 위한 셀렉트(select for update) 구문)를 수행하고, 그 결과를 제2 데이터베이스에 인서트한 다음 상술한 배타적 셀렉트를 마칠 수 있다. 배타적 셀렉트가 유지되는 동안에 제1 데이터베이스에서 해당 샤드키로 데이터를 변경하는 것은 락(lock)을 통해 블록(block)될 수 있다. 배타적 셀렉트가 종료되면, 락이 해제되면서 블록되어 있던 데이터 변경(트랜잭션의 반영)이 진행될 수 있으며, 이러한 제1 데이터베이스에서의 데이터의 변경은 트랜잭션 로그를 통해서 제2 데이터베이스에 반영(해당 샤드키에 대응하는 데이터에 반영)될 수 있다. 다시 말해, 샤드키에 대응하는 옮기는 구간과 해당 샤드키에 대응하는 데이터를 변경하는 연산이 서로 겹치지 않도록 함으로써, 데이터의 이동에 따른 무결성이 보장될 수 있다.As described above, in the process of moving data corresponding to the shard key, data is selected for each table for a plurality of tables having data corresponding to the shard key in the first database, To the corresponding table in the second database. In this case, the computer device 500 performs an exclusive select (for example, a select for update syntax for updating in SQL) when data is selected on the basis of a specific shard key in the first database, To the second database and then complete the above-mentioned exclusive selection. Changing the data from the first database to the corresponding shard key while the exclusive select is maintained may be blocked through a lock. When the exclusive select is terminated, the locked data change (reflection of the transaction) may proceed while the lock is released, and the change of data in the first database is reflected in the second database through the transaction log Reflected in the data). In other words, since the operation of changing the shifting interval corresponding to the shard key and the data corresponding to the shard key are not overlapped with each other, integrity according to the movement of the data can be assured.

하나의 그룹에 속하는 모든 샤드키의 데이터를 이동하고, 데이터의 이동 도중에 발생하는 트랜잭션까지 트랜잭션 로그를 이용하여 모두 반영한 경우, 제1 데이터베이스(보다 자세하게는 제1 데이터베이스를 관리하는 데이터베이스 서버)는 현재 진행 중인 트랜잭션 중에서 해당 그룹과 관련된 트랜잭션이 존재하지 않을 때까지 대기할 수 있으며, 현재 진행 중인 트랜잭션 중에서 해당 그룹과 관련된 트랜잭션이 존재하지 않을 때, 제1 데이터베이스의 그룹 식별자 비트맵에서 해당 그룹에 해당하는 비트를 오프(off)시킬 수 있다. 예를 들어, 제1 데이터베이스는 해당 그룹의 그룹 식별자와 연관하여 설정된 비트의 값을 '1'에서 '0'으로 변경할 수 있다. 한편, 컴퓨터 장치(500)는 트랜잭션 로그를 통해 제1 데이터베이스의 그룹 식별자 비트맵에서 해당 그룹에 해당하는 비트를 오프(off)시키는 로그에 따라 제2 데이터베이스의 그룹 식별자 비트맵에서 해당 그룹에 해당하는 비트를 온(On)시킬 수 있다. 예를 들어, 컴퓨터 장치(500)는 제2 데이터베이스(보다 자세하게는 제2 데이터베이스를 관리하는 데이터베이스 서버)가 해당 그룹의 그룹 식별자와 연관하여 설정된 비트의 값을 '0'에서 '1'으로 변경하도록 제어할 수 있다.In the case where data of all the shard keys belonging to one group are moved and all the transactions occurring during the movement of the data are reflected by using the transaction log, the first database (more specifically, the database server managing the first database) If there is no transaction related to the group among the currently active transactions, the bit corresponding to the corresponding group in the group identifier bitmap of the first database Can be turned off. For example, the first database may change the value of the bit set in association with the group identifier of the group from '1' to '0'. On the other hand, the computer device 500 accesses the corresponding group in the group identifier bitmap of the second database according to the log which turns off the bit corresponding to the corresponding group in the group identifier bitmap of the first database through the transaction log Bit can be turned on. For example, the computer device 500 may cause the second database (more specifically, the database server managing the second database) to change the value of the bit set in association with the group identifier of the group from '0' to '1' Can be controlled.

도 7 및 도 8은 본 발명의 일실시예에 따른 데이터 마이그레이션 방법이 적용되는 과정의 예를 도시한 도면들이다.FIG. 7 and FIG. 8 are views illustrating an example of a process of applying the data migration method according to an embodiment of the present invention.

우선, 도 7은 새로운 노드가 추가됨에 따라 마이그레이션이 발생하는 예를 설명하고 있다. 데이터베이스 샤딩 환경에서의 모든 노드들은 동일한 스키마를 유지할 수 있으며, 글로벌 테이블을 공유할 수 있다. 도 7에 도시된 기존 노드인 노드 1(710) 역시 스키마와 글로벌 테이블을 공유할 수 있다. 도 7에서는 노드 1(710)이 마스터 데이터베이스 1(711)과 슬레이브 데이터베이스 1(712)을 포함하는 예를 나타내고 있다.First, FIG. 7 illustrates an example in which migration occurs as new nodes are added. All nodes in the database sharding environment can maintain the same schema and share global tables. The node 1 710, which is an existing node shown in FIG. 7, can also share a schema and a global table. 7 shows an example in which the node 1 710 includes a master database 1 711 and a slave database 1 712.

이때, 새로운 노드인 노드 2(720)가 추가되는 상황을 고려할 수 있다. 이미 설명한 바와 같이, 데이터베이스 샤딩 환경에서의 모든 노드들은 동일한 스키마와 글로벌 테이블을 공유하기 때문에, 노드 2(720)에도 이러한 스키마와 글로벌 테이블이 공유될 수 있다. 이때, 공유될 스키마와 글로벌 테이블이 도 6을 통해 설명한 데이터 마이그레이션 방법에 따라 노드 1(710)의 마스터 데이터베이스 1(711)에서 노드 2(720)의 마스터 데이터베이스 2(721)로 복제될 수 있다. 여기서 마이그레이터(migrator, 730)는 앞서 설명한 컴퓨터 장치(500)가 데이터의 마이그레이션을 위해 포함하는 모듈일 수 있다.At this time, it is possible to consider a situation in which node 2 720, which is a new node, is added. As already explained, since all the nodes in the database sharding environment share the same schema and global table, this schema and the global table can be shared with the node 2 720 as well. At this time, the schema to be shared and the global table can be copied from the master database 1 711 of the node 1 710 to the master database 2 721 of the node 2 720 according to the data migration method described with reference to FIG. Here, the migrator 730 may be a module that the above-described computer device 500 includes for data migration.

다만, 스키마나 글로벌 테이블은 이용자의 요구에 따라 임의로 처리되는 데이터나 샤딩된 데이터가 아니기 때문에 마이그레이션 도중에 트랜잭션의 반영이나 그룹 식별자의 변경을 고려할 필요가 없다.However, since the schema or the global table is not arbitrary data or sharded data according to the user's request, it is not necessary to consider the reflection of the transaction or the change of the group identifier during the migration.

한편, 도 8은 기존 노드(710)의 샤딩된 데이터를 새로운 노드인 노드 2(720)로 마이그레이션하여 데이터를 리밸런싱하는 예를 나타내고 있다. 예를 들어, 노드 1(710)이 관리하는 그룹 식별자 '3'에 대응하는 데이터를 노드 2(720)로 마이그레이션하여 데이터를 리밸런싱하는 과정을 고려할 수 있다.Meanwhile, FIG. 8 shows an example of rebalancing data by migrating the sharded data of the existing node 710 to the new node 2 720. For example, a process of migrating data corresponding to the group identifier '3' managed by the node 1 710 to the node 2 720 and rebalancing the data may be considered.

마이그레이터(730)는 그룹 식별자 '3'에 대응하는 데이터를 위한 샤드키들을 식별할 수 있다. 이미 설명한 바와 같이, 컴퓨터 장치(500)는 샤드키-그룹 식별자 테이블을 통해 그룹 식별자 '3'에 대응하는 샤드키들을 확인할 수 있다. 또한, 마이그레이터(730)는 노드 1(710)의 슬레이브 데이터베이스 1(712)에서 상기 식별된 샤드키들에 대응하는 데이터를 노드 2(720)의 마스터 데이터베이스 2(721)로 마이그레이션할 수 있다. 이 경우, 마이그레이션하고자 하는 데이터의 소스 데이터베이스는 노드 1(710)의 슬레이브 데이터베이스 1(712)가 될 수 있고, 데이터가 전달되는 타겟 데이터베이스는 노드 2(720)의 마스터 데이터베이스 2(721)가 될 수 있다. 실시예에 따라 노드 1(710)의 마스터 데이터베이스 1(711)이 소스 데이터베이스가 될 수도 있다.Migrator 730 may identify the shard keys for data corresponding to group identifier '3'. As described above, the computer device 500 can identify the shard keys corresponding to the group identifier '3' through the shard key-group identifier table. The migrator 730 may also migrate data corresponding to the identified shard keys in the slave database 1 712 of the node 1 710 to the master database 2 721 of the node 2 720. In this case, the source database of the data to be migrated may be the slave database 1 712 of the node 1 710, and the target database to which the data is transferred may be the master database 2 721 of the node 2 720 have. According to an embodiment, master database 1 711 of node 1 710 may be the source database.

예를 들어 그룹 식별자 '3'에 대응하는 샤드키들이 'a', 'b', 'c', 'd'라 가정한다.For example, it is assumed that the shard keys corresponding to the group identifier '3' are 'a', 'b', 'c', and 'd'.

마이그레이션 도중에 샤드키 'a'에 대응하는 데이터에 대한 트랜잭션이 발생하였고, 샤드키 'a'에 대응하는 데이터는 슬레이브 데이터베이스 1(712)에서 마스터 데이터베이스 2(721)로 마이그레이션이 완료되었다고 가정한다. 이 경우, 마스터 데이터베이스 1(711)에 저장된 샤드키 'a'에 대응하는 데이터와 슬레이브 데이터베이스 1(712) 및 마스터 데이터베이스 2(721)에 저장된 샤드키 'a'에 대응하는 데이터는 서로 달라질 수 있다.During the migration, a transaction for data corresponding to the shard key 'a' has occurred, and the data corresponding to the shard key 'a' is assumed to have been migrated from the slave database 1 712 to the master database 2 721. In this case, the data corresponding to the shard key 'a' stored in the master database 1 711 and the data corresponding to the shard key 'a' stored in the slave database 1 712 and the master database 2 721 may be different from each other .

따라서, 마스터 데이터베이스 1(711)에 반영된 트랜잭션이 각각 슬레이브 데이터베이스 1(712) 및 마스터 데이터베이스 2(721)에도 반영되어야 한다. 이때, 마이그레이터(730)는 트랜잭션 로그를 분석하여 해당 트랜잭션을 슬레이브 데이터베이스 1(712) 및 마스터 데이터베이스 2(721)에 각각 동시 반영할 수 있다. 이미 설명한 바와 같이 샤드키 단위의 데이터들은 서로에 대해 독립적인 처리가 가능하기 때문에, 마이그레이션이 특정 샤드키에 대응하는 데이터에 대해 완료되었다면, 전체 마이그레이션이 완료되기 이전에도 트랜잭션을 동시 반영하여 데이터를 동기화할 수 있다. 따라서, 복제 지연 시간을 줄일 수 있다.Therefore, the transactions reflected in the master database 1 711 must be reflected in the slave database 1 712 and the master database 2 721, respectively. At this time, the migrator 730 may analyze the transaction log and simultaneously reflect the transaction in the slave database 1 712 and the master database 2 721, respectively. As described above, since the shard key units of data can be processed independently of each other, if the migration is completed for data corresponding to a specific shard key, can do. Therefore, the replication delay time can be reduced.

한편, 그룹 식별자 '3'을 관리하는 노드에 대한 정보는 전체 샤드키들에 대한 마이그레이션이 모두 완료된 후에 변경될 수 있다. 예를 들어, 마이그레이션이 진행 중인 경우에는 그룹 식별자 '3'의 데이터를 노드 1(710)이 관리하는 것으로 되어 있기 때문에 앞서 설명한 바와 같이 그룹 식별자 '3'의 데이터에 대해 발생하는 트랜잭션은 마스터 데이터베이스 1(711)에 반영된 후 트랜잭션 로그를 이용하여 슬레이브 데이터베이스 1(712) 및 마스터 데이터베이스 2(721)에 각각 동시 반영될 수 있다. 반면, 마이그레이션이 모두 완료된 후에는 그룹 식별자 '3'을 관리하는 노드가 노드 1(710)에서 노드 2(720)로 변경될 수 있다. 이때, 그룹 식별자 '3'을 관리하는 노드를 변경하는 아주 짧은 시간 동안만 그룹 식별자 '3'에 대응하는 데이터로의 접근이 차단될 수 있다. 따라서, 마이그레이션되는 데이터로의 접근 차단 시간을 획기적으로 줄일 수 있게 된다. 그룹 식별자 '3'을 관리하는 노드가 변경되고 나면, 그룹 식별자 '3'에 포함된 샤드키들과 관련된 트랜잭션들이 노드 2(720)에 적용될 수 있다.On the other hand, the information on the node managing the group identifier " 3 " can be changed after the migration for all the shard keys is completed. For example, when the migration is in progress, since the node 1 710 manages the data of the group identifier '3', the transaction occurring for the data of the group identifier '3' (711) and can be simultaneously reflected in the slave database 1 (712) and the master database 2 (721) using the transaction log. On the other hand, after the migration is completed, the node managing the group identifier '3' may be changed from the node 1 710 to the node 2 720. At this time, access to the data corresponding to the group identifier '3' may be blocked only for a very short time to change the node managing the group identifier '3'. Therefore, it is possible to drastically reduce the access blocking time to the migrated data. Once the node managing group identifier '3' is changed, transactions associated with the shard keys included in group identifier '3' may be applied to node 2 720.

이처럼, 마스터 데이터베이스와 슬레이브 데이터베이스간의 데이터 복제뿐만 아니라, 노드간 데이터 복제에도 본 발명의 실시예들에 따른 데이터 마이그레이션 방법이 활용될 수 있다.As described above, the data migration method according to the embodiments of the present invention can be utilized not only for data replication between a master database and a slave database, but also for data replication between nodes.

이처럼 본 발명의 실시예들에 따르면, 제1 데이터베이스와 제2 데이터베이스간의 데이터 마이그레이션(migration) 도중에 제1 데이터베이스에 반영되는 트랜잭션을 트랜잭션 로그를 이용하여 제2 데이터베이스에 동시 반영함으로써, 복제 지연 시간을 줄일 수 있으며, 마이그레이션되는 데이터로의 접근 차단 시간을 줄일 수 있다. 또한, 트랜잭션을 동시에 반영하면서 데이터의 마이그레이션이 종료되는 시점에 제1 데이터베이스와 제2 데이터베이스에서 각각 관리되는 그룹 식별자들을 변경함에 따라 마이그레이션되는 데이터로의 접근 차단 시간을 최소화할 수 있다.As described above, according to the embodiments of the present invention, the transaction reflected in the first database during the data migration between the first database and the second database is simultaneously reflected in the second database using the transaction log, thereby reducing the replication delay time And can reduce the access blocking time to the migrated data. In addition, by changing the group identifiers managed in the first database and the second database at the time when the migration of the data is terminated while simultaneously reflecting the transactions, the access blocking time to the migrated data can be minimized.

이상에서 설명된 시스템 또는 장치는 하드웨어 구성요소, 소프트웨어 구성요소 또는 하드웨어 구성요소 및 소프트웨어 구성요소의 조합으로 구현될 수 있다. 예를 들어, 실시예들에서 설명된 장치 및 구성요소는, 예를 들어, 프로세서, 콘트롤러, ALU(arithmetic logic unit), 디지털 신호 프로세서(digital signal processor), 마이크로컴퓨터, FPGA(field programmable gate array), PLU(programmable logic unit), 마이크로프로세서, 또는 명령(instruction)을 실행하고 응답할 수 있는 다른 어떠한 장치와 같이, 하나 이상의 범용 컴퓨터 또는 특수 목적 컴퓨터를 이용하여 구현될 수 있다. 처리 장치는 운영 체제(OS) 및 상기 운영 체제 상에서 수행되는 하나 이상의 소프트웨어 어플리케이션을 수행할 수 있다. 또한, 처리 장치는 소프트웨어의 실행에 응답하여, 데이터를 접근, 저장, 조작, 처리 및 생성할 수도 있다. 이해의 편의를 위하여, 처리 장치는 하나가 사용되는 것으로 설명된 경우도 있지만, 해당 기술분야에서 통상의 지식을 가진 자는, 처리 장치가 복수 개의 처리 요소(processing element) 및/또는 복수 유형의 처리 요소를 포함할 수 있음을 알 수 있다. 예를 들어, 처리 장치는 복수 개의 프로세서 또는 하나의 프로세서 및 하나의 콘트롤러를 포함할 수 있다. 또한, 병렬 프로세서(parallel processor)와 같은, 다른 처리 구성(processing configuration)도 가능하다.The system or apparatus described above may be implemented as a hardware component, a software component or a combination of hardware components and software components. For example, the apparatus and components described in the embodiments may be implemented within a computer system, such as, for example, a processor, a controller, an arithmetic logic unit (ALU), a digital signal processor, a microcomputer, a field programmable gate array (FPGA) , A programmable logic unit (PLU), a microprocessor, or any other device capable of executing and responding to instructions. The processing device may execute an operating system (OS) and one or more software applications running on the operating system. The processing device may also access, store, manipulate, process, and generate data in response to execution of the software. For ease of understanding, the processing apparatus may be described as being used singly, but those skilled in the art will recognize that the processing apparatus may have a plurality of processing elements and / As shown in FIG. For example, the processing unit may comprise a plurality of processors or one processor and one controller. Other processing configurations are also possible, such as a parallel processor.

소프트웨어는 컴퓨터 프로그램(computer program), 코드(code), 명령(instruction), 또는 이들 중 하나 이상의 조합을 포함할 수 있으며, 원하는 대로 동작하도록 처리 장치를 구성하거나 독립적으로 또는 결합적으로(collectively) 처리 장치를 명령할 수 있다. 소프트웨어 및/또는 데이터는, 처리 장치에 의하여 해석되거나 처리 장치에 명령 또는 데이터를 제공하기 위하여, 어떤 유형의 기계, 구성요소(component), 물리적 장치, 가상 장치(virtual equipment), 컴퓨터 저장 매체 또는 장치에 구체화(embody)될 수 있다. 소프트웨어는 네트워크로 연결된 컴퓨터 시스템 상에 분산되어서, 분산된 방법으로 저장되거나 실행될 수도 있다. 소프트웨어 및 데이터는 하나 이상의 컴퓨터 판독 가능 기록매체에 저장될 수 있다.The software may include a computer program, code, instructions, or a combination of one or more of the foregoing, and may be configured to configure the processing device to operate as desired or to process it collectively or collectively Device can be commanded. The software and / or data may be in the form of any type of machine, component, physical device, virtual equipment, computer storage media, or device As shown in FIG. The software may be distributed over a networked computer system and stored or executed in a distributed manner. The software and data may be stored on one or more computer readable recording media.

실시예에 따른 방법은 다양한 컴퓨터 수단을 통하여 수행될 수 있는 프로그램 명령 형태로 구현되어 컴퓨터 판독 가능 매체에 기록될 수 있다. 상기 컴퓨터 판독 가능 매체는 프로그램 명령, 데이터 파일, 데이터 구조 등을 단독으로 또는 조합하여 포함할 수 있다. 매체는 컴퓨터로 실행 가능한 프로그램을 계속 저장하거나, 실행 또는 다운로드를 위해 임시 저장하는 것일 수도 있다. 또한, 매체는 단일 또는 수개 하드웨어가 결합된 형태의 다양한 기록수단 또는 저장수단일 수 있는데, 어떤 컴퓨터 시스템에 직접 접속되는 매체에 한정되지 않고, 네트워크 상에 분산 존재하는 것일 수도 있다. 매체의 예시로는, 하드 디스크, 플로피 디스크 및 자기 테이프와 같은 자기 매체, CD-ROM 및 DVD와 같은 광기록 매체, 플롭티컬 디스크(floptical disk)와 같은 자기-광 매체(magneto-optical medium), 및 ROM, RAM, 플래시 메모리 등을 포함하여 프로그램 명령어가 저장되도록 구성된 것이 있을 수 있다. 또한, 다른 매체의 예시로, 애플리케이션을 유통하는 앱 스토어나 기타 다양한 소프트웨어를 공급 내지 유통하는 사이트, 서버 등에서 관리하는 기록매체 내지 저장매체도 들 수 있다. 프로그램 명령의 예에는 컴파일러에 의해 만들어지는 것과 같은 기계어 코드뿐만 아니라 인터프리터 등을 사용해서 컴퓨터에 의해서 실행될 수 있는 고급 언어 코드를 포함한다.The method according to an embodiment may be implemented in the form of a program command that can be executed through various computer means and recorded in a computer-readable medium. The computer-readable medium may include program instructions, data files, data structures, and the like, alone or in combination. The medium may be one that continues to store computer executable programs, or temporarily store them for execution or download. In addition, the medium may be a variety of recording means or storage means in the form of a combination of a single hardware or a plurality of hardware, and is not limited to a medium directly connected to a computer system, but may be dispersed on a network. Examples of the medium include a magnetic medium such as a hard disk, a floppy disk and a magnetic tape, an optical recording medium such as CD-ROM and DVD, a magneto-optical medium such as a floptical disk, And program instructions including ROM, RAM, flash memory, and the like. As another example of the medium, a recording medium or a storage medium managed by a site or a server that supplies or distributes an application store or various other software to distribute the application may be mentioned. Examples of program instructions include machine language code such as those produced by a compiler, as well as high-level language code that can be executed by a computer using an interpreter or the like.

이상과 같이 실시예들이 비록 한정된 실시예와 도면에 의해 설명되었으나, 해당 기술분야에서 통상의 지식을 가진 자라면 상기의 기재로부터 다양한 수정 및 변형이 가능하다. 예를 들어, 설명된 기술들이 설명된 방법과 다른 순서로 수행되거나, 및/또는 설명된 시스템, 구조, 장치, 회로 등의 구성요소들이 설명된 방법과 다른 형태로 결합 또는 조합되거나, 다른 구성요소 또는 균등물에 의하여 대치되거나 치환되더라도 적절한 결과가 달성될 수 있다.While the present invention has been particularly shown and described with reference to exemplary embodiments thereof, it is to be understood that the invention is not limited to the disclosed exemplary embodiments. For example, it is to be understood that the techniques described may be performed in a different order than the described methods, and / or that components of the described systems, structures, devices, circuits, Lt; / RTI > or equivalents, even if it is replaced or replaced.

그러므로, 다른 구현들, 다른 실시예들 및 특허청구범위와 균등한 것들도 후술하는 특허청구범위의 범위에 속한다.Therefore, other implementations, other embodiments, and equivalents to the claims are also within the scope of the following claims.

Claims (12)

적어도 하나의 프로세서를 포함하는 컴퓨터 장치의 데이터 마이그레이션(migration) 방법에 있어서,
상기 적어도 하나의 프로세서에 의해, 샤딩(sharding)된 데이터의 샤드키(shardkey)들을 분류하여 생성된 기설정된 수의 복수의 그룹들 각각의 그룹 식별자들과 관련하여, 제1 데이터베이스의 그룹 식별자와 제2 데이터베이스의 그룹 식별자를 관리하는 단계;
상기 적어도 하나의 프로세서에 의해, 상기 제1 데이터베이스에서 상기 제2 데이터베이스로 복제하고자 하는 데이터를 위한 샤드키들을 식별하는 단계;
상기 적어도 하나의 프로세서에 의해, 상기 식별된 샤드키들에 대응하는 데이터를 상기 제1 데이터베이스에서 상기 제2 데이터베이스로 마이그레이션하는 단계;
상기 적어도 하나의 프로세서에 의해, 상기 마이그레이션 도중에, 상기 제1 데이터베이스에 반영된 트랜잭션을, 트랜잭션 로그를 이용하여 상기 제2 데이터베이스에 동시 반영하는 단계; 및
상기 적어도 하나의 프로세서에 의해, 상기 데이터의 마이그레이션에 따라 상기 제1 데이터베이스 및 상기 제2 데이터베이스 각각에서 관리되는 그룹 식별자들을 변경하는 단계
를 포함하는 것을 특징으로 하는 데이터 마이그레이션 방법.
A method for data migration of a computer device comprising at least one processor,
A group identifier of a first database and a group identifier of a first database in association with group identifiers of a plurality of groups of a predetermined number generated by sorting shardkeys of sharded data by the at least one processor, Managing a group identifier of the second database;
Identifying, by the at least one processor, shard keys for data to be replicated from the first database to the second database;
Migrating, by the at least one processor, data corresponding to the identified shard keys from the first database to the second database;
Concurrently reflecting, by the at least one processor, the transaction reflected in the first database in the second database using the transaction log during the migration; And
Changing, by the at least one processor, group identifiers managed in each of the first database and the second database in accordance with the migration of the data
The data migration method comprising the steps of:
제1항에 있어서,
상기 그룹 식별자들을 변경하는 단계는,
상기 마이그레이션되는 데이터로의 접근 차단 시간을 최소화하기 위해, 상기 데이터의 마이그레이션이 종료되는 시점에 상기 그룹 식별자들을 변경하는 것을 특징으로 하는 데이터 마이그레이션 방법.
The method according to claim 1,
Wherein changing the group identifiers comprises:
Wherein the group identifiers are changed at a point of time when migration of the data is terminated in order to minimize access blocking time to the migrated data.
제1항에 있어서,
상기 반영하는 단계는,
상기 제1 데이터베이스에서 상기 제2 데이터베이스로 마이그레이션이 완료된 샤드키의 데이터에 대한 트랜잭션을 상기 트랜잭션 로그에 대한 분석을 통해 확인하여 상기 제2 데이터베이스에 반영하는 것을 특징으로 하는 데이터 마이그레이션 방법.
The method according to claim 1,
Wherein the reflecting comprises:
Wherein a transaction for data of a shard key migrated from the first database to the second database is confirmed through analysis of the transaction log and reflected to the second database.
제1항에 있어서,
상기 복제하고자 하는 데이터를 위한 샤드키들을 식별하는 단계는,
그룹에 포함된 샤드키들과 상기 그룹의 그룹 식별자를 연계하여 저장하는 샤드키-그룹 식별자 테이블에서 상기 제1 데이터베이스가 관리하는 그룹 식별자를 통해 복제하고자 하는 데이터를 위한 샤드키들을 식별하는 것을 특징으로 하는 데이터 마이그레이션 방법.
The method according to claim 1,
Wherein identifying shard keys for data to be duplicated comprises:
Identifies shard keys for data to be duplicated through a group identifier managed by the first database in a shard key-group identifier table in which shard keys included in the group are stored in association with the group identifier of the group How to migrate data.
제1항에 있어서,
상기 마이그레이션하는 단계는,
상기 식별된 샤드키를 이용하여 상기 제1 데이터베이스에서 복제하고자 하는 데이터를 셀렉트(select)하고, 상기 셀렉트된 데이터를 상기 제2 데이터베이스로 인서트(insert)하는 것을 특징으로 하는 데이터 마이그레이션 방법.
The method according to claim 1,
Wherein the migrating comprises:
Selecting data to be duplicated in the first database by using the identified shard key, and inserting the selected data into the second database.
컴퓨터와 결합되어 제1항 내지 제5항 중 어느 한 항의 방법을 컴퓨터에 실행시키기 위해 컴퓨터 판독 가능한 기록매체에 저장된 컴퓨터 프로그램.A computer program stored in a computer-readable medium for causing a computer to execute the method of any one of claims 1 to 5 in combination with a computer. 제1항 내지 제5항 중 어느 한 항의 방법을 컴퓨터에 실행시키기 위한 프로그램이 기록되어 있는 것을 특징으로 하는 컴퓨터에서 판독 가능한 기록매체.A computer readable recording medium storing a program for causing a computer to execute the method according to any one of claims 1 to 5. 컴퓨터 장치에 있어서,
컴퓨터에서 판독 가능한 명령을 실행하도록 구현되는 적어도 하나의 프로세서
를 포함하고,
상기 적어도 하나의 프로세서는,
샤딩(sharding)된 데이터의 샤드키(shardkey)들을 분류하여 생성된 기설정된 수의 복수의 그룹들 각각의 그룹 식별자들과 관련하여, 제1 데이터베이스의 그룹 식별자와 제2 데이터베이스의 그룹 식별자를 관리하고,
상기 제1 데이터베이스에서 상기 제2 데이터베이스로 복제하고자 하는 데이터를 위한 샤드키들을 식별하고,
상기 식별된 샤드키들에 대응하는 데이터를 상기 제1 데이터베이스에서 상기 제2 데이터베이스로 마이그레이션하고,
상기 마이그레이션 도중에, 상기 제1 데이터베이스에 반영된 트랜잭션을, 트랜잭션 로그를 이용하여 상기 제2 데이터베이스에 동시 반영하고,
상기 데이터의 마이그레이션에 따라 상기 제1 데이터베이스 및 상기 제2 데이터베이스 각각에서 관리되는 그룹 식별자들을 변경하는 것
을 특징으로 하는 컴퓨터 장치.
A computer device comprising:
At least one processor configured to execute computer readable instructions,
Lt; / RTI >
Wherein the at least one processor comprises:
Managing a group identifier of a first database and a group identifier of a second database in association with group identifiers of a plurality of groups of a predetermined number generated by sorting shardkeys of sharded data, ,
Identifying shard keys for data to be copied from the first database to the second database,
Migrating data corresponding to the identified shard keys from the first database to the second database,
During the migration, the transaction reflected in the first database is simultaneously reflected in the second database using the transaction log,
And changing group identifiers managed in the first database and the second database in accordance with the migration of the data
The computer device comprising:
제8항에 있어서,
상기 적어도 하나의 프로세서는,
상기 마이그레이션되는 데이터로의 접근 차단 시간을 최소화하기 위해, 상기 데이터의 마이그레이션이 종료되는 시점에 상기 그룹 식별자들을 변경하는 것을 특징으로 하는 컴퓨터 장치.
9. The method of claim 8,
Wherein the at least one processor comprises:
And changes the group identifiers at a point of time when migration of the data ends, in order to minimize access blocking time to the migrated data.
제8항에 있어서,
상기 적어도 하나의 프로세서는,
상기 제1 데이터베이스에서 상기 제2 데이터베이스로 마이그레이션이 완료된 샤드키의 데이터에 대한 트랜잭션을 상기 트랜잭션 로그에 대한 분석을 통해 확인하여 상기 제2 데이터베이스에 반영하는 것을 특징으로 하는 컴퓨터 장치.
9. The method of claim 8,
Wherein the at least one processor comprises:
And confirms the transaction for the data of the shard key that has been migrated from the first database to the second database through analysis of the transaction log and reflects the transaction to the second database.
제8항에 있어서,
상기 적어도 하나의 프로세서는,
그룹에 포함된 샤드키들과 상기 그룹의 그룹 식별자를 연계하여 저장하는 샤드키-그룹 식별자 테이블에서 상기 제1 데이터베이스가 관리하는 그룹 식별자를 통해 복제하고자 하는 데이터를 위한 샤드키들을 식별하는 것을 특징으로 하는 컴퓨터 장치.
9. The method of claim 8,
Wherein the at least one processor comprises:
Identifies shard keys for data to be duplicated through a group identifier managed by the first database in a shard key-group identifier table in which shard keys included in the group are stored in association with the group identifier of the group Computer device.
제8항에 있어서,
상기 적어도 하나의 프로세서는,
상기 식별된 샤드키를 이용하여 상기 제1 데이터베이스에서 복제하고자 하는 데이터를 셀렉트(select)하고, 상기 셀렉트된 데이터를 상기 제2 데이터베이스로 인서트(insert)하는 것을 특징으로 하는 컴퓨터 장치.
9. The method of claim 8,
Wherein the at least one processor comprises:
Selects data to be duplicated in the first database using the identified shard key, and inserts the selected data into the second database.
KR1020170101458A 2017-08-10 2017-08-10 Migration based on replication log in database sharding environment KR101989074B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020170101458A KR101989074B1 (en) 2017-08-10 2017-08-10 Migration based on replication log in database sharding environment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020170101458A KR101989074B1 (en) 2017-08-10 2017-08-10 Migration based on replication log in database sharding environment

Publications (2)

Publication Number Publication Date
KR20190017127A KR20190017127A (en) 2019-02-20
KR101989074B1 true KR101989074B1 (en) 2019-06-14

Family

ID=65562291

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020170101458A KR101989074B1 (en) 2017-08-10 2017-08-10 Migration based on replication log in database sharding environment

Country Status (1)

Country Link
KR (1) KR101989074B1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022177564A1 (en) * 2021-02-18 2022-08-25 Futurewei Technologies, Inc. Distributed naming scheme for network-attached storage devices
WO2023227921A1 (en) * 2022-05-23 2023-11-30 Coupang Corp. Systems and methods for database migration
CN116938453B (en) * 2023-09-14 2023-12-12 北京小米移动软件有限公司 Key management method, device, equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101544356B1 (en) * 2012-10-31 2015-08-13 삼성에스디에스 주식회사 Distributed database managing method and composition node thereof supporting dynamic sharding based on the metadata and data transaction quantity
US20170103116A1 (en) 2015-10-07 2017-04-13 Oracle International Corporation Relational database organization for sharding
KR101748912B1 (en) 2014-08-28 2017-07-03 네이버 주식회사 Data storage system in distributed storage environment and cluster management method for upgrading, scaling out and scaling in cluster include in the data storage system

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10439953B2 (en) * 2014-06-23 2019-10-08 Oracle International Corporation System and method for partition migration in a multitenant application server environment
KR102177190B1 (en) * 2014-06-30 2020-11-10 마이크로소프트 테크놀로지 라이센싱, 엘엘씨 Managing data with flexible schema

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR101544356B1 (en) * 2012-10-31 2015-08-13 삼성에스디에스 주식회사 Distributed database managing method and composition node thereof supporting dynamic sharding based on the metadata and data transaction quantity
KR101748912B1 (en) 2014-08-28 2017-07-03 네이버 주식회사 Data storage system in distributed storage environment and cluster management method for upgrading, scaling out and scaling in cluster include in the data storage system
US20170103116A1 (en) 2015-10-07 2017-04-13 Oracle International Corporation Relational database organization for sharding

Also Published As

Publication number Publication date
KR20190017127A (en) 2019-02-20

Similar Documents

Publication Publication Date Title
US10983970B2 (en) Relational database organization for sharding
CN110799960B (en) System and method for database tenant migration
US20150032694A1 (en) Scalable Coordination Aware Static Partitioning For Database Replication
US11263236B2 (en) Real-time cross-system database replication for hybrid-cloud elastic scaling and high-performance data virtualization
US10922280B2 (en) Policy-based data deduplication
WO2017062288A1 (en) Relational database organization for sharding
KR101989074B1 (en) Migration based on replication log in database sharding environment
US9400613B1 (en) Intelligent pairing for snapshot based backups
KR102179871B1 (en) Data replicating in database sharding environment
US9323760B1 (en) Intelligent snapshot based backups
KR102007789B1 (en) Data replicating in database sharding environment
JP6744272B2 (en) Migration management device and migration management method
KR101919816B1 (en) Consistency checking in database sharding environment
US9164691B1 (en) Intelligent configuration for snapshot based backups
US11789971B1 (en) Adding replicas to a multi-leader replica group for a data set
US9355104B1 (en) Intelligent pairing using a lookup database for snapshot based backups
CN112000671A (en) Block chain-based database table processing method, device and system
KR102360268B1 (en) Lock contorl for data in database sharding environment
KR102007788B1 (en) Lock contorl for data in database sharding environment
US20230325378A1 (en) Online Migration From An Eventually Consistent System To A Strongly Consistent System
Watkins et al. Brados: Declarative, programmable object storage
Watkins Programmable storage
JP2023539811A (en) How to load data into the target database system

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E701 Decision to grant or registration of patent right