进程无限期地开始和停止
Process starts and stops indefinitely
我正在使用 Cloudify 2.7 和 OpenStack Icehouse。
我已经为 Glassfish 开发了一个服务配方,它将实例注册到 Apache 负载均衡器上。
启动事件执行一个 glassfish_start.groovy
文件,该文件运行以下命令:
su - glassfish -c "asadmin --passwordfile /home/glassfish/passwd.gf --user $userAdmin start-domain $domain"
su - glassfish -c "asadmin --passwordfile /home/glassfish/passwd.gf --user $userAdmin deploy --contextroot \"/\" $warName"
开始活动结束后,可以看到:
2015-07-14 09:59:15,678 glassfish.glassfish [1] INFO ....
[org.cloudifysource.dsl.internal.BaseDslScript] - glassfish-service.groovy (startDetection): arePortsFree http=8080
2015-07-14 09:59:15,680 glassfish.glassfish [1] INFO [org.cloudifysource.usm.UniversalServiceManagerBean] - Process liveness test passed
2015-07-14 09:59:15,680 glassfish.glassfish [1] INFO [org.cloudifysource.usm.UniversalServiceManagerBean] - Executing Process Locators!
2015-07-14 09:59:15,684 glassfish.glassfish [1] INFO [org.cloudifysource.usm.locator.DefaultProcessLocator] - Looking for actual process ID in process tree
2015-07-14 09:59:15,692 glassfish.glassfish [1] INFO [org.cloudifysource.usm.locator.DefaultProcessLocator] - Located process (6446): /usr/lib/jvm/java-8-oracle/jre/bin/java [java, -jar, /opt/glassfish4/bin/../glassfish/lib/client/appserver-cli.jar, --passwordfile, /home/glassfish/passwd.gf, --user, <user>, deploy, --contextroot, /, hello.war]
2015-07-14 09:59:15,693 glassfish.glassfish [1] INFO [org.cloudifysource.usm.UniversalServiceManagerBean] - Monitored processes: [6446]
2015-07-14 09:59:15,700 glassfish.glassfish [1] INFO [org.cloudifysource.usm.USMEventLogger.glassfish.glassfish] - glassfish.glassfish-1 POST_START invoked
2015-07-14 09:59:15,707 glassfish.glassfish [1] INFO [org.cloudifysource.dsl.internal.BaseDslScript] - glassfish-service.groovy: glassfish Post-start - useLoadBalancer = true - Adding Glassfish instance onto ApacheLB...
2015-07-14 09:59:15,721 glassfish.glassfish [1] WARNING [org.cloudifysource.utilitydomain.admin.TimedAdmin] - Admin object might expire prematurely! The specified timeout for waiting for PU was set to 180 SECONDS while the admin timeout is 120 seconds
2015-07-14 09:59:15,740 glassfish.glassfish [1] INFO [org.cloudifysource.dsl.internal.BaseDslScript] - glassfish-service.groovy: add-node onto ApacheLB ...
2015-07-14 09:59:15,742 glassfish.glassfish [1] INFO [org.cloudifysource.dsl.internal.BaseDslScript] - glassfish-service.groovy: ipAddress is <IP> ...
2015-07-14 09:59:15,745 glassfish.glassfish [1] INFO [org.cloudifysource.dsl.internal.BaseDslScript] - glassfish-service.groovy: Sto per aggiungere l'URL http://<IP>:8080 ad ApacheLB ...
2015-07-14 09:59:21,686 glassfish.glassfish [1] INFO [glassfish-stdout] - [exec] Application deployed with name hello.
2015-07-14 09:59:21,687 glassfish.glassfish [1] INFO [glassfish-stdout] - [exec] Command deploy executed successfully.
2015-07-14 09:59:21,687 glassfish.glassfish [1] INFO [glassfish-stdout] - [exec] startOnUbuntu.sh: End
2015-07-14 09:59:21,687 glassfish.glassfish [1] INFO [glassfish-stdout] - [exec] + echo 'startOnUbuntu.sh: End'
2015-07-14 09:59:23,007 glassfish.glassfish [1] INFO [org.cloudifysource.dsl.internal.BaseDslScript] - glassfish-service.groovy: glassfish Post-start ended
2015-07-14 09:59:23,008 glassfish.glassfish [1] INFO [org.cloudifysource.usm.USMEventLogger.glassfish.glassfish] - glassfish.glassfish-1 POST_START completed, duration: 7.3 seconds
2015-07-14 09:59:23,008 glassfish.glassfish [1] INFO [org.cloudifysource.usm.UniversalServiceManagerBean] - Starting async tasks
2015-07-14 09:59:25,011 glassfish.glassfish [1] INFO [org.cloudifysource.usm.USMLifecycleBean] - Stop detection - service has stopped!
2015-07-14 09:59:25,011 glassfish.glassfish [1] INFO [org.cloudifysource.usm.UniversalServiceManagerBean] - Detected death of underlying process
2015-07-14 09:59:25,011 glassfish.glassfish [1] INFO [org.cloudifysource.usm.USMEventLogger.glassfish.glassfish] - glassfish.glassfish-1 POST_STOP invoked
为什么调用停止检测?
此外,the Cloudify docs声明:
Known Limitation: In case your start script returns, Cloudify will treat your service instance as having stopped and will therefore attempt to provision it again. To avoid this behavior, make sure your start script sleeps forever.
我该怎么办?
默认情况下,Cloudify 监控由启动生命周期事件启动的进程。如果该进程终止,Cloudify 将认为这是服务实例的故障并尝试重新启动它。
如果启动事件启动的进程不是您应该监视的进程,(可能是因为您 运行 进程作为服务,或者使用 nohup)您可以将定位器部分添加到配方中,它告诉 Cloudify 在哪里寻找受监控的进程。也可以配置定位器完全不监听进程,如下:
locator {
NO_PROCESS_LOCATORS
}
这里有一个类似的问题:cloudify 2.7 locator NO_PROCESS_LOCATORS
我正在使用 Cloudify 2.7 和 OpenStack Icehouse。
我已经为 Glassfish 开发了一个服务配方,它将实例注册到 Apache 负载均衡器上。
启动事件执行一个 glassfish_start.groovy
文件,该文件运行以下命令:
su - glassfish -c "asadmin --passwordfile /home/glassfish/passwd.gf --user $userAdmin start-domain $domain"
su - glassfish -c "asadmin --passwordfile /home/glassfish/passwd.gf --user $userAdmin deploy --contextroot \"/\" $warName"
开始活动结束后,可以看到:
2015-07-14 09:59:15,678 glassfish.glassfish [1] INFO ....
[org.cloudifysource.dsl.internal.BaseDslScript] - glassfish-service.groovy (startDetection): arePortsFree http=8080
2015-07-14 09:59:15,680 glassfish.glassfish [1] INFO [org.cloudifysource.usm.UniversalServiceManagerBean] - Process liveness test passed
2015-07-14 09:59:15,680 glassfish.glassfish [1] INFO [org.cloudifysource.usm.UniversalServiceManagerBean] - Executing Process Locators!
2015-07-14 09:59:15,684 glassfish.glassfish [1] INFO [org.cloudifysource.usm.locator.DefaultProcessLocator] - Looking for actual process ID in process tree
2015-07-14 09:59:15,692 glassfish.glassfish [1] INFO [org.cloudifysource.usm.locator.DefaultProcessLocator] - Located process (6446): /usr/lib/jvm/java-8-oracle/jre/bin/java [java, -jar, /opt/glassfish4/bin/../glassfish/lib/client/appserver-cli.jar, --passwordfile, /home/glassfish/passwd.gf, --user, <user>, deploy, --contextroot, /, hello.war]
2015-07-14 09:59:15,693 glassfish.glassfish [1] INFO [org.cloudifysource.usm.UniversalServiceManagerBean] - Monitored processes: [6446]
2015-07-14 09:59:15,700 glassfish.glassfish [1] INFO [org.cloudifysource.usm.USMEventLogger.glassfish.glassfish] - glassfish.glassfish-1 POST_START invoked
2015-07-14 09:59:15,707 glassfish.glassfish [1] INFO [org.cloudifysource.dsl.internal.BaseDslScript] - glassfish-service.groovy: glassfish Post-start - useLoadBalancer = true - Adding Glassfish instance onto ApacheLB...
2015-07-14 09:59:15,721 glassfish.glassfish [1] WARNING [org.cloudifysource.utilitydomain.admin.TimedAdmin] - Admin object might expire prematurely! The specified timeout for waiting for PU was set to 180 SECONDS while the admin timeout is 120 seconds
2015-07-14 09:59:15,740 glassfish.glassfish [1] INFO [org.cloudifysource.dsl.internal.BaseDslScript] - glassfish-service.groovy: add-node onto ApacheLB ...
2015-07-14 09:59:15,742 glassfish.glassfish [1] INFO [org.cloudifysource.dsl.internal.BaseDslScript] - glassfish-service.groovy: ipAddress is <IP> ...
2015-07-14 09:59:15,745 glassfish.glassfish [1] INFO [org.cloudifysource.dsl.internal.BaseDslScript] - glassfish-service.groovy: Sto per aggiungere l'URL http://<IP>:8080 ad ApacheLB ...
2015-07-14 09:59:21,686 glassfish.glassfish [1] INFO [glassfish-stdout] - [exec] Application deployed with name hello.
2015-07-14 09:59:21,687 glassfish.glassfish [1] INFO [glassfish-stdout] - [exec] Command deploy executed successfully.
2015-07-14 09:59:21,687 glassfish.glassfish [1] INFO [glassfish-stdout] - [exec] startOnUbuntu.sh: End
2015-07-14 09:59:21,687 glassfish.glassfish [1] INFO [glassfish-stdout] - [exec] + echo 'startOnUbuntu.sh: End'
2015-07-14 09:59:23,007 glassfish.glassfish [1] INFO [org.cloudifysource.dsl.internal.BaseDslScript] - glassfish-service.groovy: glassfish Post-start ended
2015-07-14 09:59:23,008 glassfish.glassfish [1] INFO [org.cloudifysource.usm.USMEventLogger.glassfish.glassfish] - glassfish.glassfish-1 POST_START completed, duration: 7.3 seconds
2015-07-14 09:59:23,008 glassfish.glassfish [1] INFO [org.cloudifysource.usm.UniversalServiceManagerBean] - Starting async tasks
2015-07-14 09:59:25,011 glassfish.glassfish [1] INFO [org.cloudifysource.usm.USMLifecycleBean] - Stop detection - service has stopped!
2015-07-14 09:59:25,011 glassfish.glassfish [1] INFO [org.cloudifysource.usm.UniversalServiceManagerBean] - Detected death of underlying process
2015-07-14 09:59:25,011 glassfish.glassfish [1] INFO [org.cloudifysource.usm.USMEventLogger.glassfish.glassfish] - glassfish.glassfish-1 POST_STOP invoked
为什么调用停止检测?
此外,the Cloudify docs声明:
Known Limitation: In case your start script returns, Cloudify will treat your service instance as having stopped and will therefore attempt to provision it again. To avoid this behavior, make sure your start script sleeps forever.
我该怎么办?
默认情况下,Cloudify 监控由启动生命周期事件启动的进程。如果该进程终止,Cloudify 将认为这是服务实例的故障并尝试重新启动它。
如果启动事件启动的进程不是您应该监视的进程,(可能是因为您 运行 进程作为服务,或者使用 nohup)您可以将定位器部分添加到配方中,它告诉 Cloudify 在哪里寻找受监控的进程。也可以配置定位器完全不监听进程,如下:
locator {
NO_PROCESS_LOCATORS
}
这里有一个类似的问题:cloudify 2.7 locator NO_PROCESS_LOCATORS