我已经构建了一个包和一个csd,它们在部署到集群时配合良好。
但是,当我停止服务时,由启动脚本启动的子进程将继续在后台运行。
我尝试过很多东西,但我又回到了更"残忍"的地方。
CSD提取
"startRunner" : {
"program" : "scripts/rexster.sh",
"args" : [ "start" ],
"environmentVariables" : {
"CONF_FILE" : "${conf_file}",
"REXSTER_PORT" : "${rexster_port}",
"HBASE_ZK" : "${hbase_zk_quorum}",
"REXSTER_SHUTDOWN_PORT" : "${rexster_shutdown_port}",
"HBASE_TABLE_NAME" : "${hbase_tablename}",
"MEM_XMX" : "${memory_xmx}",
"MEM_XMS" : "${memory_xms}"
}
},
"stopRunner" : {
"relevantRoleTypes" : ["TITAN_REXTER_SERVER"],
"runner" : {
"program" : "scripts/rexster.sh",
"args" : [ "stop" ]
}
}
}
脚本/rexster.sh提取
...
;;
(stop)
echo "Stopping rexster"
exec kill -9 `ps aux | grep java | grep titan | awk '{print $2}'`
# exec stopRexster.sh $TITAN_HOME
;;
(*)
echo "Don't understand [$CMD]"
;;
esac
但这个过程一直在后台运行:
usr/java/jdk1.7.0_67-cloudera/bin/java -server -Xms128m -Xmx512m -Dtitan.logdir=../log com.tinkerpop.rexster.Application -s -c /opt/cloudera/parcels/TITAN-1.0/lib/titan-0.5.2-hadoop2-CDH5.3/conf/rexster-hbase.xml
定位不正确。它是在角色定义之后按角色定义的。
<...ROLE...>}]
,
"stopRunner" : {
"masterRole":"TITAN_REXTER_SERVER",
"relevantRoleTypes" : ["TITAN_REXTER_SERVER"],
"runner" : {
"program" : "scripts/rexster.sh",
"args" : [ "stop" ],
"environmentVariables" : {
"CONF_FILE" : "${conf_file}",
"REXSTER_PORT" : "${rexster_port}",
"HBASE_ZK" : "${hbase_zk_quorum}",
"REXSTER_SHUTDOWN_PORT" : "${rexster_shutdown_port}",
"HBASE_TABLE_NAME" : "${hbase_tablename}"
}
}
}