Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

ruby on rails - How to restore database in Elastic Beanstalk?

I am running Ruby 1.9.3 and Rails 3.2.8 on Amazon Elastic Beanstalk. After several issues with my side of the data, I did a rake db:reload

Now I am trying to grab the data that I had already created in the database pre-reload. I have followed the instructions in the Amazon documentation .

However, on step 6: Type the name of the restored DB instance in the DB Instance Identifier text box. - The prompt forces to give a new name to the Instance - thus creating a new instance.

That is all good, except I cannot change the db instance I am using with Elastic Beanstalk, so it seams useless to me. Unless I am missing something.

Help, please!!!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

After pouring over the interwebs for several days - I tried something that works!

Let's say the corrupted instance is called "badinstance". It has an endpoint called: badinstance.c5taqjjaja1d.us-west-2.rds.amazonaws.com:3306

Once you have restored the database to point in time, RDS will create a new instance, let's say you called it "newinstance".

Your Elastic Beanstalk will still be pointing to badinstance.c5taqjjaja1d.us-west-2.rds.amazonaws.com:3306 First delete "badinstance" - scary I know - I did multiple backups before I actually hit "delete. Then click on "newinstance" and select modify. You will be able to change the instance identifier to "badinstance". Make sure at this point that the security groups on the db instance match the group you have to Elastic Beanstalk.

The name changing took a long time to take place (I made the request around 3 pm or so and saw that it went through at around 3:50 am the next morning).

I restarted the Elastic Beanstalk app-server and voila: the data had been restored.

Hopefully this will be helpful to someone down the road.

Sam


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...