Database administration

Current production database on Heroku

The credentials are
Host: ec2-52-87-121-192.compute-1.amazonaws.com
Database: d1hlu2cr9ta2p3
User: ud6dfgef6bi48k
Password can be found on the database credentials page on Heroku

New production database on AWS

The credentials are
Host: cobudget-prod.cird90svlmvv.us-west-2.rds.amazonaws.com
Database: cobudget_prod
User: cobudget
Password is currently only known by Michael and Juliana

Moving a database to a new database instance

  • Use pg_dump to dump the exsting database into a file
  • Edit the user name to fit the new database to be used
  • use psql to load the data into the new database

Example: Dumping the heroku database and loading it on AWS

First dump the Heroku database
1
pg_dump -h ec2-52-87-121-192.compute-1.amazonaws.com -U ud6dfgef6bi48k -d d1hlu2cr9ta2p3 >db_dump
Copied!
Edit the user name from "ud6dfgef6bi48k" to "cobudget"
1
sed -e 's/Owner: ud6dfgef6bi48k/Owner: cobudget/' -e 's/OWNER TO ud6dfgef6bi48k/OWNER TO cobudget/' db_dump >db_loadable
Copied!
Create the new database
1
createdb -h cobudget-prod.cird90svlmvv.us-west-2.rds.amazonaws.com -U cobudget cobudget_prod
Copied!
Load the new database with the previously dumped data
1
psql -h cobudget-prod.cird90svlmvv.us-west-2.rds.amazonaws.com -U cobudget -d cobudget_prod <db_loadable
Copied!
The load should be executed with no errors.
To look around in the database, use psql
1
psql -h cobudget-prod.cird90svlmvv.us-west-2.rds.amazonaws.com -U cobudget -d cobudget_prod
Copied!
In case something goes wrong, you can always delete the database
1
dropdb -h cobudget-prod.cird90svlmvv.us-west-2.rds.amazonaws.com -U cobudget cobudget_prod
Copied!
and restart with creating the new database.
Last modified 3yr ago