gpt4 book ai didi

java - 如何启动 Play 应用程序的两个实例?

转载 作者:搜寻专家 更新时间:2023-11-01 02:09:04 25 4
gpt4 key购买 nike

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

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

$ 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 实例如何启动多个实例呢?

最佳答案

$ start -Dhttp.port=9998 -Dpidfile.path=/path/to/app1/pidfile
$ start -Dhttp.port=9999 -Dpidfile.path=/path/to/app2/pidfile

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

这在此处记录:

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

关于java - 如何启动 Play 应用程序的两个实例?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22445710/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com