Skip to main content
alialghamdi
Silver ⭐️⭐️
Dec 31, 2019 1:06 PM UTC
Solved

Heartbeat works, but when I start services I get "'Host_Level_Params for cluster_id=2 is missing. Check if server sent it.'"

So I have had this issue for a quite long time so far, and it's been really challenging. 

 

So, on one of the servers (secondary namenode) of a 12 node development cluster, the heartbeat is being sent and received. The IDs of each heartbeat request are incremental, which I believe means it's working fine from ambari-agent aspect.

 

I have SNameNode, HiveServer and other services on that server, and whenever I try to start any of them I get this directly from Ambari UI

 

Caught an exception while executing custom service command: <type 'exceptions.KeyError'>: 'Host_Level_Params for cluster_id=2 is missing. Check if server sent it.'; 'Host_Level_Params for cluster_id=2 is missing. Check if server sent it.'

 

I'm not able to start no slave or master services on that server AT ALL. 

 

I don't see anything in the logs to be honest that could point me to a direction. 

 

Few information of the environment:

1- Redhat 7.7 servers

2- Latest JDK 8 231

3- HDP 3.1.0.0 so Ambari 2.7.3.0

 

Your help is appreciated. 

Shelton
SheltonAnswer
Gold ⭐️⭐️⭐️
Jan 1, 2020 12:16 PM UTC

@alialghamdi 

 

Your issue is being generated by the python script

/usr/lib/ambari-agent/lib/ambari_agent/ConfigurationBuilder.py

see line  38 "host_level_params_cache = self.host_level_params_cache[cluster_id"

 

Solution 1 on node 6 

Delete the tmp files to empty the cache on node 6 after stopping the ambari-agent

node6 # ambari-agent stop

node6 # rm -rf /var/lib/ambari-agent/*

Then restart the ambari-agent on host 6

node6 # ambari-agent start


Solution 2  on node 6 

 

node6 # ambari-agent stop

yum erase ambari-agent

rm -rf /var/lib/ambari-agent
rm -rf /var/run/ambari-agent
rm -rf /usr/lib/amrbari-agent
rm -rf /etc/ambari-agent
rm -rf /var/log/ambari-agent
rm -rf /usr/lib/python2.6/site-packages/ambari*

 

Re-install of Ambari Agent

yum install ambari-agent

# Change hostname to point to the Ambari Server
vi /etc/ambari-agent/conf/ambari-agent.ini

Start the ambari-agent agent

# ambari-agent start

 

Please revert

 

4 replies

Shelton
Gold ⭐️⭐️⭐️
Jan 1, 2020 3:57 AM UTC

@alialghamdi 

I have an idea, depending on your backend Ambari database please first do a backup. We are not going to do any changes yet but validate my suspicion

DB backup
Assuming you are on MySQL /MariaDB 
mysqldump –u[user name] –p[password] [database name] > [dump file]

 

Check cluster state

select * from clusterstate;

 

The value found above should be there in Stage table's "cluster_id" columns

select stage_id, request_id, cluster_id from stage;


Identify troublesome host

select host_id,host_name from hosts;

 

Assuming you got host id 3 for the troublesome host

 

select cluster_id,component_name from hostcomponentdesiredstate where host_id=3;

select cluster_id,component_name from hostcomponentstate where host_id=3;

select cluster_id,service_name from hostconfigmapping where host_id=3;

 

Share your output for all the above steps, please tokenize your hostname.domain

Translate
alialghamdi
Silver ⭐️⭐️
Jan 1, 2020 4:33 AM UTC

Thanks Shelton for answering, 

 

It's a postgres database, I did the backup with pg_dump

 

As for the queries:

 

ambari=> select * from clusterstate;
cluster_id | current_cluster_state | current_stack_id
------------+-----------------------+------------------
2 | | 101
(1 row)

 

 

As for this

select stage_id, request_id, cluster_id from stage;

Most of the entries have cluster_id 2, but I see entries with cluster_id -1

 

