0

Cloudify 2.7.1 で startDetection の axternal スクリプトを使用することができません。

私は試します:

def result = ServiceUtils.isPortOccupied(port)
println "startDetection.groovy: is service started : ${result}"

return result

結果は次のとおりです。

2014-09-25 12:46:09,268 default.service [1] INFO [org.cloudifysource.usm.launcher.DefaultProcessLauncher] - startDetection.groovy: isPortFree port ...
2014-09-25 12:46:09,300 default.service [1] INFO [org.cloudifysource.usm.launcher.DefaultProcessLauncher] - startDetection.groovy: is service started : false
2014-09-25 12:46:09,316 default.service [1] INFO [org.cloudifysource.usm.launcher.DefaultProcessLauncher] - Command exited with value: 0
2014-09-25 12:46:09,517 default.service [1] INFO [org.cloudifysource.usm.UniversalServiceManagerBean] - Process liveness test passed

開始スクリプトの実際の終了前。

そして私は試します:

def result = ServiceUtils.isPortOccupied(port)
println "startDetection.groovy: is service started : ${result}"
if (result){
    System.exit(0)
}
System.exit(-1)

開始スクリプトの終了前の結果は次のとおりです。

2014-09-25 12:59:19,299 default.service [1] INFO [org.cloudifysource.usm.launcher.DefaultProcessLauncher] - startDetection.groovy: isPortFree port ...
2014-09-25 12:59:19,331 default.service [1] INFO [org.cloudifysource.usm.launcher.DefaultProcessLauncher] - startDetection.groovy: is service started : false
2014-09-25 12:59:19,359 default.service [1] INFO [org.cloudifysource.usm.launcher.DefaultProcessLauncher] - Command exited with value: 255
2014-09-25 12:59:19,360 default.service [1] SEVERE [org.cloudifysource.usm.launcher.DefaultProcessLauncher] - Event lifecycle external process exited with abnormal status code: 255
2014-09-25 12:59:19,361 default.service [1] SEVERE  [org.cloudifysource.usm.launcher.DefaultProcessLauncher] - Event lifecycle external process failed: /root/gigaspaces/tools/groovy/bin/groovy: 60: [: GNU/Linux: unexpected operator /root/gigaspaces/tools/groovy/bin/groovy: 100: [: GNU/Linux: unexpected operator startDetection.groovy: isPortFree port ... startDetection.groovy: is service started : false
2014-09-25 12:59:19,362 default.service [1] SEVERE [org.cloudifysource.usm.dsl.DSLEntryExecutor] - Failed to execute entry: startDetection.groovy; Caused by: org.cloudifysource.usm.USMException: Event lifecycle external process exited with abnormal status code: 255 /root/gigaspaces/tools/groovy/bin/groovy: 60: [: GNU/Linux: unexpected operator /root/gigaspaces/tools/groovy/bin/groovy: 100: [: GNU/Linux: unexpected operator startDetection.groovy: isPortFree port ... startDetection.groovy: is service started : false

    at org.cloudifysource.usm.launcher.DefaultProcessLauncher.launchProcess(DefaultProcessLauncher.java:762)
    at org.cloudifysource.usm.launcher.DefaultProcessLauncher.launchProcess(DefaultProcessLauncher.java:1086)
    at org.cloudifysource.usm.dsl.DSLEntryExecutor.run(DSLEntryExecutor.java:90)
    at org.cloudifysource.usm.dsl.DSLBeanConfiguration$6.isProcessAlive(DSLBeanConfiguration.java:529)
    at org.cloudifysource.usm.USMLifecycleBean.isProcessLivenessTestPassed(USMLifecycleBean.java:736)
    at org.cloudifysource.usm.UniversalServiceManagerBean.launch(UniversalServiceManagerBean.java:1140)
    at org.cloudifysource.usm.UniversalServiceManagerBean.installAndRun(UniversalServiceManagerBean.java:834)
    at org.cloudifysource.usm.UniversalServiceManagerBean.access$000(UniversalServiceManagerBean.java:103)
    at org.cloudifysource.usm.UniversalServiceManagerBean$2$1.run(UniversalServiceManagerBean.java:807)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
    at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
    at java.lang.Thread.run(Thread.java:662)

2014-09-25 12:59:19,362 default.zabbix [1] WARNING [org.cloudifysource.usm.dsl.DSLBeanConfiguration] - Liveness Detector failed to execute. Exception was: org.cloudifysource.usm.USMException: Event lifecycle external process exited with abnormal status code: 255

開始スクリプトの終了後の結果は次のとおりです。

2014-09-25 12:46:09,268 default.service [1] INFO [org.cloudifysource.usm.launcher.DefaultProcessLauncher] - startDetection.groovy: isPortFree port ...
2014-09-25 12:46:09,300 default.service [1] INFO [org.cloudifysource.usm.launcher.DefaultProcessLauncher] - startDetection.groovy: is service started : false
2014-09-25 12:46:09,316 default.service [1] INFO [org.cloudifysource.usm.launcher.DefaultProcessLauncher] - Command exited with value: 0
2014-09-25 12:46:09,517 default.service [1] INFO [org.cloudifysource.usm.UniversalServiceManagerBean] - Process liveness test passed

どちらの場合も機能しません。

そのようなクロージャで startDetection しか使用できません。

startDetection {
    println "service.groovy(startDetection): isPortFree ${port} ..."
    return ServiceUtils.isPortOccupied(port)
}

stopDetection のように。

誰かが理由を知っていますか?

4

1 に答える 1

0

上でコピーしたログ エントリは問題ないようです。開始検出では、外部ライフサイクル スクリプトを使用すると、成功/失敗を示すプロセス リターン コードを渡すだけで済みます。ゼロの戻りコードは、テストが成功したことを示します - 開始検出は正常に完了しました。ゼロ以外の値は、テストに合格しなかったことを意味します。

あなたの質問では、開始スクリプトが正常に完了すると、次のようになります: Process liveness test passed

したがって、スクリプトは正しく終了し、開始検出は成功しました。うまくいかないというのは具体的にどういうことですか?

于 2014-09-28T10:33:56.627 に答える