본문 바로가기
[AWS]/Highly Available, Scalable, AWS Stack

27. [활용] Create RDS read replica

by SAMSUNG CLOUD-OKY 2022. 1. 24.
반응형

 

## DB 인스턴스 식별자에 -rr 을 접미사에 추가할 것.

ex) phpapp-rds-rr   (RDS DNS 엔드포인트에 자동 포함됨)

 

 

 

OK in this video let's see how to set up the read replica.

 

This is the RDS read replica.

So this is let's say your primary RDS instance and what you can do is you can create a

read Replica something like this and there'll be replication.

We don't have to do anything once we create the replica the replication will be done automatically.

And this is asynchronous replication.

It is asynchronous the replication to the secondary server in the multi-AZ deployment is synchronous.

But this is asynchronous replication.

And the way to create the replica is pretty simple.

So you start with the RDS instance and then you can you can choose the region.

And this time in this course we just need to create this in the same region the region has to be the

same.

And you can also choose an AZ.

It doesn't really matter much.

At this stage at this stage doesn't matter what AZ you choose later.

If you're creating multiple replicas then you should make sure that they are in different AZs for

fault tolerance purposes.

Right.

But it can be in any AZ at the moment.

And and also you'll have to you'll have to give this an identifier a name right.

An RDS instance identifier.

So that can be something similar to what you had done with the RDS instance the primary RDS instance

may be with a suffix of slash R R or something like that for the for the Replica so that you

know that this is the replica and and the other one is the primary instace.

OK so these are some things that we have to do.

We also have to choose the size.

So as always we choose t2 micro right and then we can launch the replica.

OK.

Once replica has been created you can test the connectivity from the EC2 instance right in

connecting to the read replica.

I'll not show this to you but you can do it easily because it's the same process that we used to test the connectivity

from EC2 into the primary RDS.

Instance right.

So basically you will use my sql client right with the minus H option and here you'll have the replica

replicas end point its DNS endpoint.

Right so.

So that's it.

Otherwise it should be the same same process.

OK.

And remember the End Point is different for the read replica from the primary database but the username

and password will be the same because it's a replica.

It's a replica.

So everything all the data including the database usernames and passwords are replicated into the read

replica.

So the username here that you use would be the same right will be the same that you've used earlier.

Right.

The password as well will be the same that you've used earlier.

So I leave it to you to test this out.

But the process is the same just the end point.

The replicas end point will be different.

OK.

All right so let's see how to how to do this.

And let me switch to the management console.

Here and let's go to our RDS.

Instance right this instance is available and let's select this instance.

And for instance actions let's say create a read replica OK.

And we created this in the same region although we do have an option of changing the region like this

can be used for say disaster recovery and that sort of thing.

We can choose any zone right we can choose.

Any zone.

Doesn't matter much later.

It may matter.

we want to create multiple replicas.

So.

So it matters because we need to make sure that replicas come up in multiple zones this way we get

more fault tolerance.

But at the moment it doesn't really matter.

Ok but also make sure that the appropriate size is selected.

If it's not t2 micro make sure that you change that and make it micro right.

And and also give this give this a identifier so that you know which one is the primary and which one

is the read replica in your application you have to configure this identifier right.

Because the endpoint includes this instance identifier.

So I've just added a suffix of -rr.

That should be fine.

OK.

All right.

Otherwise everything is the same right.

Everything else is the same.

Note that you're not really creating a username and password for the replica because those will remain

the same the same.

The primary RDS instances username and password can be used to connect to the replica as well.

So let's create the replica.

Right.

And what you need to do is once this comes up once the replica is ready it'll have an endpoint right.

It'll have a different end point and use that endpoint and test the connectivity from the EC2 instance

be in the same way in the same way as you've done with the primary RDS instance.

 

 

 

 

반응형

댓글