diff --git a/sahara/plugins/cdh/cloudera_utils.py b/sahara/plugins/cdh/cloudera_utils.py index 7ce41ae2ba..78622eac7a 100644 --- a/sahara/plugins/cdh/cloudera_utils.py +++ b/sahara/plugins/cdh/cloudera_utils.py @@ -286,6 +286,29 @@ class ClouderaUtils(object): role.update_config(self._get_configs(process, cluster, instance=instance)) + @cloudera_cmd + def restart_service(self, process, instance): + service = self.get_service_by_role(process, instance=instance) + yield service.restart() + + def update_role_config(self, instance, process): + process = self.pu.convert_role_showname(process) + service = self.get_service_by_role(process, instance=instance) + api = self.get_api_client(instance.cluster) + hosts = api.get_all_hosts(view='full') + ihost_id = None + for host in hosts: + if instance.fqdn() == host.hostname: + ihost_id = host.hostId + break + role_type = self.get_role_type(process) + roles = service.get_roles_by_type(role_type) + for role in roles: + if role.hostRef.hostId == ihost_id: + role.update_config( + self._get_configs(role_type, instance=instance)) + self.restart_service(process, instance) + def get_cloudera_manager_info(self, cluster): mng = self.pu.get_manager(cluster) info = { diff --git a/sahara/plugins/cdh/v5_4_0/cloudera_utils.py b/sahara/plugins/cdh/v5_4_0/cloudera_utils.py index 40092d545d..53e7770942 100644 --- a/sahara/plugins/cdh/v5_4_0/cloudera_utils.py +++ b/sahara/plugins/cdh/v5_4_0/cloudera_utils.py @@ -371,6 +371,8 @@ class ClouderaUtilsV540(cu.ClouderaUtils): all_confs = s_cfg.merge_configs(all_confs, cluster.cluster_configs) if instance: + snt_count = self.validator._get_inst_count(instance.cluster, + 'SENTRY_SERVER') paths = instance.storage_paths() instance_default_confs = { diff --git a/sahara/plugins/cdh/v5_4_0/deploy.py b/sahara/plugins/cdh/v5_4_0/deploy.py index d91b59e891..70f6248c70 100644 --- a/sahara/plugins/cdh/v5_4_0/deploy.py +++ b/sahara/plugins/cdh/v5_4_0/deploy.py @@ -168,9 +168,14 @@ def start_cluster(cluster): if len(CU.pu.get_jns(cluster)) > 0: CU.enable_namenode_ha(cluster) + # updating configs for NameNode role on needed nodes + CU.update_role_config(CU.pu.get_secondarynamenode(cluster), + 'HDFS_NAMENODE') if CU.pu.get_stdb_rm(cluster): CU.enable_resourcemanager_ha(cluster) + # updating configs for ResourceManager role on needed nodes + CU.update_role_config(CU.pu.get_stdb_rm(cluster), 'YARN_STANDBYRM') _finish_cluster_starting(cluster) diff --git a/sahara/plugins/cdh/v5_5_0/cloudera_utils.py b/sahara/plugins/cdh/v5_5_0/cloudera_utils.py index 1c10a2a414..c6dac556df 100644 --- a/sahara/plugins/cdh/v5_5_0/cloudera_utils.py +++ b/sahara/plugins/cdh/v5_5_0/cloudera_utils.py @@ -371,6 +371,8 @@ class ClouderaUtilsV550(cu.ClouderaUtils): all_confs = s_cfg.merge_configs(all_confs, cluster.cluster_configs) if instance: + snt_count = self.validator._get_inst_count(instance.cluster, + 'SENTRY_SERVER') paths = instance.storage_paths() instance_default_confs = { diff --git a/sahara/plugins/cdh/v5_5_0/deploy.py b/sahara/plugins/cdh/v5_5_0/deploy.py index 6e572d2ec8..ed927b7a8a 100644 --- a/sahara/plugins/cdh/v5_5_0/deploy.py +++ b/sahara/plugins/cdh/v5_5_0/deploy.py @@ -168,9 +168,14 @@ def start_cluster(cluster): if len(CU.pu.get_jns(cluster)) > 0: CU.enable_namenode_ha(cluster) + # updating configs for NameNode role on needed nodes + CU.update_role_config(CU.pu.get_secondarynamenode(cluster), + 'HDFS_NAMENODE') if CU.pu.get_stdb_rm(cluster): CU.enable_resourcemanager_ha(cluster) + # updating configs for ResourceManager on needed nodes + CU.update_role_config(CU.pu.get_stdb_rm(cluster), 'YARN_STANDBYRM') _finish_cluster_starting(cluster)