Re: [packer] Is there anyone who know the way that make single master redis to master-slave ?

14 views
Skip to first unread message

Rickard von Essen

unread,
Dec 11, 2017, 12:41:00 PM12/11/17
to packe...@googlegroups.com
This is probably better directed to the terraform list instead of the packer user list. 

On Dec 11, 2017 16:32, "Hyeongseob Kim" <hike...@gmail.com> wrote:

Hi everyone!

I'm using terraform for my project.
and I met critical problem with terraform.


First, I created redis using following terraform modules few monthes ago.
- aws_elasticache_parameter_group
- aws_elasticache_cluster


the redis has only master node. ( 0 shard , 1 node, no replica, cluster mode not enabled )


last week, I decided to make the redis master-replica for safe.
There are a lot of data in the redis. so, I must change the structure without data lost.
I want to make the redis as following( 1 shard, 2 node, multi AZ automatic fail over, cluster mode not enabled)


On the AWS console, I'm able to change the redis through following process.
- add replica
- add node ( different AZ with Master node )
- enable Muti AZ

Next, I tried to do same job using terraform but I met problems so, couldn't
following are the ways that I tried


1st. way

As I found, following modules are used for master-replica redis.
- aws_elasticache_parameter_group
- aws_elasticache_replication_group


I used same aws_elasticache_parameter_group.
And use aws_elasticache_replication_group instead of aws_elasticache_cluster.
then 'Terraform plan' says, existed redis will be deleted and new redis will be created.
I think terraform recreate redis because existing redis and new redis structure use different terraform moules.
I can't use this.


2nd. way
Next, I decided to change the redis on aws and modify terraform.tfstate manually.
I created a redis ( 0 shard , 1 node, no replica, cluster mode not enabled ) for test.
and changed the redis structure to ( 1 shard, 2 node, multi AZ automatic fail over, cluster mode not enabled) on the aws console
then 'terraform plan' 
but it says nothing changed.
there are different points between terraform.tfstate and real aws component because I changed it.
but Terraform cant' recongnized it.

There are one more problem. 
in spite of ablove problem, I tried to proceed this way.
and I found 'terraform import' doesn't support 'aws_elasticache_replication_group'
so, I can't import the modified redis.
I gave up this way.


3nd way

In terraform document, I found that there is 'replication_group_id' in aws_elasticache_cluster module
so, I tried to use all of 3 modules below

- aws_elasticache_parameter_group
- aws_elasticache_cluster
- aws_elasticache_replication_group

add replication_group_id in the aws_elasticache_cluster module and give "aws_elasticache_replication_group.EXAMPLE.replication_group_id" as the value
then 'terraform plan'
it says "Error: aws_elasticache_cluster.redis_petertest: "replication_group_id": this field cannot be set"
also fail. 
The parameter isn't able to use. I couldn't find the reason.


My questions are...

1. Is there any way to make existing redis ( 0 shard , 1 node, no replica, cluster mode not enabled ) 
to ( 1 shard, 2 node, multi AZ automatic fail over, cluster mode not enabled) without data lost using terraform?
2. Is 'replication_group_id' in 'aws_elasticache_cluster' module available? I can't find the way.
3. If there is a way for 2nd question, Could you give me the example script to created redis using all of three modules below?
aws_elasticache_parameter_group, aws_elasticache_cluster and aws_elasticache_replication_group.


If there is anyway to make redis master slave stucture without data lost, please help me.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/2f2170fe-0897-4b45-8410-610e18b75c63%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Alvaro Miranda Aguilera

unread,
Dec 11, 2017, 12:42:24 PM12/11/17
to packe...@googlegroups.com
he did sent to both, so I think this was just incorrect.

Alvaro.


For more options, visit https://groups.google.com/d/optout.



--
Alvaro

Reply all
Reply to author
Forward
0 new messages