【问题标题】:How to start two instances of play application?如何启动两个播放应用程序实例?
【发布时间】:2014-03-17 01:57:49
【问题描述】:

我正在尝试在不同的端口中部署相同播放应用程序的两个实例,然后通过前面的 nginx 进行负载平衡。

根据manual,要启动多个播放实例,这些是命令。

$ start -Dhttp.port=9998
$ start -Dhttp.port=9999

但是,如果我给出了这些,第一个命令会在端口 9998 中正确启动我的应用程序,但第二个命令无法通过给出以下消息来启动。

This application is already running (Or delete /play/app/folder/RUNNING_PID file)

我使用的是 Ubuntu 12.05。

那么,如何启动多个单人播放实例呢?

【问题讨论】:

  • 您的播放应用程序似乎通过在/play/app/folder/RUNNING_PID 上创建一个虚拟文件来检查其运行状态。您可能希望更改程序以不使用此文件检查其运行状态,以便可以运行多个进程。

标签: java web-applications playframework playframework-2.0


【解决方案1】:
$ start -Dhttp.port=9998 -Dpidfile.path=/path/to/app1/pidfile
$ start -Dhttp.port=9999 -Dpidfile.path=/path/to/app2/pidfile

只需确保您传递给每个应用的两个 pidfile 路径不同即可。

这在此处记录:

http://www.playframework.com/documentation/2.2.x/ProductionConfiguration

【讨论】:

  • 谢谢.. 会试试这个。
  • 什么时候需要更新文件夹的内容(svn update),做“干净”或其他一些东西?这两个实例都需要在此之前停止吗?我想在这种情况下最好有两个文件夹具有相同的播放应用程序并在两者中运行它?
猜你喜欢
  • 1970-01-01
  • 2010-09-19
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多