http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_windows.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_windows.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_windows.py new file mode 100644 index 0000000..88e6246 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/params_windows.py @@ -0,0 +1,60 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" + +from resource_management import * +from status_params import * +from resource_management.libraries.functions.default import default + +# server configurations +config = Script.get_config() + +stack_is_hdp23_or_further = Script.is_stack_greater_or_equal("2.3") + +stack_root = os.path.abspath(os.path.join(os.environ["HADOOP_HOME"],"..")) +conf_dir = os.environ["STORM_CONF_DIR"] +hadoop_user = config["configurations"]["cluster-env"]["hadoop.user.name"] +storm_user = hadoop_user + +security_enabled = config['configurations']['cluster-env']['security_enabled'] +default_topology_max_replication_wait_time_sec = default('/configurations/storm-site/topology.max.replication.wait.time.sec.default', -1) +nimbus_hosts = default("/clusterHostInfo/nimbus_hosts", []) +default_topology_min_replication_count = default('/configurations/storm-site/topology.min.replication.count.default', 1) + +#Calculate topology.max.replication.wait.time.sec and topology.min.replication.count +if len(nimbus_hosts) > 1: + # for HA Nimbus + actual_topology_max_replication_wait_time_sec = -1 + actual_topology_min_replication_count = len(nimbus_hosts) / 2 + 1 +else: + # for non-HA Nimbus + actual_topology_max_replication_wait_time_sec = default_topology_max_replication_wait_time_sec + actual_topology_min_replication_count = default_topology_min_replication_count + +if stack_is_hdp23_or_further: + if security_enabled: + storm_thrift_transport = config['configurations']['storm-site']['_storm.thrift.secure.transport'] + else: + storm_thrift_transport = config['configurations']['storm-site']['_storm.thrift.nonsecure.transport'] + +service_map = { + "nimbus" : nimbus_win_service_name, + "supervisor" : supervisor_win_service_name, + "ui" : ui_win_service_name +}
http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/rest_api.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/rest_api.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/rest_api.py new file mode 100644 index 0000000..26fdb27 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/rest_api.py @@ -0,0 +1,81 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" + +import sys +from resource_management.libraries.functions import check_process_status +from resource_management.libraries.script import Script +from resource_management.libraries.functions import conf_select +from resource_management.libraries.functions import stack_select +from resource_management.libraries.functions import format +from resource_management.core.resources.system import Execute + +from storm import storm +from service import service +from service_check import ServiceCheck + + +class StormRestApi(Script): + """ + Storm REST API. + It was available in HDP 2.0 and 2.1. + In HDP 2.2, it was removed since the functionality was moved to Storm UI Server. + """ + + def get_component_name(self): + return "storm-client" + + def install(self, env): + self.install_packages(env) + self.configure(env) + + def configure(self, env): + import params + env.set_params(params) + + storm() + + def start(self, env, upgrade_type=None): + import params + env.set_params(params) + self.configure(env) + + service("rest_api", action="start") + + def stop(self, env, upgrade_type=None): + import params + env.set_params(params) + + service("rest_api", action="stop") + + def status(self, env): + import status_params + env.set_params(status_params) + check_process_status(status_params.pid_rest_api) + + def get_log_folder(self): + import params + return params.log_dir + + def get_user(self): + import params + return params.storm_user + +if __name__ == "__main__": + StormRestApi().execute() http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/service.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/service.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/service.py new file mode 100644 index 0000000..6da159a --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/service.py @@ -0,0 +1,97 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" + +import os + +from resource_management.core.resources import Execute +from resource_management.core.resources import File +from resource_management.core.shell import as_user +from resource_management.libraries.functions.format import format +from resource_management.libraries.functions import get_user_call_output +from resource_management.libraries.functions.show_logs import show_logs +import time + + +def service(name, action = 'start'): + import params + import status_params + + pid_file = status_params.pid_files[name] + no_op_test = as_user(format( + "ls {pid_file} >/dev/null 2>&1 && ps -p `cat {pid_file}` >/dev/null 2>&1"), user=params.storm_user) + tries_count = 12 + + if name == 'ui': + process_grep = "storm.ui.core$" + elif name == "rest_api": + process_grep = format("{rest_lib_dir}/storm-rest-.*\.jar$") + else: + process_grep = format("storm.daemon.{name}$") + + find_proc = format("{jps_binary} -l | grep {process_grep}") + write_pid = format("{find_proc} | awk {{'print $1'}} > {pid_file}") + crt_pid_cmd = format("{find_proc} && {write_pid}") + storm_env = format( + "source {conf_dir}/storm-env.sh ; export PATH=$JAVA_HOME/bin:$PATH") + + if action == "start": + if name == "rest_api": + process_cmd = format( + "{storm_env} ; java -jar {rest_lib_dir}/`ls {rest_lib_dir} | grep -wE storm-rest-[0-9.-]+\.jar` server") + cmd = format( + "{process_cmd} {rest_api_conf_file} > {log_dir}/restapi.log 2>&1") + else: + cmd = format("{storm_env} ; storm {name} > {log_dir}/{name}.out 2>&1") + + Execute(cmd, + not_if = no_op_test, + user = params.storm_user, + wait_for_finish = False, + path = params.storm_bin_dir) + + try: + Execute(crt_pid_cmd, + user = params.storm_user, + logoutput = True, + tries = tries_count, + try_sleep = 10, + path = params.storm_bin_dir) + except: + show_logs(params.log_dir, params.storm_user) + raise + + elif action == "stop": + process_dont_exist = format("! ({no_op_test})") + if os.path.exists(pid_file): + pid = get_user_call_output.get_user_call_output(format("! test -f {pid_file} || cat {pid_file}"), user=params.storm_user)[1] + + # if multiple processes are running (for example user can start logviewer from console) + # there can be more than one id + pid = pid.replace("\n", " ") + + Execute(format("{sudo} kill {pid}"), + not_if = process_dont_exist) + + Execute(format("{sudo} kill -9 {pid}"), + not_if = format( + "sleep 2; {process_dont_exist} || sleep 20; {process_dont_exist}"), + ignore_failures = True) + + File(pid_file, action = "delete") http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/service_check.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/service_check.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/service_check.py new file mode 100644 index 0000000..80ea0f5 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/service_check.py @@ -0,0 +1,79 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" + +import os + +from resource_management.libraries.functions.format import format +from resource_management.libraries.functions import get_unique_id_and_date +from resource_management.core.resources import File +from resource_management.core.resources import Execute +from resource_management.libraries.script import Script +from resource_management.core.source import StaticFile +from ambari_commons import OSCheck, OSConst +from ambari_commons.os_family_impl import OsFamilyImpl + +class ServiceCheck(Script): + pass + + +@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY) +class ServiceCheckWindows(ServiceCheck): + def service_check(self, env): + import params + env.set_params(params) + smoke_cmd = os.path.join(params.stack_root,"Run-SmokeTests.cmd") + service = "STORM" + Execute(format("cmd /C {smoke_cmd} {service}", smoke_cmd=smoke_cmd, service=service), user=params.storm_user, logoutput=True) + + +@OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT) +class ServiceCheckDefault(ServiceCheck): + def service_check(self, env): + import params + env.set_params(params) + + unique = get_unique_id_and_date() + + File("/tmp/wordCount.jar", + content=StaticFile("wordCount.jar"), + owner=params.storm_user + ) + + cmd = "" + if params.nimbus_seeds_supported: + # Because this command is guaranteed to run on one of the hosts with storm client, there is no need + # to specify "-c nimbus.seeds={nimbus_seeds}" + cmd = format("storm jar /tmp/wordCount.jar storm.starter.WordCountTopology WordCount{unique}") + elif params.nimbus_host is not None: + cmd = format("storm jar /tmp/wordCount.jar storm.starter.WordCountTopology WordCount{unique} -c nimbus.host={nimbus_host}") + + Execute(cmd, + logoutput=True, + path=params.storm_bin_dir, + user=params.storm_user + ) + + Execute(format("storm kill WordCount{unique}"), + path=params.storm_bin_dir, + user=params.storm_user + ) + +if __name__ == "__main__": + ServiceCheck().execute() http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/setup_atlas_storm.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/setup_atlas_storm.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/setup_atlas_storm.py new file mode 100644 index 0000000..6c3e91f --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/setup_atlas_storm.py @@ -0,0 +1,45 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" + +from resource_management.core.resources.packaging import Package +from resource_management.core.resources.system import Link +from ambari_commons import OSCheck + +import os + +def setup_atlas_storm(): + import params + + if params.has_atlas: + + if not params.host_sys_prepped: + Package(params.atlas_ubuntu_plugin_package if OSCheck.is_ubuntu_family() else params.atlas_plugin_package, + retry_on_repo_unavailability=params.agent_stack_retry_on_unavailability, retry_count=params.agent_stack_retry_count) + + atlas_storm_hook_dir = os.path.join(params.atlas_home_dir, "hook", "storm") + if os.path.exists(atlas_storm_hook_dir): + storm_extlib_dir = os.path.join(params.storm_component_home_dir, "extlib") + if os.path.exists(storm_extlib_dir): + src_files = os.listdir(atlas_storm_hook_dir) + for file_name in src_files: + atlas_storm_hook_file_name = os.path.join(atlas_storm_hook_dir, file_name) + storm_lib_file_name = os.path.join(storm_extlib_dir, file_name) + if (os.path.isfile(atlas_storm_hook_file_name)): + Link(storm_lib_file_name, to = atlas_storm_hook_file_name) http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/setup_ranger_storm.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/setup_ranger_storm.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/setup_ranger_storm.py new file mode 100644 index 0000000..ba4c777 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/setup_ranger_storm.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" +from resource_management.core.logger import Logger + +def setup_ranger_storm(upgrade_type=None): + """ + :param upgrade_type: Upgrade Type such as "rolling" or "nonrolling" + """ + import params + if params.has_ranger_admin and params.security_enabled: + + stack_version = None + if upgrade_type is not None: + stack_version = params.version + + if params.retryAble: + Logger.info("Storm: Setup ranger: command retry enables thus retrying if ranger admin is down !") + else: + Logger.info("Storm: Setup ranger: command retry not enabled thus skipping if ranger admin is down !") + + if params.xml_configurations_supported and params.enable_ranger_storm and params.xa_audit_hdfs_is_enabled: + if params.has_namenode: + params.HdfsResource("/ranger/audit", + type="directory", + action="create_on_execute", + owner=params.hdfs_user, + group=params.hdfs_user, + mode=0755, + recursive_chmod=True + ) + params.HdfsResource("/ranger/audit/storm", + type="directory", + action="create_on_execute", + owner=params.storm_user, + group=params.storm_user, + mode=0700, + recursive_chmod=True + ) + params.HdfsResource(None, action="execute") + + if params.xml_configurations_supported: + api_version=None + if params.stack_supports_ranger_kerberos and params.security_enabled: + Logger.info('setting stack_version as v2') + api_version='v2' + from resource_management.libraries.functions.setup_ranger_plugin_xml import setup_ranger_plugin + setup_ranger_plugin('storm-nimbus', 'storm', + params.downloaded_custom_connector, params.driver_curl_source, + params.driver_curl_target, params.java64_home, + params.repo_name, params.storm_ranger_plugin_repo, + params.ranger_env, params.ranger_plugin_properties, + params.policy_user, params.policymgr_mgr_url, + params.enable_ranger_storm, conf_dict=params.conf_dir, + component_user=params.storm_user, component_group=params.user_group, cache_service_list=['storm'], + plugin_audit_properties=params.config['configurations']['ranger-storm-audit'], plugin_audit_attributes=params.config['configuration_attributes']['ranger-storm-audit'], + plugin_security_properties=params.config['configurations']['ranger-storm-security'], plugin_security_attributes=params.config['configuration_attributes']['ranger-storm-security'], + plugin_policymgr_ssl_properties=params.config['configurations']['ranger-storm-policymgr-ssl'], plugin_policymgr_ssl_attributes=params.config['configuration_attributes']['ranger-storm-policymgr-ssl'], + component_list=['storm-client', 'storm-nimbus'], audit_db_is_enabled=params.xa_audit_db_is_enabled, + credential_file=params.credential_file, xa_audit_db_password=params.xa_audit_db_password, + ssl_truststore_password=params.ssl_truststore_password, ssl_keystore_password=params.ssl_keystore_password, + stack_version_override = stack_version, skip_if_rangeradmin_down= not params.retryAble,api_version=api_version, + is_security_enabled = params.security_enabled, + is_stack_supports_ranger_kerberos = params.stack_supports_ranger_kerberos, + component_user_principal=params.ranger_storm_principal if params.security_enabled else None, + component_user_keytab=params.ranger_storm_keytab if params.security_enabled else None) + else: + from resource_management.libraries.functions.setup_ranger_plugin import setup_ranger_plugin + setup_ranger_plugin('storm-nimbus', 'storm', + params.downloaded_custom_connector, params.driver_curl_source, + params.driver_curl_target, params.java64_home, + params.repo_name, params.storm_ranger_plugin_repo, + params.ranger_env, params.ranger_plugin_properties, + params.policy_user, params.policymgr_mgr_url, + params.enable_ranger_storm, conf_dict=params.conf_dir, + component_user=params.storm_user, component_group=params.user_group, cache_service_list=['storm'], + plugin_audit_properties=params.config['configurations']['ranger-storm-audit'], plugin_audit_attributes=params.config['configuration_attributes']['ranger-storm-audit'], + plugin_security_properties=params.config['configurations']['ranger-storm-security'], plugin_security_attributes=params.config['configuration_attributes']['ranger-storm-security'], + plugin_policymgr_ssl_properties=params.config['configurations']['ranger-storm-policymgr-ssl'], plugin_policymgr_ssl_attributes=params.config['configuration_attributes']['ranger-storm-policymgr-ssl'], + component_list=['storm-client', 'storm-nimbus'], audit_db_is_enabled=params.xa_audit_db_is_enabled, + credential_file=params.credential_file, xa_audit_db_password=params.xa_audit_db_password, + ssl_truststore_password=params.ssl_truststore_password, ssl_keystore_password=params.ssl_keystore_password, + stack_version_override = stack_version, skip_if_rangeradmin_down= not params.retryAble) + else: + Logger.info('Ranger admin not installed') http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/status_params.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/status_params.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/status_params.py new file mode 100644 index 0000000..d84b095 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/status_params.py @@ -0,0 +1,83 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" +from resource_management.libraries.script import Script +from resource_management.libraries.functions import get_kinit_path +from resource_management.libraries.functions import default, format +from resource_management.libraries.functions.version import format_stack_version +from resource_management.libraries.functions.stack_features import check_stack_feature +from resource_management.libraries.functions import StackFeature +from ambari_commons import OSCheck + +# a map of the Ambari role to the component name +# for use with <stack-root>/current/<component> +SERVER_ROLE_DIRECTORY_MAP = { + 'NIMBUS' : 'storm-nimbus', + 'SUPERVISOR' : 'storm-supervisor', + 'STORM_UI_SERVER' : 'storm-client', + 'DRPC_SERVER' : 'storm-client', + 'STORM_SERVICE_CHECK' : 'storm-client' +} + +component_directory = Script.get_component_from_role(SERVER_ROLE_DIRECTORY_MAP, "STORM_SERVICE_CHECK") + +config = Script.get_config() +stack_root = Script.get_stack_root() +stack_version_unformatted = str(config['hostLevelParams']['stack_version']) +stack_version_formatted = format_stack_version(stack_version_unformatted) + +if OSCheck.is_windows_family(): + nimbus_win_service_name = "nimbus" + supervisor_win_service_name = "supervisor" + ui_win_service_name = "ui" +else: + pid_dir = config['configurations']['storm-env']['storm_pid_dir'] + pid_nimbus = format("{pid_dir}/nimbus.pid") + pid_supervisor = format("{pid_dir}/supervisor.pid") + pid_drpc = format("{pid_dir}/drpc.pid") + pid_ui = format("{pid_dir}/ui.pid") + pid_logviewer = format("{pid_dir}/logviewer.pid") + pid_rest_api = format("{pid_dir}/restapi.pid") + + pid_files = { + "logviewer":pid_logviewer, + "ui": pid_ui, + "nimbus": pid_nimbus, + "supervisor": pid_supervisor, + "drpc": pid_drpc, + "rest_api": pid_rest_api + } + + # Security related/required params + hostname = config['hostname'] + security_enabled = config['configurations']['cluster-env']['security_enabled'] + kinit_path_local = get_kinit_path(default('/configurations/kerberos-env/executable_search_paths', None)) + tmp_dir = Script.get_tmp_dir() + + storm_component_home_dir = "/usr/lib/storm" + conf_dir = "/etc/storm/conf" + if stack_version_formatted and check_stack_feature(StackFeature.ROLLING_UPGRADE, stack_version_formatted): + storm_component_home_dir = format("{stack_root}/current/{component_directory}") + conf_dir = format("{stack_root}/current/{component_directory}/conf") + + storm_user = config['configurations']['storm-env']['storm_user'] + storm_ui_principal = default('/configurations/storm-env/storm_ui_principal_name', None) + storm_ui_keytab = default('/configurations/storm-env/storm_ui_keytab', None) + +stack_name = default("/hostLevelParams/stack_name", None) \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm.py new file mode 100644 index 0000000..2d50767 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm.py @@ -0,0 +1,162 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" + +from resource_management.core.exceptions import Fail +from resource_management.core.resources.service import ServiceConfig +from resource_management.core.resources.system import Directory, Execute, File, Link +from resource_management.core.source import InlineTemplate +from resource_management.libraries.resources.template_config import TemplateConfig +from resource_management.libraries.functions.format import format +from resource_management.libraries.script.script import Script +from resource_management.core.source import Template +from resource_management.libraries.functions.stack_features import check_stack_feature +from resource_management.libraries.functions import StackFeature +from storm_yaml_utils import yaml_config_template, yaml_config +from ambari_commons.os_family_impl import OsFamilyFuncImpl, OsFamilyImpl +from ambari_commons import OSConst +from setup_atlas_storm import setup_atlas_storm + +@OsFamilyFuncImpl(os_family=OSConst.WINSRV_FAMILY) +def storm(name=None): + import params + yaml_config("storm.yaml", + conf_dir=params.conf_dir, + configurations=params.config['configurations']['storm-site'], + owner=params.storm_user + ) + + if params.service_map.has_key(name): + service_name = params.service_map[name] + ServiceConfig(service_name, + action="change_user", + username = params.storm_user, + password = Script.get_password(params.storm_user)) + + +@OsFamilyFuncImpl(os_family=OsFamilyImpl.DEFAULT) +def storm(name=None): + import params + import os + + Directory(params.log_dir, + owner=params.storm_user, + group=params.user_group, + mode=0777, + create_parents = True + ) + + Directory([params.pid_dir, params.local_dir], + owner=params.storm_user, + group=params.user_group, + create_parents = True, + cd_access="a", + mode=0755, + ) + + Directory(params.conf_dir, + group=params.user_group, + create_parents = True, + cd_access="a", + ) + + File(format("{conf_dir}/config.yaml"), + content=Template("config.yaml.j2"), + owner=params.storm_user, + group=params.user_group + ) + + configurations = params.config['configurations']['storm-site'] + + File(format("{conf_dir}/storm.yaml"), + content=yaml_config_template(configurations), + owner=params.storm_user, + group=params.user_group + ) + + File(format("{conf_dir}/storm-env.sh"), + owner=params.storm_user, + content=InlineTemplate(params.storm_env_sh_template) + ) + + setup_atlas_storm() + + if params.has_metric_collector: + File(format("{conf_dir}/storm-metrics2.properties"), + owner=params.storm_user, + group=params.user_group, + content=Template("storm-metrics2.properties.j2") + ) + + # Remove symlinks. They can be there, if you doing upgrade from HDP < 2.2 to HDP >= 2.2 + Link(format("{storm_lib_dir}/ambari-metrics-storm-sink.jar"), + action="delete") + # On old HDP 2.1 versions, this symlink may also exist and break EU to newer versions + Link("/usr/lib/storm/lib/ambari-metrics-storm-sink.jar", action="delete") + + Execute(format("{sudo} ln -s {metric_collector_sink_jar} {storm_lib_dir}/ambari-metrics-storm-sink.jar"), + not_if=format("ls {storm_lib_dir}/ambari-metrics-storm-sink.jar"), + only_if=format("ls {metric_collector_sink_jar}") + ) + + if params.storm_logs_supported: + Directory(params.log4j_dir, + owner=params.storm_user, + group=params.user_group, + mode=0755, + create_parents = True + ) + + File(format("{log4j_dir}/cluster.xml"), + owner=params.storm_user, + content=InlineTemplate(params.storm_cluster_log4j_content) + ) + File(format("{log4j_dir}/worker.xml"), + owner=params.storm_user, + content=InlineTemplate(params.storm_worker_log4j_content) + ) + + if params.security_enabled: + TemplateConfig(format("{conf_dir}/storm_jaas.conf"), + owner=params.storm_user + ) + if params.stack_version_formatted and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.stack_version_formatted): + TemplateConfig(format("{conf_dir}/client_jaas.conf"), + owner=params.storm_user + ) + minRuid = configurations['_storm.min.ruid'] if configurations.has_key('_storm.min.ruid') else '' + + min_user_ruid = int(minRuid) if minRuid.isdigit() else _find_real_user_min_uid() + + File(format("{conf_dir}/worker-launcher.cfg"), + content=Template("worker-launcher.cfg.j2", min_user_ruid = min_user_ruid), + owner='root', + group=params.user_group + ) + + +''' +Finds minimal real user UID +''' +def _find_real_user_min_uid(): + with open('/etc/login.defs') as f: + for line in f: + if line.strip().startswith('UID_MIN') and len(line.split()) == 2 and line.split()[1].isdigit(): + return int(line.split()[1]) + raise Fail("Unable to find UID_MIN in file /etc/login.defs. Expecting format e.g.: 'UID_MIN 500'") http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm_upgrade.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm_upgrade.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm_upgrade.py new file mode 100644 index 0000000..bc245c4 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm_upgrade.py @@ -0,0 +1,177 @@ +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" +import ambari_simplejson as json # simplejson is much faster comparing to Python 2.6 json module and has the same functions set. +import os + +from ambari_commons import yaml_utils +from resource_management.core.logger import Logger +from resource_management.core.exceptions import Fail +from resource_management.core.resources.system import Directory +from resource_management.core.resources.system import File +from resource_management.core.resources.system import Execute +from resource_management.libraries.script.script import Script +from resource_management.libraries.functions.default import default +from resource_management.libraries.functions.format import format + +class StormUpgrade(Script): + """ + Applies to Rolling/Express Upgrade from HDP 2.1 or 2.2 to 2.3 or higher. + + Requirements: Needs to run from a host with ZooKeeper Client. + + This class helps perform some of the upgrade tasks needed for Storm during + a Rolling or Express upgrade. Storm writes data to disk locally and to ZooKeeper. + If any HDP 2.1 or 2.2 bits exist in these directories when an HDP 2.3 instance + starts up, it will fail to start properly. Because the upgrade framework in + Ambari doesn't yet have a mechanism to say "stop all" before starting to + upgrade each component, we need to rely on a Storm trick to bring down + running daemons. By removing the ZooKeeper data with running daemons, those + daemons will die. + """ + + def delete_storm_zookeeper_data(self, env): + """ + Deletes the Storm data from ZooKeeper, effectively bringing down all + Storm daemons. + :return: + """ + import params + + Logger.info('Clearing Storm data from ZooKeeper') + + storm_zookeeper_root_dir = params.storm_zookeeper_root_dir + if storm_zookeeper_root_dir is None: + raise Fail("The storm ZooKeeper directory specified by storm-site/storm.zookeeper.root must be specified") + + # The zookeeper client must be given a zookeeper host to contact. Guaranteed to have at least one host. + storm_zookeeper_server_list = yaml_utils.get_values_from_yaml_array(params.storm_zookeeper_servers) + if storm_zookeeper_server_list is None: + Logger.info("Unable to extract ZooKeeper hosts from '{0}', assuming localhost").format(params.storm_zookeeper_servers) + storm_zookeeper_server_list = ["localhost"] + + # For every zk server, try to remove /storm + zookeeper_data_cleared = False + for storm_zookeeper_server in storm_zookeeper_server_list: + # Determine where the zkCli.sh shell script is + zk_command_location = os.path.join(params.stack_root, "current", "zookeeper-client", "bin", "zkCli.sh") + if params.version is not None: + zk_command_location = os.path.join(params.stack_root, params.version, "zookeeper", "bin", "zkCli.sh") + + # create the ZooKeeper delete command + command = "{0} -server {1}:{2} rmr /storm".format( + zk_command_location, storm_zookeeper_server, params.storm_zookeeper_port) + + # clean out ZK + try: + # the ZK client requires Java to run; ensure it's on the path + env_map = { + 'JAVA_HOME': params.java64_home + } + + # AMBARI-12094: if security is enabled, then we need to tell zookeeper where the + # JAAS file is located since we don't use kinit directly with STORM + if params.security_enabled: + env_map['JVMFLAGS'] = "-Djava.security.auth.login.config={0}".format(params.storm_jaas_file) + + Execute(command, user=params.storm_user, environment=env_map, + logoutput=True, tries=1) + + zookeeper_data_cleared = True + break + except: + # the command failed, try a different ZK server + pass + + # fail if the ZK data could not be cleared + if not zookeeper_data_cleared: + raise Fail("Unable to clear ZooKeeper Storm data on any of the following ZooKeeper hosts: {0}".format( + storm_zookeeper_server_list)) + + + def delete_storm_local_data(self, env): + """ + Deletes Storm data from local directories. This will create a marker file + with JSON data representing the upgrade stack and request/stage ID. This + will prevent multiple Storm components on the same host from removing + the local directories more than once. + :return: + """ + import params + + Logger.info('Clearing Storm data from local directories...') + + storm_local_directory = params.local_dir + if storm_local_directory is None: + raise Fail("The storm local directory specified by storm-site/storm.local.dir must be specified") + + request_id = default("/requestId", None) + + stack_name = params.stack_name + stack_version = params.version + upgrade_direction = params.upgrade_direction + + json_map = {} + json_map["requestId"] = request_id + json_map["stackName"] = stack_name + json_map["stackVersion"] = stack_version + json_map["direction"] = upgrade_direction + + temp_directory = params.tmp_dir + marker_file = os.path.join(temp_directory, "storm-upgrade-{0}.json".format(stack_version)) + Logger.info("Marker file for upgrade/downgrade of Storm, {0}".format(marker_file)) + + if os.path.exists(marker_file): + Logger.info("The marker file exists.") + try: + with open(marker_file) as file_pointer: + existing_json_map = json.load(file_pointer) + + if cmp(json_map, existing_json_map) == 0: + Logger.info("The storm upgrade has already removed the local directories for {0}-{1} for " + "request {2} and direction {3}. Nothing else to do.".format(stack_name, stack_version, request_id, upgrade_direction)) + + # Nothing else to do here for this as it appears to have already been + # removed by another component being upgraded + return + else: + Logger.info("The marker file differs from the new value. Will proceed to delete Storm local dir, " + "and generate new file. Current marker file: {0}".format(str(existing_json_map))) + except Exception, e: + Logger.error("The marker file {0} appears to be corrupt; removing it. Error: {1}".format(marker_file, str(e))) + File(marker_file, action="delete") + else: + Logger.info('The marker file {0} does not exist; will attempt to delete local Storm directory if it exists.'.format(marker_file)) + + # Delete from local directory + if os.path.isdir(storm_local_directory): + Logger.info("Deleting storm local directory, {0}".format(storm_local_directory)) + Directory(storm_local_directory, action="delete", create_parents = True) + + # Recreate storm local directory + Logger.info("Recreating storm local directory, {0}".format(storm_local_directory)) + Directory(storm_local_directory, mode=0755, owner=params.storm_user, + group=params.user_group, create_parents = True) + + # The file doesn't exist, so create it + Logger.info("Saving marker file to {0} with contents: {1}".format(marker_file, str(json_map))) + with open(marker_file, 'w') as file_pointer: + json.dump(json_map, file_pointer, indent=2) + +if __name__ == "__main__": + StormUpgrade().execute() \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm_yaml_utils.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm_yaml_utils.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm_yaml_utils.py new file mode 100644 index 0000000..9d78e71 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/storm_yaml_utils.py @@ -0,0 +1,53 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" +import os +import resource_management + +from ambari_commons.yaml_utils import escape_yaml_property +from resource_management.core.source import InlineTemplate +from resource_management.core.resources.system import File + +def replace_jaas_placeholder(name, security_enabled, conf_dir): + if name.find('_JAAS_PLACEHOLDER') > -1: + if security_enabled: + return name.replace('_JAAS_PLACEHOLDER', '-Djava.security.auth.login.config=' + conf_dir + '/storm_jaas.conf') + else: + return name.replace('_JAAS_PLACEHOLDER', '') + else: + return name + +storm_yaml_template = """{% for key, value in configurations|dictsort if not key.startswith('_') %}{{key}} : {{ escape_yaml_property(replace_jaas_placeholder(resource_management.core.source.InlineTemplate(value).get_content().strip(), security_enabled, conf_dir)) }} +{% endfor %}""" + +def yaml_config_template(configurations): + return InlineTemplate(storm_yaml_template, configurations=configurations, + extra_imports=[escape_yaml_property, replace_jaas_placeholder, resource_management, + resource_management.core, resource_management.core.source]) + +def yaml_config(filename, configurations = None, conf_dir = None, owner = None, group = None): + import params + config_content = InlineTemplate('''{% for key, value in configurations_dict|dictsort %}{{ key }}: {{ escape_yaml_property(resource_management.core.source.InlineTemplate(value).get_content()) }} +{% endfor %}''', configurations_dict=configurations, extra_imports=[escape_yaml_property, resource_management, resource_management.core, resource_management.core.source]) + + File (os.path.join(params.conf_dir, filename), + content = config_content, + owner = owner, + mode = "f" + ) http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisor.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisor.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisor.py new file mode 100644 index 0000000..da900f9 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisor.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" + +import sys +from resource_management.libraries.functions import check_process_status +from resource_management.libraries.script import Script +from resource_management.libraries.functions import conf_select +from resource_management.libraries.functions import stack_select +from resource_management.libraries.functions import format +from resource_management.core.resources.system import Execute +from resource_management.libraries.functions.stack_features import check_stack_feature +from resource_management.libraries.functions import StackFeature +from storm import storm +from service import service +from ambari_commons import OSConst +from ambari_commons.os_family_impl import OsFamilyImpl +from resource_management.core.resources.service import Service + + +class Supervisor(Script): + def get_component_name(self): + return "storm-supervisor" + + def install(self, env): + self.install_packages(env) + self.configure(env) + + def configure(self, env): + import params + env.set_params(params) + storm("supervisor") + + +@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY) +class SupervisorWindows(Supervisor): + def start(self, env): + import status_params + env.set_params(status_params) + self.configure(env) + Service(status_params.supervisor_win_service_name, action="start") + + def stop(self, env): + import status_params + env.set_params(status_params) + Service(status_params.supervisor_win_service_name, action="stop") + + def status(self, env): + import status_params + from resource_management.libraries.functions.windows_service_utils import check_windows_service_status + env.set_params(status_params) + check_windows_service_status(status_params.supervisor_win_service_name) + + +@OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT) +class SupervisorDefault(Supervisor): + + def pre_upgrade_restart(self, env, upgrade_type=None): + import params + env.set_params(params) + + if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version): + conf_select.select(params.stack_name, "storm", params.version) + stack_select.select("storm-client", params.version) + stack_select.select("storm-supervisor", params.version) + + def start(self, env, upgrade_type=None): + import params + env.set_params(params) + self.configure(env) + + service("supervisor", action="start") + service("logviewer", action="start") + + def stop(self, env, upgrade_type=None): + import params + env.set_params(params) + + service("supervisor", action="stop") + service("logviewer", action="stop") + + def status(self, env): + import status_params + env.set_params(status_params) + check_process_status(status_params.pid_supervisor) + + def get_log_folder(self): + import params + return params.log_dir + + def get_user(self): + import params + return params.storm_user + +if __name__ == "__main__": + Supervisor().execute() + http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisor_prod.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisor_prod.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisor_prod.py new file mode 100644 index 0000000..d6c3545 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisor_prod.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" + +import sys +from storm import storm +from service import service +from supervisord_service import supervisord_service, supervisord_check_status +from resource_management.libraries.script import Script +from resource_management.libraries.functions import conf_select +from resource_management.libraries.functions import stack_select +from resource_management.libraries.functions import format +from resource_management.core.resources.system import Execute +from resource_management.libraries.functions.stack_features import check_stack_feature +from resource_management.libraries.functions import StackFeature + + +class Supervisor(Script): + + def get_component_name(self): + return "storm-supervisor" + + def install(self, env): + self.install_packages(env) + self.configure(env) + + def configure(self, env): + import params + env.set_params(params) + storm() + + def pre_upgrade_restart(self, env, upgrade_type=None): + import params + env.set_params(params) + + if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version): + conf_select.select(params.stack_name, "storm", params.version) + stack_select.select("storm-client", params.version) + stack_select.select("storm-supervisor", params.version) + + def start(self, env, upgrade_type=None): + import params + env.set_params(params) + self.configure(env) + + supervisord_service("supervisor", action="start") + service("logviewer", action="start") + + def stop(self, env, upgrade_type=None): + import params + env.set_params(params) + + supervisord_service("supervisor", action="stop") + service("logviewer", action="stop") + + def status(self, env): + supervisord_check_status("supervisor") + + def get_log_folder(self): + import params + return params.log_dir + + def get_user(self): + import params + return params.storm_user + +if __name__ == "__main__": + Supervisor().execute() http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisord_service.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisord_service.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisord_service.py new file mode 100644 index 0000000..6ff9f9c --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/supervisord_service.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" + +from resource_management.core.resources.system import Execute +from resource_management.libraries.functions.format import format + +def supervisord_service(component_name, action): + Execute(format("supervisorctl {action} storm-{component_name}"), + wait_for_finish=False + ) + +def supervisord_check_status(component_name): + try: + Execute(format("supervisorctl status storm-{component_name} | grep RUNNING")) + except Fail: + raise ComponentIsNotRunning() http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/ui_server.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/ui_server.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/ui_server.py new file mode 100644 index 0000000..6551067 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/scripts/ui_server.py @@ -0,0 +1,180 @@ +#!/usr/bin/env python +""" +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +""" + +import sys +from storm import storm +from service import service +from service_check import ServiceCheck +from resource_management.libraries.functions import check_process_status +from resource_management.libraries.script import Script +from resource_management.libraries.functions import conf_select +from resource_management.libraries.functions import stack_select +from resource_management.libraries.functions import format +from resource_management.core.resources.system import Link +from resource_management.core.resources.system import Execute +from resource_management.libraries.functions.stack_features import check_stack_feature +from resource_management.libraries.functions import StackFeature +from resource_management.libraries.functions.security_commons import build_expectations, \ + cached_kinit_executor, get_params_from_filesystem, validate_security_config_properties, \ + FILE_TYPE_JAAS_CONF +from setup_ranger_storm import setup_ranger_storm +from ambari_commons import OSConst +from ambari_commons.os_family_impl import OsFamilyImpl +from resource_management.core.resources.service import Service + + +class UiServer(Script): + + def get_component_name(self): + return "storm-client" + + def install(self, env): + self.install_packages(env) + self.configure(env) + + def configure(self, env): + import params + env.set_params(params) + storm("ui") + +@OsFamilyImpl(os_family=OSConst.WINSRV_FAMILY) +class UiServerWindows(UiServer): + def start(self, env): + import status_params + env.set_params(status_params) + self.configure(env) + Service(status_params.ui_win_service_name, action="start") + + def stop(self, env): + import status_params + env.set_params(status_params) + Service(status_params.ui_win_service_name, action="stop") + + def status(self, env): + import status_params + env.set_params(status_params) + from resource_management.libraries.functions.windows_service_utils import check_windows_service_status + check_windows_service_status(status_params.ui_win_service_name) + + +@OsFamilyImpl(os_family=OsFamilyImpl.DEFAULT) +class UiServerDefault(UiServer): + + def pre_upgrade_restart(self, env, upgrade_type=None): + import params + env.set_params(params) + if params.version and check_stack_feature(StackFeature.ROLLING_UPGRADE, params.version): + conf_select.select(params.stack_name, "storm", params.version) + stack_select.select("storm-client", params.version) + + def link_metrics_sink_jar(self): + # Add storm metrics reporter JAR to storm-ui-server classpath. + # Remove symlinks. They can be there, if you doing upgrade from HDP < 2.2 to HDP >= 2.2 + Link(format("{storm_lib_dir}/ambari-metrics-storm-sink.jar"), + action="delete") + # On old HDP 2.1 versions, this symlink may also exist and break EU to newer versions + Link("/usr/lib/storm/lib/ambari-metrics-storm-sink.jar", action="delete") + + Execute(format("{sudo} ln -s {metric_collector_sink_jar} {storm_lib_dir}/ambari-metrics-storm-sink.jar"), + not_if=format("ls {storm_lib_dir}/ambari-metrics-storm-sink.jar"), + only_if=format("ls {metric_collector_sink_jar}") + ) + + def start(self, env, upgrade_type=None): + import params + env.set_params(params) + self.configure(env) + self.link_metrics_sink_jar() + setup_ranger_storm(upgrade_type=upgrade_type) + service("ui", action="start") + + def stop(self, env, upgrade_type=None): + import params + env.set_params(params) + service("ui", action="stop") + + def status(self, env): + import status_params + env.set_params(status_params) + check_process_status(status_params.pid_ui) + + def security_status(self, env): + import status_params + + env.set_params(status_params) + + if status_params.security_enabled: + # Expect the following files to be available in status_params.config_dir: + # storm_jaas.conf + + try: + props_value_check = None + props_empty_check = ['storm_ui_principal_name', 'storm_ui_keytab'] + props_read_check = ['storm_ui_keytab'] + storm_env_expectations = build_expectations('storm_ui', props_value_check, props_empty_check, + props_read_check) + + storm_expectations = {} + storm_expectations.update(storm_env_expectations) + + security_params = {} + security_params['storm_ui'] = {} + security_params['storm_ui']['storm_ui_principal_name'] = status_params.storm_ui_principal + security_params['storm_ui']['storm_ui_keytab'] = status_params.storm_ui_keytab + + result_issues = validate_security_config_properties(security_params, storm_expectations) + if not result_issues: # If all validations passed successfully + # Double check the dict before calling execute + if ( 'storm_ui' not in security_params + or 'storm_ui_principal_name' not in security_params['storm_ui'] + or 'storm_ui_keytab' not in security_params['storm_ui']): + self.put_structured_out({"securityState": "ERROR"}) + self.put_structured_out({"securityIssuesFound": "Keytab file or principal are not set property."}) + return + + cached_kinit_executor(status_params.kinit_path_local, + status_params.storm_user, + security_params['storm_ui']['storm_ui_keytab'], + security_params['storm_ui']['storm_ui_principal_name'], + status_params.hostname, + status_params.tmp_dir) + self.put_structured_out({"securityState": "SECURED_KERBEROS"}) + else: + issues = [] + for cf in result_issues: + issues.append("Configuration file %s did not pass the validation. Reason: %s" % (cf, result_issues[cf])) + self.put_structured_out({"securityIssuesFound": ". ".join(issues)}) + self.put_structured_out({"securityState": "UNSECURED"}) + except Exception as e: + self.put_structured_out({"securityState": "ERROR"}) + self.put_structured_out({"securityStateErrorInfo": str(e)}) + else: + self.put_structured_out({"securityState": "UNSECURED"}) + + def get_log_folder(self): + import params + return params.log_dir + + def get_user(self): + import params + return params.storm_user + +if __name__ == "__main__": + UiServer().execute() http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/client_jaas.conf.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/client_jaas.conf.j2 b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/client_jaas.conf.j2 new file mode 100644 index 0000000..e8dc122 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/client_jaas.conf.j2 @@ -0,0 +1,24 @@ +{# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#} + +StormClient { + com.sun.security.auth.module.Krb5LoginModule required + useTicketCache=true + renewTicket=true + serviceName="{{nimbus_bare_jaas_principal}}"; +}; http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/config.yaml.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/config.yaml.j2 b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/config.yaml.j2 new file mode 100644 index 0000000..a9760cb --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/config.yaml.j2 @@ -0,0 +1,68 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +nimbusHost: {{nimbus_host}} +nimbusPort: {{nimbus_port}} + +# HTTP-specific options. +http: + + # The port on which the HTTP server listens for service requests. + port: {{rest_api_port}} + + # The port on which the HTTP server listens for administrative requests. + adminPort: {{rest_api_admin_port}} + +{% if ganglia_installed %} +enableGanglia: {{ganglia_installed}} + +# ganglia configuration (necessary if ganglia reporting is enabled) +ganglia: + + # how often to report to ganglia metrics (in seconds) + reportInterval: {{ganglia_report_interval}} + + # the hostname of the gmond server where storm cluster metrics will be sent + host: "{{ganglia_server}}" + + # address mode + # default is MULTICAST + addressMode: "UNICAST" + + # an <IP>:<HOSTNAME> pair to spoof + # this allows us to simulate storm cluster metrics coming from a specific host + #spoof: "192.168.1.1:storm" +{% endif %} + +{% if has_metric_collector and stack_supports_storm_ams %} +enableGanglia: False + +ganglia: + reportInterval: {{metric_collector_report_interval}} + +enableMetricsSink: True + +metrics_collector: + + reportInterval: {{metric_collector_report_interval}} + collector: "{{metric_collector_protocol}}://{{metric_collector_host}}:{{metric_collector_port}}" + appId: "{{metric_collector_app_id}}" + + # HTTPS settings + truststore.path : "{{metric_truststore_path}}" + truststore.type : "{{metric_truststore_type}}" + truststore.password : "{{metric_truststore_password}}" + +{% endif %} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/storm-metrics2.properties.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/storm-metrics2.properties.j2 b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/storm-metrics2.properties.j2 new file mode 100644 index 0000000..9acf173 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/storm-metrics2.properties.j2 @@ -0,0 +1,26 @@ +{# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#} + +collector={{metric_collector_protocol}}://{{metric_collector_host}}:{{metric_collector_port}} +maxRowCacheSize=10000 +sendInterval={{metrics_report_interval}}000 + +# HTTPS properties +truststore.path = {{metric_truststore_path}} +truststore.type = {{metric_truststore_type}} +truststore.password = {{metric_truststore_password}} http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/storm.conf.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/storm.conf.j2 b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/storm.conf.j2 new file mode 100644 index 0000000..82a26fe --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/storm.conf.j2 @@ -0,0 +1,35 @@ +{# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#} + +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +{{storm_user}} - nofile {{storm_user_nofile_limit}} +{{storm_user}} - nproc {{storm_user_nproc_limit}} http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/storm_jaas.conf.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/storm_jaas.conf.j2 b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/storm_jaas.conf.j2 new file mode 100644 index 0000000..8116492 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/storm_jaas.conf.j2 @@ -0,0 +1,57 @@ +{# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#} +{% if stack_supports_storm_kerberos %} +StormServer { + com.sun.security.auth.module.Krb5LoginModule required + useKeyTab=true + keyTab="{{nimbus_keytab_path}}" + storeKey=true + useTicketCache=false + principal="{{nimbus_jaas_principal}}"; +}; +StormClient { + com.sun.security.auth.module.Krb5LoginModule required + useKeyTab=true + keyTab="{{storm_keytab_path}}" + storeKey=true + useTicketCache=false + serviceName="{{nimbus_bare_jaas_principal}}" + principal="{{storm_jaas_principal}}"; +}; +{% endif %} +Client { + com.sun.security.auth.module.Krb5LoginModule required + useKeyTab=true + keyTab="{{storm_keytab_path}}" + storeKey=true + useTicketCache=false + serviceName="zookeeper" + principal="{{storm_jaas_principal}}"; +}; + +{% if kafka_bare_jaas_principal %} +KafkaClient { + com.sun.security.auth.module.Krb5LoginModule required + useKeyTab=true + keyTab="{{storm_keytab_path}}" + storeKey=true + useTicketCache=false + serviceName="{{kafka_bare_jaas_principal}}" + principal="{{storm_jaas_principal}}"; +}; +{% endif %} http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/worker-launcher.cfg.j2 ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/worker-launcher.cfg.j2 b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/worker-launcher.cfg.j2 new file mode 100644 index 0000000..2228601 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/package/templates/worker-launcher.cfg.j2 @@ -0,0 +1,19 @@ +{# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#} +storm.worker-launcher.group={{user_group}} +min.user.id={{min_user_ruid}} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.1/quicklinks/quicklinks.json ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1/quicklinks/quicklinks.json b/ambari-server/src/main/resources/common-services/STORM/0.9.1/quicklinks/quicklinks.json new file mode 100644 index 0000000..492f0a0 --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1/quicklinks/quicklinks.json @@ -0,0 +1,28 @@ +{ + "name": "default", + "description": "default quick links configuration", + "configuration": { + "protocol": + { + "type":"HTTP_ONLY" + }, + + "links": [ + { + "name": "storm_ui", + "label": "Storm UI", + "requires_user_name": "false", + "component_name": "STORM_UI_SERVER", + "url":"%@://%@:%@/", + "port":{ + "http_property": "ui.port", + "http_default_port": "8744", + "https_property": "ui.port", + "https_default_port": "8744", + "regex": "^(\\d+)$", + "site": "storm-site" + } + } + ] + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.3/configuration/ranger-storm-plugin-properties.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.3/configuration/ranger-storm-plugin-properties.xml b/ambari-server/src/main/resources/common-services/STORM/0.9.3/configuration/ranger-storm-plugin-properties.xml new file mode 100644 index 0000000..13acbff --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.3/configuration/ranger-storm-plugin-properties.xml @@ -0,0 +1,263 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--> +<configuration supports_final="true"> + + <property> + <name>policy_user</name> + <value>storm</value> + <display-name>Policy user for STORM</display-name> + <description>This user must be system user and also present at Ranger admin portal</description> + </property> + + <property> + <name>common.name.for.certificate</name> + <value></value> + <description>Common name for certificate, this value should match what is specified in repo within ranger admin</description> + <value-attributes> + <empty-value-valid>true</empty-value-valid> + </value-attributes> + </property> + + <property> + <name>ranger-storm-plugin-enabled</name> + <value>No</value> + <display-name>Enable Ranger for STORM</display-name> + <description>Enable ranger storm plugin ?</description> + <depends-on> + <property> + <type>ranger-env</type> + <name>ranger-storm-plugin-enabled</name> + </property> + </depends-on> + <value-attributes> + <type>boolean</type> + <overridable>false</overridable> + </value-attributes> + </property> + + <property> + <name>REPOSITORY_CONFIG_USERNAME</name> + <value>[email protected]</value> + <display-name>Ranger repository config user</display-name> + <description>Used for repository creation on ranger admin</description> + </property> + + <property> + <name>REPOSITORY_CONFIG_PASSWORD</name> + <value>stormtestuser</value> + <display-name>Ranger repository config password</display-name> + <property-type>PASSWORD</property-type> + <description>Used for repository creation on ranger admin</description> + <value-attributes> + <type>password</type> + </value-attributes> + </property> + + <property> + <name>XAAUDIT.DB.IS_ENABLED</name> + <value>true</value> + <display-name>Audit to DB</display-name> + <description></description> + <value-attributes> + <type>boolean</type> + </value-attributes> + <depends-on> + <property> + <type>ranger-env</type> + <name>xasecure.audit.destination.db</name> + </property> + </depends-on> + </property> + + <property> + <name>XAAUDIT.HDFS.IS_ENABLED</name> + <value>false</value> + <display-name>Audit to HDFS</display-name> + <description></description> + <value-attributes> + <type>boolean</type> + </value-attributes> + <depends-on> + <property> + <type>ranger-env</type> + <name>xasecure.audit.destination.hdfs</name> + </property> + </depends-on> + </property> + + <property> + <name>XAAUDIT.HDFS.DESTINATION_DIRECTORY</name> + <value>hdfs://localhost:8020/ranger/audit/%app-type%/%time:yyyyMMdd%</value> + <property-type>DONT_ADD_ON_UPGRADE</property-type> + <description></description> + <depends-on> + <property> + <type>ranger-env</type> + <name>xasecure.audit.destination.hdfs.dir</name> + </property> + </depends-on> + </property> + + <property> + <name>XAAUDIT.HDFS.LOCAL_BUFFER_DIRECTORY</name> + <value>__REPLACE__LOG_DIR/hadoop/%app-type%/audit</value> + <description></description> + </property> + + <property> + <name>XAAUDIT.HDFS.LOCAL_ARCHIVE_DIRECTORY</name> + <value>__REPLACE__LOG_DIR/hadoop/%app-type%/audit/archive</value> + <description></description> + </property> + + <property> + <name>XAAUDIT.HDFS.DESTINTATION_FILE</name> + <value>%hostname%-audit.log</value> + <description></description> + </property> + + <property> + <name>XAAUDIT.HDFS.DESTINTATION_FLUSH_INTERVAL_SECONDS</name> + <value>900</value> + <description></description> + </property> + + <property> + <name>XAAUDIT.HDFS.DESTINTATION_ROLLOVER_INTERVAL_SECONDS</name> + <value>86400</value> + <description></description> + </property> + + <property> + <name>XAAUDIT.HDFS.DESTINTATION_OPEN_RETRY_INTERVAL_SECONDS</name> + <value>60</value> + <description></description> + </property> + + <property> + <name>XAAUDIT.HDFS.LOCAL_BUFFER_FILE</name> + <value>%time:yyyyMMdd-HHmm.ss%.log</value> + <description></description> + </property> + + <property> + <name>XAAUDIT.HDFS.LOCAL_BUFFER_FLUSH_INTERVAL_SECONDS</name> + <value>60</value> + <description></description> + </property> + + <property> + <name>XAAUDIT.HDFS.LOCAL_BUFFER_ROLLOVER_INTERVAL_SECONDS</name> + <value>600</value> + <description></description> + </property> + + <property> + <name>XAAUDIT.HDFS.LOCAL_ARCHIVE_MAX_FILE_COUNT</name> + <value>10</value> + <description></description> + <value-attributes> + <type>password</type> + </value-attributes> + </property> + + <property> + <name>SSL_KEYSTORE_FILE_PATH</name> + <value>/etc/hadoop/conf/ranger-plugin-keystore.jks</value> + <description></description> + </property> + + <property> + <name>SSL_KEYSTORE_PASSWORD</name> + <value>myKeyFilePassword</value> + <property-type>PASSWORD</property-type> + <description></description> + </property> + + <property> + <name>SSL_TRUSTSTORE_FILE_PATH</name> + <value>/etc/hadoop/conf/ranger-plugin-truststore.jks</value> + <description></description> + </property> + + <property> + <name>SSL_TRUSTSTORE_PASSWORD</name> + <value>changeit</value> + <property-type>PASSWORD</property-type> + <description></description> + <value-attributes> + <type>password</type> + </value-attributes> + </property> + + <property> + <name>POLICY_MGR_URL</name> + <value>{{policymgr_mgr_url}}</value> + <description>Policy Manager url</description> + </property> + + <property> + <name>SQL_CONNECTOR_JAR</name> + <value>{{sql_connector_jar}}</value> + <description>Location of DB client library (please check the location of the jar file)</description> + </property> + + <property> + <name>XAAUDIT.DB.FLAVOUR</name> + <value>{{xa_audit_db_flavor}}</value> + <description>The database type to be used (mysql/oracle)</description> + </property> + + <property> + <name>XAAUDIT.DB.DATABASE_NAME</name> + <value>{{xa_audit_db_name}}</value> + <description>Audit database name</description> + </property> + + <property> + <name>XAAUDIT.DB.USER_NAME</name> + <value>{{xa_audit_db_user}}</value> + <description>Audit database user</description> + </property> + + <property> + <name>XAAUDIT.DB.PASSWORD</name> + <value>{{xa_audit_db_password}}</value> + <property-type>PASSWORD</property-type> + <description>Audit database password</description> + <value-attributes> + <type>password</type> + </value-attributes> + </property> + + <property> + <name>XAAUDIT.DB.HOSTNAME</name> + <value>{{xa_db_host}}</value> + <description>Audit database hostname</description> + </property> + + <property> + <name>REPOSITORY_NAME</name> + <value>{{repo_name}}</value> + <description>Ranger repository name</description> + </property> + +</configuration> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/f1c7514d/ambari-server/src/main/resources/common-services/STORM/0.9.3/configuration/storm-env.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.3/configuration/storm-env.xml b/ambari-server/src/main/resources/common-services/STORM/0.9.3/configuration/storm-env.xml new file mode 100644 index 0000000..26568ef --- /dev/null +++ b/ambari-server/src/main/resources/common-services/STORM/0.9.3/configuration/storm-env.xml @@ -0,0 +1,43 @@ +<?xml version="1.0"?> +<?xml-stylesheet type="text/xsl" href="configuration.xsl"?> +<!-- +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +--> + +<configuration supports_adding_forbidden="true"> + <!-- storm-env.sh --> + <property> + <name>content</name> + <description>This is the jinja template for storm-env.sh file</description> + <value> +#!/bin/bash + +# Set Storm specific environment variables here. + +# The java implementation to use. +export JAVA_HOME={{java64_home}} + +export STORM_CONF_DIR={{conf_dir}} +export STORM_HOME={{storm_component_home_dir}} + </value> + <value-attributes> + <type>content</type> + </value-attributes> + </property> +</configuration>
