I'm trying to reset my shared database on Heroku.
I've tried the following commands:
heroku pg:reset DATABASE
heroku pg:reset SHARED_DATABASE
heroku pg:reset SHARED_DATABASE_URL
heroku pg:reset DATABASE_URL
Every time I receive the error "Resource not found" despite these being in my environment vars (heroku config) and working with my application.
Anyone know what I could be doing wrong? Thanks!
I just got this feedback from Heroku support:
Hi, this is due to a bug in the heroku client. An updated release should be out later today >or monday.
You may want to instead take this opportunity to try out the new dev databases:
https://postgres.heroku.com/blog/past/2012/4/26/heroku_postgres_development_plan/
June 08, 2012 09:47
Looks like you have to wait around or use the dev databases.
Related
I have recently started working on an existing Heroku environment.
How can I tell if there are database backups scheduled?
Assuming you are using Heroku Postgres, you can view backup schedules with the following command:
heroku pg:backups:schedules
You might have to provide the --app argument so Heroku knows which app you're interested in.
I'm trying to push a local PostgreSQL database to one I've created on a Heroku app. To set up the Heroku database, I ran heroku addons:create heroku-postgresql:hobby-dev -a jasons-react-jobly-app, where jasons-react-jobly-app is the name of my Heroku app.
Then I ran heroku pg:push jobly DATABASE_URL -a jasons-react-jobly-app, where jobly is the name of my local database.
This throws the below error:
heroku-cli: Pushing jobly ---> postgresql-animate-30221
case
------------------------------------
0.9992547478473790.999254747847379
(1 row)
! Cannot read property 'includes' of undefined
The error looks like an error that JavaScript throws when it tries to read properties of an undefined object or something, but I'm not sure where that would be happening in this database push. The app runs completely fine on my local machine with no errors. There is no case column in any of my database tables, so I'm not sure where that number is coming from either.
Also, if I check my Heroku config variables with heroku config, I see:
DATABASE_URL: postgres://iqawqkjfiybndd:c3e921131c239ccd6c880ad4b601deeaa4558339a90ebedc562a5575c9099f42#ec2-54-156-85-145.compute-1.amazonaws.com:5432/dul2u6r13aq5i
So I know the database exists.
Any help with solving this error?
You need to fetch the name of the DB that you see attached to the heroku app on heroku dashboard.
At this url https://dashboard.heroku.com/apps/{put-your-app-name-here}/resources
To get all app names in heroku cli do heroku apps and you will know which app's DB name you want from its dashboard.
Once you have the name of the DB (it will look like this "postgresql-pointy-81624")
use that name in the command to push local db to that db on heroku .
Here are steps to make sure everything works correctly
1- Check the connectivity to the heroku db first by doing
heroku pg:psql postgresql-[somedb name as found above] --app {your-app-name}
2- If it says to reset the DB and you can afford to reset then reset it using
heroku pg:reset -a {your-app-name}
3- Lastly do the migration of DB using this command
heroku pg:push jobly postgresql-[db name found above] -a {your-app-name}
if everything works as expected you will see this message
heroku-cli: Pushing complete.
I have a django project that I was initially running on pythonanywhere using a postgres database. However, pythonanywhere doesn't support ASGI, so I am migrating the project over to heroku. Since heroku either much prefers or mandates use of its own postgres functionality, I need to migrate the data from elephantsql. However, I'm really coming up short on how... I tried running pg_dumpall but it didn't seem to want to work and/or the file disappeared into the ether. I'm at a loss for how to make this migration... If anyone could help, I'd appreciate it so much. T-T
After hours of searching and doing what I can to scour heroku's listed info, I found it by running heroku pg:push --help.
For a locally running server, run
heroku pg:push '<db_name>' <heroku_db_name> --app <app_name>
For a hosted one, run
heroku pg:push <postgres_link> <heroku_db_name> --app <app_name>
I have been using pgbackups to capture databases and load them locally but since yesterday, I am getting this message when provisioning the add on for new apps.
! Add-on plan not found.
Has pgbackups been disabled for new instances? It still works on apps it was previously integrated with. If it has been deprecated, what is the recommended replacement?
Heroku have recently made changes. "PG Backups as an add-on has been deprecated." For new commands, see here:
https://devcenter.heroku.com/articles/mapping-pgbackups-commands
Old command:
heroku pgbackups:capture --app sushi
New Command
heroku pg:backups capture --app sushi
So I missed this little disclaimer here: https://devcenter.heroku.com/articles/pgbackups
PG Backups as an add-on has been deprecated. The commands exist as part of the Heroku Postgres namespace in the CLI. The new functionality is live and available for use. We also have a mapping guide to show you how the old commands transfer to the new ones.
To add to response from jcuenod above the same would apply for heroku pg:backups:restore. The new command will be heroku pg:backups restore. Heroku documentation is inconsistent and should be updated.
This kind of arbitrary failure seems to be part of the Rails app learning curve, so I apologize for such a simpleminded question, but: 'heroku pgbackups:capture' is simply...failing. That is, I captured the URL for my Postgresql database on heroku, then pasted it into:
% heroku pgbackups:capture postgres://<secret rest of db URL>
...and get the following response:
Database on ec2-50-19-215-116.compute-1.amazonaws.com ----backup---> b003
Pending... \
! An error occurred and your backup did not finish.
Helpful, eh? Any clues how I can suss this out? Thanks for help with a naive question.
Steve Upstill
If it persists, contact support - there's not a huge amount you can do here.
In my case, the problem was that the connection count for my database was exhausted. I was on a hobby db that only has a max of 20 concurrent connections, and they were all in use. I was able to trigger a backup successfully after freeing up some connections (which you can do e.g. by tuning your connection pools or shutting down some nodes).
You can see the connection count of your db via the pg add-on UI:
Make sure that you are running the latest version of the Heroku command-line tool:
$ heroku update
then re-install the add-on:
$ heroku addons:add pgbackups
then capture a backup of your primary database ( without specifying the DB path, from ineer local branch on your local machine ):
$ heroku pgbackups:capture