How to dump the data base from my server into engineyard - ruby-on-rails

I have my own mysql data base and have some data in it.. Now I would like to dump my database into the engineyard cloud.
I have cloud account and diployed the complete file init.. Now we need the data to run my project..
so could you please explain how to dump the db into engineyard cloud...
Ramesh

I am not sure about EngineYard , But on Heroku you can issue heroku db:push command , which Pushes your local DB into the Cloud . I guess for EngineYard , a similar command should work .
http://blog.heroku.com/archives/2009/3/18/push_and_pull_databases_to_and_from_heroku/

Related

Unable to upgrade heroku database

I've just upgraded my heroku database. I'm now trying to copy the data from my old database to my new database, however I keep getting this error. Could it be that I'm unable to copy it because write access is revoked?
Why not just import and export a backup using PG Backups, your issue here is that your databases are in different apps(environments), so from the console using --app earthedhub will just let you use the DATABASE_URL.
use a PG Backups take a look to this post

synching two databases in heroku rails app

I have crm rails application deployed in heroku so my database is postgresql. I have an iphone app which is using mysql database. Now what i need to do is to synch my iphone database with my heroku database.
Can anyone please help me on this is it possible to sync two different databases in heroku
Thanks in Advance
The way we did this was to do it manually
Yep, it's a real pain, but at least you know it's done correctly
--
Process
For migrating from Postgres to MYSQL is as follows:
"Backup" the database using pg_backups
Download the backup locally
In MYSQL (we used PHPMyAdmin), create a series of SQL calls to insert the respective data into the correct tables
Migrating from MYSQL to Postgres is, as much as I can determine, a similar process:
Download the SQL dumps of your MYSQL DB (I only know how to do this in PHPMyAdmin)
Configure those files to be "PG" ready
Send the SQL to your Heroku postgres db's
--
Notes
For specifics, I only have the following:
If you dump from Heroku, you'll not get a traditional SQL file; you'll receive a .dump file. To change this, you'll need to use pg_restore in the following way:
$ cd c:/your/postgres/install/pg_restore/location
$ pg_restore path_to_your_dump.dump > path_to_your_sql.sql
This will give you the ability to "read" the file, uploading to your db & importing as you wish. That's when the fun begins :)
Importing MYSQL
The way to import MYSQL into a PG db will have to be done manually
Although we've never done this directly (we only migrated from PG), there are several things you can do. Firstly, you can use the PG2MYSQL converter to give you an idea as to the syntax differences between MYSQL & PG
Then I would perform a "dump" from MYSQL in SQL format. This will give me the data required for PG. This will allow me to insert into my PG database (you might have to do this locally to give you the ability to determine the syntax), from which you can then patch in the MYSQL data
I understand it's not the most elaborate explanation - I hope it gives you some ideas

RoR: Beginner and Heroku

I've been trying to setup my first rails app--I'm okay at stumbling around on my local machine (OSX) and finding out how to do stuff...
I want to setup my local machine to deploy on Heroku.
I have a heroku account, and rails running on my mac...how do I get the database setup for both my local config and heroku? I have MySql locally, but it looks like heroku uses Postgre...
Can you give me a step-by-step process so that I can get to making my app and forget about server config?! :)
You should be ok if you havent written any mysql specific code. Rails handles converting the rails model/controller code to whatever database you are using. As it says here, you are probably going to want to type:
heroku db:push
to set up your database using the schema and import the data from your local database.
If you're not already using it, check out Michael Hartl's Ruby on Rails Tutorial.
Germane to your question: http://ruby.railstutorial.org/ruby-on-rails-tutorial-book#sec:deploying
Edited because I apparently forgot how to spell germane...
First, you would setup your database.yml file to use your MySQL on your local machine for development. Set this up however you like, a good example is http://wiki.rubyonrails.org/database-support/mysql#databaseyml_example
And than when you are ready to migrate your development database from your local machine, you would run:
heroku db:push
This will export your MySQL, SQLite or Postgres DB on your development machine and import it into your heroku instance. Your heroku instance will overwrite your database.yml file with the correct Postgres info and your application will have your development schema in the heroku Postgres DB.

How do I check the records of my heroku database?

I've just deployed my application to heroku and pointed my custom domain to the heroku servers. How can I check the records in my heroku database?
You can use heroku run rails console and look at your records with Model.all or any other method.
If you want to backup the database look at heroku PG backups, you then can import your database on your local machine and look at it there. Depending on your db adapter you could use sqlite browser for sqlite3 or phpmyadmin for MySQL.
I found a similar question like this and here is what #Chowlett says:
"You could run heroku pg:psql to fire up a Postgres console, then issue \d to see all tables, and \d tablename to see details for a particular table."
You can also type select * from tablename; to view the table contents.
How to view current database schema for Heroku app in Terminal?
heroku db:pull to pull your production DB locally to take a peek in it.
I'll give the method for connecting via a GUI tool
Run the following command to get the database credentials from Heroku:
heroku pg:credentials DATABASE_URL
Then you can use a GUI tool like PG Commander or PGAdmin to connect to the db
Heroku now has an add-on named PostgreSQL Studio (currently free & in beta) that would let you access your database from within the browser, without having to use CLI, much like PHP MyAdmin.
To attach this add-on to your application,
heroku addons:create pgstudio
Then go to the list of add-ons on Heroku, select PostgreSQL Studio, authorize it, select the database to connect with from the dropdown list of all databases and it will take you to the web-based interface to handle your selected database.
You may refer to this official article on Heroku:
https://devcenter.heroku.com/articles/pgstudio
The easy answer is:
heroku pg:info
You can also download a client side Postgres, like Postico, and using the information provided in that URL to enter password and database name etc, then you can create locally, just like phpMyAdmin.
I use the admin_data gem, works well in Heroku.
You can use heroku dataclips that allows to run queries online. Here you can find documentation https://devcenter.heroku.com/articles/dataclips.
Connect to the database using Sequel Pro. You can find your ClearDB url using heroku config command. The structure for connecting is as follows:
CLEARDB_DATABASE_URL => mysql://[username]:[password]#[host]/[database name]?reconnect=true

Using Heroku to db:pull a new database

I am trying to learn how to push and pull databases using Heroku's system, I just have a clarifying question.
My existing development database is called project_dev but I want to create a new database. I entered in the following command:
heroku db:pull mysql://root:mydbpassword#localhost/20110302heroku
I have a database.yml file that includes my development, test, and production dbs, and I got this response from Heroku:
Auto-detected local database: mysql://root:mydbpassword#localhost/project_dev?encoding=utf8
Does this mean I have to manually create a new database first if I want to pull from Heroku? Does it mean that I cannot pull at all unless the db is explicitly defined in my database.yml file?
Any pointers would be really helpful. I had a look around on Google, Heroku and SO, but I didn't find the answers I was looking for. Thank you!
Yes, you'll have to first create the new local database but you don't have to declare it in your database.yml file.
When I run heroku db:pull mysql://root:mydbpassword#localhost/newdb it correctly imports into the newdb database. I'm not sure why it auto-detects your local dev database. Do you use the latest heroku and taps gems?

Resources