|
@@ -36,12 +36,14 @@ def hive_service(
|
|
cmd = format(
|
|
cmd = format(
|
|
"env JAVA_HOME={java64_home} {start_hiveserver2_path} {hive_log_dir}/hive-server2.out {hive_log_dir}/hive-server2.log {pid_file} {hive_server_conf_dir} {hive_log_dir}")
|
|
"env JAVA_HOME={java64_home} {start_hiveserver2_path} {hive_log_dir}/hive-server2.out {hive_log_dir}/hive-server2.log {pid_file} {hive_server_conf_dir} {hive_log_dir}")
|
|
|
|
|
|
|
|
+ is_started = format("ls {pid_file} >/dev/null 2>&1 && ps `cat {pid_file}` >/dev/null 2>&1")
|
|
|
|
+
|
|
if action == 'start':
|
|
if action == 'start':
|
|
demon_cmd = format("{cmd}")
|
|
demon_cmd = format("{cmd}")
|
|
- no_op_test = format("ls {pid_file} >/dev/null 2>&1 && ps `cat {pid_file}` >/dev/null 2>&1")
|
|
|
|
|
|
+
|
|
Execute(demon_cmd,
|
|
Execute(demon_cmd,
|
|
user=params.hive_user,
|
|
user=params.hive_user,
|
|
- not_if=no_op_test
|
|
|
|
|
|
+ not_if=is_started
|
|
)
|
|
)
|
|
|
|
|
|
if params.hive_jdbc_driver == "com.mysql.jdbc.Driver" or \
|
|
if params.hive_jdbc_driver == "com.mysql.jdbc.Driver" or \
|
|
@@ -50,9 +52,13 @@ def hive_service(
|
|
db_connection_check_command = format(
|
|
db_connection_check_command = format(
|
|
"{java64_home}/bin/java -cp {check_db_connection_jar}:/usr/share/java/{jdbc_jar_name} org.apache.ambari.server.DBConnectionVerification {hive_jdbc_connection_url} {hive_metastore_user_name} {hive_metastore_user_passwd!p} {hive_jdbc_driver}")
|
|
"{java64_home}/bin/java -cp {check_db_connection_jar}:/usr/share/java/{jdbc_jar_name} org.apache.ambari.server.DBConnectionVerification {hive_jdbc_connection_url} {hive_metastore_user_name} {hive_metastore_user_passwd!p} {hive_jdbc_driver}")
|
|
Execute(db_connection_check_command,
|
|
Execute(db_connection_check_command,
|
|
- path='/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin')
|
|
|
|
|
|
+ path='/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin',
|
|
|
|
+ )
|
|
|
|
|
|
elif action == 'stop':
|
|
elif action == 'stop':
|
|
demon_cmd = format("kill `cat {pid_file}` >/dev/null 2>&1 && rm -f {pid_file}")
|
|
demon_cmd = format("kill `cat {pid_file}` >/dev/null 2>&1 && rm -f {pid_file}")
|
|
- Execute(demon_cmd)
|
|
|
|
|
|
+ Execute(demon_cmd,
|
|
|
|
+ not_if = format("! ({is_started})")
|
|
|
|
+ )
|
|
|
|
+
|
|
|
|
|