brunch

You can make anything
by writing

C.S.Lewis

by Master Seo Apr 27. 2022

185.  Mysql VM을 GCP로 이전(3/3)


Mysql vm을 GCP로 이전하는 절차를 알아보자~~



<1>  Cloudshell 환경 설정하기와 서비스 활성화 하기

<2> 소스 Mysql용 Database Migration >  Connection profiles 만들기

<3> Database Migration    > Migration  jobs > Migration  jobs 생성하기

<4>  소스 인스턴스 정의

<5> 목적지 정의

<6> 연결 방법

<7> 작업 정의 확인

<8> 테이터 확인

<9> 소스에서 지속적인 마이그레이션 테스트

<10> Cloud SQL for MySQL  연결해 데이터 확인

<11>실습 5탄





<1>  Cloudshell 환경 설정하기와 서비스 활성화 하기


1

CloudShell 에서 ?

gcloud auth list

gcloud config list project


2

콘솔에서 ?

Database Migration  API  활성화하기


3

검색창에서 

Service Networking API 활성화 하기


4

VM 하나 만들기

dms-test1




<2> 소스 Mysql용 Database Migration >  Connection profiles 만들기


1

 Database Migration  > Connection profiles > Create Porfile

Source : Mysql

mysql-vm

10.128.0.2

admin

g1!

생성하기



<3> Migration  jobs 생성하기


Database Migration    > Migration  jobs > Migration  jobs 생성하기


Migration  jobs 생성하기 전체 순서

시작!


1

vm-to-cloudsql


2

Source database engine

MySql


3

job type ?

Continuous


4

저장



<4>  소스 인스턴스 정의


클라우드에  VM으로 있는 mysql을 소스로 한다.

mysql-vm




<5> 목적지 정의


1

vm-to-cloudsql

암호 입력

Cloud SQL for MySQL 5.7

Connections, select Private IP and Public IP.


2

ALLOCATE & CONNECT


3

머신

Standard

SSD

10


4

Create  & Continue.


5




<6> 연결 방법 w


1

VPC peering.

계속


2

테스트 Job 

Create & Start Job





<7> continuous migration job  확인


1

Database Migration > Migration jobs

vm-to-cloudsql 클릭


2

시작



<8> 테이터 확인


1

Databases > SQL.Databases > SQL.


2

mysql 연결 확인

gcloud sql connect mysql-cloudsql --user=root --quiet


use customers_data;


select count(*) from customers;


select * from customers

order by lastName

limit 10;




<9> 소스에서 지속적인 마이그레이션 테스트


1

mysql -vm 에서


2

ssh 연결


3

mysql -u admin -p


use customers_data;


INSERT INTO customers (customerKey, addressKey, title, firstName, lastName, birthdate, gender, maritalStatus, email, creationDate)

VALUES ('9365552000000-999', '9999999', 'Ms', 'Magna', 'Ablorem', '1953-07-28 00:00:00', 'FEMALE', 'MARRIED', 'magna.lorem@gmail.com', CURRENT_TIMESTAMP),

('9965552000000-9999', '99999999', 'Mr', 'Arcu', 'Abrisus', '1959-07-28 00:00:00', 'MALE', 'MARRIED', 'arcu.risus@gmail.com', CURRENT_TIMESTAMP);



select count(*) from customers;


select * from customers

order by lastName

limit 10;



exit

exit




<10> Cloud SQL for MySQL  연결해 데이터 확인


1

cloud shell 사용


2

목적지 연결

gcloud sql connect mysql-cloudsql --user=root --quiet


3

확인


use customers_data;


select count(*) from customers;


select * from customers

order by lastName

limit 10;


exit




<11>실습 5탄


다음 자료


https://brunch.co.kr/@topasvga/2402




감사합니다.







매거진의 이전글 184. 아마존 RDS를 GCP로 마이그래이션(2/3)

작품 선택

키워드 선택 0 / 3 0

댓글여부

afliean
브런치는 최신 브라우저에 최적화 되어있습니다. IE chrome safari