非程序员如何在关闭Heroku账户前下载全部数据、应用及数据库?
Hey there! No worries at all—you don’t need to be a programmer to grab all your data from Heroku before closing your account. Let’s walk through this step by step, nice and easy, for both your apps and databases.
Downloading Your Heroku App Code & Files
If you want to save the code and files tied to your apps, follow these simple steps:
- First, get the Heroku CLI (Command Line Interface) from Heroku’s official download page. Install it, then open your computer’s terminal (Mac/Linux) or Command Prompt/PowerShell (Windows). Type
heroku loginand follow the prompts to sign into your Heroku account. - Head to the Heroku web dashboard, go to the "Apps" tab, and jot down the name of the app you want to download.
- Back in the terminal, run
heroku git:clone -a your-app-name(replaceyour-app-namewith your actual app’s name). This will create a folder on your computer with all your app’s code and core files. - If your app has user-uploaded content (like images or documents) that isn’t stored in Git, you’ll need to grab those separately. Run
heroku run bash -a your-app-nameto access your app’s server. From there, you can use basic commands likecpto copy files to a downloadable location, or if that feels too technical, check the "Resources" tab of your app for any storage add-ons and use their built-in export tools.
Exporting Your Database Data
Most Heroku apps use Heroku Postgres, but the process works similarly for other databases too:
For Heroku Postgres:
- Option 1 (Using CLI):
- Run
heroku pg:backup:capture -a your-app-nameto create a full backup of your database. - Once the backup finishes, run
heroku pg:backup:download -a your-app-nameto save the.dumpbackup file to your computer. You can open this later with tools like PostgreSQL’spg_restoreif you need to access the data.
- Run
- Option 2 (Using Web Dashboard):
- Go to your app’s "Resources" tab in the Heroku dashboard, find the Heroku Postgres add-on, and click into it.
- Navigate to the "Backups" section, click "Create backup", and wait for it to complete.
- Once ready, click "Download" to save the backup file to your local machine.
For Other Databases (like MySQL/ClearDB):
- Find the corresponding add-on in your app’s "Resources" tab, click into its dashboard, and look for an "Export" or "Backup" option. For example, with ClearDB, you can export a SQL file directly from their web interface.
Double-Check You Have All Data
Before closing your account, take a quick minute to:
- Verify the app folder on your computer has all the files you need (code, config files, etc.).
- Make sure your database backup file is saved locally and you can confirm it has content (try opening a SQL backup in a text editor to spot table names or data snippets, for example).
- If you use any other add-ons (like email services or caching), log into their respective dashboards and export any important data (like email logs or user-specific records).
Quick Reminders Before Closing Your Account
- Don’t forget to delete or disable your apps first (go to your app’s "Settings" tab, scroll to the bottom, and click "Delete app" or "Disable Dynos" to stop them from running).
- If you need to keep billing records, go to your Heroku account settings, find the "Billing" section, and export your billing history.
内容的提问来源于stack exchange,提问作者Lisa Renander
相关产品推荐
相关产品推荐

