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

28. [활용] Create Memcached cluster

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

 

 

 

 

 

 

## Memcached 생성 

 

 

 

## 서브넷 그룹 생성과 보안그룹 설정

 

 

 

 

## Memcached 엔드포인트 생성

 

 

## EC2 에서 텔넷 접속테스트 성공

 

- set / get 명령어 테스트

 

 

 

 

 

All right so in this video let's see how to set up a memcached cluster.

This is of course in the ElasitCache service right but ElastiCache has two options Redis and Memcached

and.

And we'll be setting up the memcached cluster and then using this throughout the course right.

So what we need to do is create this Memcached cluster but this will have just one instance at the moment.

Right.

And once we create this we will test the connectivity to it from our EC2 instance

right using Telnet.

Using telnet.

This is just a tool to test our connectivity.

Right.

And once we do that we can then set up the memcached cluster in our PHP application and verify the

application as well.

in a later step in this module.

So this is what we want to do.

Let's go to the management console and let's find ElastiCache under the database

category and from here let's go right ahead and launch our first cache cluster.

So we use memcached right.

We use memcached.

So let's make that selection and let's give this a name something like this.

Right.

And this is important.

The default node type is large.

Right so that's not free tier eligible.

So for our purposes micro is fine.

So let's change that.

Don't forget to do this otherwise you'll have some cost.

So micro is the selection right.

And right now we just need one node although you can have many more.

You can have up to 20 nodes as well.

right now one node is fine.

Now in the advanced memcached settings we need to create what is called a subnet group of

let us give this a name Let's call this it PHP app Memcached group something.

Right.

And here we are using the default VPC once again we will be using the default VPC because there's

no other VPC at the moment.

And this is fine by is fine.

And you can select one or more subnets or you can select one or more subnets.

Even though we are creating one node you can select multiple subnets as well.

So let's let's just use one B and one A two subnets in our subnet group.

Okay.

And then this is the security group we use the default security group for now.

Right.

And and this way we'll be able to connect easily from the EC2 instance to this memcached cluster.

All right.

That's it.

And then you can click on Create and the memcached cluster will be created in short order.

This might take a couple of minutes.

And once this comes up we will have an endpoint.

Right.

We will have an endpoint.

we will have an endpoint over here and we will use that to test the connectivity from the EC2 instance

using telnet so let me stop the video we will come back and test out the connectivity.

OK so now you can see the memcached cluster has come up.

Right.

It's in the available state and it has a configuration endpoint right this one here.

So let's copy this and then try and test the connection the connectivity from the EC2 instance into

this cache cluster.

Right.

So what you need to do is copy the whole thing including the port right.

Including the port and let's now do an SSH into our EC2 instance and from here let's use telnet all

right and paste the endpoint.

But make sure that you remove the colon and replace it with the space.

OK.

This way you can telnet into the memcached cluster.

Right.

And this is fine what you see here.

It's fine.

It looks like it is hanging but this is how it works.

Right.

And we can try some memcached commands here.

So let's say get a get a would mean that you're trying to get the value for a key a.

Right.

But obviously there's no there's nothing saved in the cache cluster yet.

So that's why we don't get anything.

So let me set a first right in the way you can try this is you can set up a value of length five.

That's why you see the five there and let's say the value is hello right now that key value pair gets stored

in the cache.

Right.

And next thing you want to retrieve this information from the cache you can say get a and you can

see the value hello is returned right this way.

This is much faster because you're retrieving the data from memory from the RAM not the disk way and

this can help us scale our database.

Tier.

OK.

So so then you can say quit this will end our telnet session.

We'll be back to the instance and from here you can exit right you can exit.

 

 

 

반응형

댓글