Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How create a Redis ElastiCache cluster using AWS-CLI from snapshots in S3?

What I'm trying to do is to use aws-cli to create an ElastiCache cluster based on my ElastiCache snapshots in S3, and my ElastiCache is cluster-enabled mode.

I followed this tutorial to create a cluster-enabled Redis cache and here's my command: aws elasticache create-cache-cluster --cache-cluster-id stevescachecluster1 --cache-node-type cache.m4.large --engine redis --engine-version 3.2.4 --cache-parameter-group default.redis3.2.cluster.on --num-cache-nodes 1 --snapshot-arns arn:aws:s3:::MY_S3_BUCKET-elasticache/stevesun-elasticache-0002.rdb --cache-subnet-group-name my-cache-dev

The above command fails due to An error occurred (InvalidParameterCombination) when calling the CreateCacheCluster operation: Cluster mode should be disabled in parameter group, but found it is enabled.

This is what confuses me, the above linked tutorial explicitly said that if yo want a cluster-mode enabled cache, please use .cluster.on option in your arguments.

Then I looked more into this aws-cli command reference: for this parameter: --cache-parameter-group-name, its documentation says: You cannot use any parameter group which has cluster-enabled='yes' when creating a cluster.

Isn't this contradictionary from this cli reference documentation to that cli tutorial?

Please correct me where I understand it wrong. And also, how can I create a cluster-mode enabled cache from S3 snapshots?

Thanks.

I checked and found that 3.2.4 is the latest version that AWS ElatiCache has right now.

Edit 1:

Then I just created a single-node cache using this command: aws elasticache create-cache-cluster --cache-cluster-id stevescachecluster1 --cache-node-type cache.m4.large --engine redis --engine-version 3.2.4 --cache-parameter-group default.redis3.2 --num-cache-nodes 1 --snapshot-arns arn:aws:s3:::MY_S3_BUCKET-elasticache/stevesun-elasticache-0002.rdb --cache-subnet-group-name my-cache-dev.

Then I went to the console and selected my newly launched single-node cache and clicked Modify, I tried to change it to cluster.on, but got this exception: The parameter cluster-enabled has a different value in the requested parameter group than the current parameter group. This parameter value cannot be changed for a cache cluster.

So, my attempt to launch a single-node cache first and then change it to be a cluster mode also failed.

Edit 2:

Then I thought it's that I needed to allocate more than 1 node for a cluster-enabled mode, so I changed this parameter --num-cache-nodes to 2, but I got this exception: An error occurred (InvalidParameterValue) when calling the CreateCacheCluster operation: Cannot create a Redis cluster with a NumCacheNodes parameter greater than 1. This is even more confusing to me, a cluster definitely needs more than 1 node, then why does it not allow greater than 1??

Although its documentation says For clusters running Redis, this value must be 1.. Why is this requirement? Then how can we create a new redis cluster from snapshots? Help please.

Thanks.

like image 500
Fisher Coder Avatar asked Feb 20 '17 18:02

Fisher Coder


People also ask

How do I create a cluster in ElastiCache?

On the ElastiCache dashboard page, choose Create cluster and then choose Create Redis cluster. Under Cluster settings, do the following: Choose Configure and create a new cluster. For Cluster mode, choose Enabled.

Can we use ElastiCache with S3?

As of publication time, you can store up to 80+ TBs with ElastiCache for Redis, using 125 shards and one replica. You can also take snapshots of your Redis cluster and store them in S3. For more information, see Best Practices: Online Cluster Resizing and ElastiCache 250 node per cluster support.

Which of the following can an AWS customer use to launch a new ElastiCache cluster select two?

Once you have familiarized yourself with Amazon ElastiCache, you can launch a cluster within minutes by using the AWS Management Console or Amazon ElastiCache APIs.


1 Answers

Creating a Redis (cluster mode enabled) Cluster (AWS CLI)

Redis (cluster mode enabled) clusters (API/CLI: replication groups) cannot be created using the create-cache-cluster operation. To create a Redis (cluster mode enabled) cluster (API/CLI: replication group), see Creating a Redis (cluster mode enabled) Replication Group from Scratch (AWS CLI).

Per AWS Doc.

Looks like Replication Group from Scratch is the way to go. I'll try it now.

like image 57
Fisher Coder Avatar answered Oct 22 '22 08:10

Fisher Coder