Heroku:不能 运行 多于 1 个 Free size dynos

Heroku: Cannot run more than 1 Free size dynos

我正在尝试 运行

heroku run rake db:migrate

并且收到错误

Cannot run more than 1 Free size dynos.

请参阅下文了解如何修复...

答案是寻找任何打开的 heroku 会话(你可以使用 'heroku ps' 正如约翰在上面指出的那样),在我的例子中,我已经在 30 分钟前开始了一个 heroku 控制台会话,只是忘记了它.因此,如果您看到“Cannot 运行 more than 1 Free size dynos”错误,只需关闭您打开的任何现有控制台或其他 heroku 会话。

希望这可以节省我花十分钟时间回神的时间。

遇到完全相同的问题并来到此页面。阅读后意识到发生了什么但想添加以下内容。

就运行

heroku kill DYNO --app your_app_name

在此之后关闭所有打开的控制台。

然后运行 db migrate 命令,它将起作用。

最有效

在控制台中 运行:

heroku ps

结果是这样的:

run.4859 (Free): up 2016/01/12 21:28:41 (~ 7m ago): rails c

因此数字 4859 表示打开但需要关闭的会话。要修复错误,您需要 运行(显然,用获得的数字替换数字 4859):

heroku ps:stop run.4859

这是一个非常简单的解决方案。

在我的例子中,我 运行 heroku ps:restart 重新启动 all dynos 并且 heroku run * 命令再次起作用。

例子

如果您只有 一个 Git 远程 用于 Heroku,请使用:

heroku ps:restart && heroku run *

如果您有 多个 Git 遥控器 用于 Heroku,请使用:

heroku ps:restart --remote your-remote-name && heroku run * --remote your-remote-name

heroku ps:restart --app your-heroku-app-name && heroku run * --app your-heroku-app-name

* 替换为您的命令,例如console 用于 Rails 控制台。


我这里的 your-heroku-app-name 是指您的 Heroku 应用程序的子域。例如,如果您的应用 URL 是 https://cute-cat.herokuapp.com,则意味着 your-heroku-app-namecute-cat

如果您不是 sure/forgot Heroku 的 Git 远程名称是什么,git remote -v 可以帮助您。

示例:

$ git remote -v
this-is-the-remote-name      https://git.heroku.com/xxx.git (fetch)
this-is-the-remote-name      https://git.heroku.com/xxx.git (push)
this-is-another-remote-name  https://git.heroku.com/yyy.git (fetch)
this-is-another-remote-name  https://git.heroku.com/yyy.git (push)

只需重新启动所有测功机。 heroku restart