Fix staled configs for ha deployments

After the successful deployment of cluster
with HA node configs and cluster configs will not
be updated successfully. This change will repair that.

Change-Id: I8c69171fe3343bd90c4ead9636c7ce70d90702c7
Closes-bug: 1556064
This commit is contained in:
Vitaly Gridnev 2016-03-14 17:25:46 +03:00
parent fc7edcf61d
commit 57fbc61285
5 changed files with 37 additions and 0 deletions

View File

@ -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 = {

View File

@ -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 = {

View File

@ -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)

View File

@ -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 = {

View File

@ -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)