how to export postgres database from aws rds - ruby-on-rails

I have a Rails 4 app deployed to Elastic Beanstalk using Postgresql. My question is: what is the best way (or a good way) to export the database?
I tried to use pg_dump from the ec2 instance which is part of the RDS security group but the ec2 instance has a different postgres version (9.2.9). I was also unable to make this happen using the AWS console.
Any general advice on how best to proceed would be much appreciated.

pg_dump is the way to go, but sounds like you'll just need to ensure that the host running pg_dump is running with the same version as the RDS server instance.

Related

Accessing the solr folder folder from multiple server instances

AWS has just announced general availability of its EFS (Elastic File System). It allows you to create a network drive that can be shared by multiple AWS instances.
I have a Rails application, using sunspot-solr gem. A solr folder is created to store the solr index file and other related data.
The MySQL data is on its own RDS instance. I want to deploy two servers, both running the same Rails application, but have them both point to the same solr folder on the shared EFS share.
Assuming that both servers running the Rails app, are using the same solr gem version, will my scenario work, or will each server need its own solr folder?
I'm pretty sure the version of Solr packed with the development version of Sunspot is a separate Solr server that Rails communicates with. So in production, you are responsible for providing a Solr server for these purposes, be it on one of your EC2 instances or on its own separate EC2 instance.
A little more info... Rails posts data for Solr to consume via Sunspot, but the Solr server handles those details, not your Ruby app. Therefore, sharing the Solr data files with Rails won't provide you with any advantage.
When I was getting started, I hooked my Heroku-hosted Rails app up to Websolr if you think that $20+ per month would be worth it. Otherwise, look up tips for installing Solr on EC2.

Two different databases

Is it possible to have two different databases for development or production? One for Heroku and one for local development?
Heroku uses PostgreSQL but I prefer SQLlite for local development.
yes, it's totally possible - you can then use heroku db:push to push your local SQLite database into postgres running on Heroku.
BUT
And this is from personal experience, I've run into situations where SQL I've written is different between sqlite/postgres/mysql AND also gems I've used which themselves used findbysql which weren't tested against postgres and has then caught my out when I've put it on Heroku.
For the few seconds it takes to install postgres locally I would STRONGLY recommend you use the DB platform you are ultimately going to deploy to.

Can a Heroku app interface with Amazon EC2 instances

I am toying around with building a rails app in the near future and using Heroku to host it, but the app will need to interact with EC2 instances through SSH (unless I can find a better way). I probably could build a pseudo API...but direct console access would be easier. I am going to need the following:
1) Run commands on the EC2 console
2) Read the results
3) dynamically start and stop ec2 instances (a little unrelated but I am curious if heroku can do this)
I know heroku hosts their infrastructure on EC2, so latency would be grean and it would probably be more straight forward to just host my own rails server on an EC2 instance, but I really like the automation and tools available within Heroku.
EC2 specific: http://rubygems.org/gems/amazon-ec2
Console Commands/Results: http://rubygems.org/gems/net-ssh
Both these Gems should address my issue. Thanks Zabba for the ec2 gem. I am a little new to rails, and should have started looking there. I love how easy it is to install new functionality into the language.

Amazon web service as Rails hosting, possible?

Is it possible to use Amazon web service to host a Rails application?
Thanks.
Yes, you should be able to set that up in several different ways on AWS.
Since you can configure an EC-2 instance much like a dedicated server, you can install any software you want and configure it to your needs.
There are some nice ruby tools here:
http://amazon-ec2.rubyforge.org/
Also 37 signals is on AWS - http://aws.amazon.com/solutions/case-studies/37signals/
I recommend a simple Amazon Linux AMI Micro instance EBS backed to get started on the free tier.
http://aws.amazon.com/free/
This more of an Updated Answer.
You can use Elastic BeanStalk for Ruby deployment using Passenger. Checkout the links AWS Elastic Beanstalk Runs Ruby and Integrates with Amazon VPC and AWS Elastic Beanstalk - Ruby Support and VPC Integration
As Tom mentioned, a simple EBS AMI should be enough to get started. At BitNami we have created Ruby on Rails AMIs and make them available for free We also offer a hosting service on top of Amazon that you can combine with the AWS free tier service to basically get free server for 1 year (618Mb RAM, 30gb) which is more than enough for development and light hosting.

Can I use cassandra with heroku?

Is it possible to use cassandra with heroku?
No and yes.
It depends on whether you mean use a Heroku-hosted Cassandra instance or not. If that's what you mean then the answer is no (for now at least). They support PostrgeSQL within their stack and MySQL through Amazon RDS. MongoDB support is in beta (partnering with MongoHQ) and CouchDB is roadmapped for later this year (in conjunction with Cloudant).
But of course there's no technical reason to stop you from deploying Cassandra elsewhere (say on EC2) to work with your Heroku app. So in this context the answer is yes.
UPDATE (2012/09):
Heroku has launched a new add-on for Cassandra hosted by Cassandra.io. Details available here.
UPDATE (2014/11):
The Heroku Cassandra beta addon is no longer available nor does cassandra.io seem to exist anymore. ATM no Cassandra addon is available so only rolling your own as detailed above is possible.
Yes take a look at http://cassandra.io for a hosted Cassandra solution and heroku addon.
We are in private beta as you can see here: https://addons.heroku.com/cassandraio
You can provision the addon using the following command:
heroku addons:add cassandraio
There is a Cassandra heroku add-on available for Instaclustr.
This is no longer the case. There is a company with a solution currently seeking testers:
http://permalink.gmane.org/gmane.comp.db.hector.user/4928

Resources