小编典典

在Ubuntu上重新生成Tomcat的Upstart脚本

tomcat

foreman export upstart /etc/init用来设置tomcat应用服务器,以便可以在Ubuntu中监视和维护可用性。

但是,我需要一些建议,以解决一些挑战:

1)用sudo service tomcat start… 启动实例后,如果我尝试使用kill <pid>…终止进程,则可以看到它被Upstart实用程序立即重新生成…但是速度太快了!所需的端口尚未释放。有什么解决方法可以克服这个问题?

SEVERE: Failed to initialize end point associated with ProtocolHandler ["http-nio-8443"]
8 java.net.BindException: Address already in use
9       at sun.nio.ch.Net.bind0(Native Method)
43 Caused by: java.net.BindException: Address already in use
44      at sun.nio.ch.Net.bind0(Native Method)

2)我通常initctl list | grep tomcat会找出pid(在这种情况下为3518)并终止进程:

$ initctl list | grep tomcat
  tomcat start/running
  tomcat-web-1 start/running, process 3518
  tomcat-web start/running

杀死tomcat-web-1是否实际上是测试Upstart重生功能的错误方法?

3)另一个挑战是,如果仅执行一次或两次,就会很快遇到内存问题:

376 Error occurred during initialization of VM
377 Could not reserve enough space for object heap

4)最后,默认脚本似乎仅对错误的退出条件处理重生。但是,重新启动计算机不算是其中一种,因此如何foreman export upstart /etc/init增强导出功能以解决这种情况?

我想知道是否还有其他人之前遇到过类似的挑战和/或有解决方法?


更新1(2013年3月4日):

要完成(4),我只需要编辑appname.conf文件的start on语句以包含start on (... OR runlevel [2345])


阅读 322

收藏
2020-06-16

共1个答案

小编典典

在步骤2中,列出的所有三个结果实际上都是unix进程。它们都不是tomcat
Java网络服务器。因此,您正在杀死其中一个进程,这可帮助您管理实际的tomcat /
java进程,当它重新启动时..它将尝试再次启动tomcat。从未释放过运行Tomcat的端口,并且该内存仍在使用中,因为您从未关闭过原始的Tomcat!因此,您会遇到(1)和(3)。

识别Java进程的更好/更简便的方法是查看它的实用程序,例如System Monitor。您会看到一个名为“
java”的进程,并且该进程的ID将在此处列出。现在为该PID发出一个kill,它将向您演示工头+新手重生的效果很好。

2020-06-16