Ruby-on-rails Heroku:不能运行超过 1 个自由大小的 dynos

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34727605/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-03 00:21:00  来源:igfitidea点击:

Heroku: Cannot run more than 1 Free size dynos

ruby-on-railsherokuheroku-toolbelt

提问by Andrew

I was trying to run

我试着跑

heroku run rake db:migrate

And was getting the error

并收到错误

Cannot run more than 1 Free size dynos.

不能运行超过 1 个 Free size dynos。

See below for how to fix...

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

回答by Andrew

The answer is to look for any open heroku sessions (you can use 'heroku ps' as john points out below), in my case I already had a started a heroku console session 30mins earlier and just forgot about it. So if you see the "Cannot run more than 1 Free size dynos" error just close any existing console or other heroku sessions you have open.

答案是寻找任何打开的 heroku 会话(您可以使用 'heroku ps',正如 john 在下面指出的那样),在我的情况下,我已经在 30 分钟前启动了一个 heroku 控制台会话,只是忘记了它。因此,如果您看到“无法运行超过 1 个自由大小的 dynos”错误,请关闭您打开的任何现有控制台或其他 heroku 会话。

Hopefully this saves someone the ten minutes it took me to come to my senses.

希望这可以节省我花了十分钟才清醒过来的人。

回答by uomo_perfetto

Most Efective

最有效

in console run:

在控制台运行:

heroku ps

the result is some like this:

结果是这样的:

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

So the numbers 4859 represent the session that is open and needs to be closed. To fix the error you need to run(Obviusly, replace the number 4859 by the number obtained):

所以数字 4859 代表打开和需要关闭的会话。要修复您需要运行的错误(显然,将数字 4859 替换为获得的数字):

heroku ps:stop run.4859

It is a very simple solution.

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

回答by Manas

Had the exact same issue and came to this page. After reading realized what was going on but want to add following.

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

just run

赶紧跑

heroku kill DYNO --app your_app_name

After this close all open consoles.

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

Then run db migrate command, it will work.

然后运行 ​​db migrate 命令,它会工作。

回答by Zulhilmi Zainudin

In my case, I ran heroku ps:restartto restart alldynos and the heroku run *command worked again.

就我而言,我跑去heroku ps:restart重新启动所有dynos,heroku run *命令再次运行。

Examples

例子

If you just have one Git remotefor Heroku, use this:

如果您只有一个用于 Heroku 的Git 遥控器,请使用以下命令:

heroku ps:restart && heroku run *

heroku ps:restart && heroku run *

If you have multiple Git remotesfor Heroku, use this:

如果您有多个用于 Heroku 的Git 遥控器,请使用以下命令:

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

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

OR

或者

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

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

Replace *with your command e.g. consolefor Rails console.

替换*为您的命令,例如consoleRails 控制台。



What I meant by your-heroku-app-namehere is the sub-domain for your Heroku app. For example, if your app URL is https://cute-cat.herokuapp.com, that means your-heroku-app-nameis cute-cat.

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

If you are not sure/forgot what's your Git remote name for Heroku, git remote -vcan help you with that.

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

Example:

例子:

$ 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)