As for the host_id of the troublesome host is 6

(I just notice there are 13 hosts, while I have only 12. The 13th is basically host 6 but with a different extension, like if host 6 is host1.xyz the 13th is host1.xyz.com)

 

As for the remaining 

 

ambari=> select cluster_id,component_name from hostcomponentdesiredstate where host_id=6;
cluster_id | component_name
------------+-------------------------
2 | ZOOKEEPER_SERVER
2 | INFRA_SOLR
2 | SPARK2_JOBHISTORYSERVER
2 | LIVY2_SERVER
2 | SPARK2_THRIFTSERVER
2 | HDFS_CLIENT
2 | LOGSEARCH_LOGFEEDER
2 | SECONDARY_NAMENODE
2 | HIVE_METASTORE
2 | HIVE_CLIENT
2 | HIVE_SERVER
2 | METRICS_MONITOR
2 | PIG
2 | ZOOKEEPER_CLIENT
2 | INFRA_SOLR_CLIENT
2 | SQOOP
2 | RANGER_ADMIN
2 | RANGER_KMS_SERVER
2 | SPARK2_CLIENT
2 | RANGER_USERSYNC
2 | HBASE_CLIENT
2 | YARN_CLIENT
2 | TEZ_CLIENT
2 | MAPREDUCE2_CLIENT
(24 rows)

 

 

And also

 

 

ambari=> select cluster_id,component_name from hostcomponentstate where host_id=6;
cluster_id | component_name
------------+-------------------------
2 | YARN_CLIENT
2 | LOGSEARCH_LOGFEEDER
2 | SECONDARY_NAMENODE
2 | INFRA_SOLR
2 | HIVE_SERVER
2 | HIVE_METASTORE
2 | RANGER_USERSYNC
2 | HBASE_CLIENT
2 | ZOOKEEPER_SERVER
2 | RANGER_ADMIN
2 | SPARK2_THRIFTSERVER
2 | HDFS_CLIENT
2 | LIVY2_SERVER
2 | SPARK2_JOBHISTORYSERVER
2 | RANGER_KMS_SERVER
2 | MAPREDUCE2_CLIENT
2 | TEZ_CLIENT
2 | PIG
2 | HIVE_CLIENT
2 | ZOOKEEPER_CLIENT
2 | METRICS_MONITOR
2 | INFRA_SOLR_CLIENT
2 | SPARK2_CLIENT
2 | SQOOP

 

 

Finally, 

 

 

ambari=> select cluster_id,service_name from hostconfigmapping where host_id=6;
cluster_id | service_name
------------+--------------
(0 rows)

 

 

For the above, I checked all my host_ids none of them have any rows. 

 

Many thanks for your help!

Translate
Shelton
SheltonAnswer
Gold ⭐️⭐️⭐️
Jan 1, 2020 12:16 PM UTC

@alialghamdi 

 

Your issue is being generated by the python script

/usr/lib/ambari-agent/lib/ambari_agent/ConfigurationBuilder.py

see line  38 "host_level_params_cache = self.host_level_params_cache[cluster_id"

 

Solution 1 on node 6 

Delete the tmp files to empty the cache on node 6 after stopping the ambari-agent

node6 # ambari-agent stop

node6 # rm -rf /var/lib/ambari-agent/*

Then restart the ambari-agent on host 6

node6 # ambari-agent start


Solution 2  on node 6 

 

node6 # ambari-agent stop

yum erase ambari-agent

rm -rf /var/lib/ambari-agent
rm -rf /var/run/ambari-agent
rm -rf /usr/lib/amrbari-agent
rm -rf /etc/ambari-agent
rm -rf /var/log/ambari-agent
rm -rf /usr/lib/python2.6/site-packages/ambari*

 

Re-install of Ambari Agent

yum install ambari-agent

# Change hostname to point to the Ambari Server
vi /etc/ambari-agent/conf/ambari-agent.ini

Start the ambari-agent agent

# ambari-agent start

 

Please revert

 

Translate