Member since
04-01-2020
1
Post
0
Kudos Received
0
Solutions
01-27-2021
11:17 AM
It is not recommended to update ambari DB directly but as in this case the cmd 'ambari-server update-host-names host_names_changes.json' is not a much help, we can perform below actions by taking ambari DB back up. I tested and it worked. Note: Please take DB backup! and PLEASE only do at your own risk. In this case, the new host_name is ambarinn.cluster.com and new name is ambarinn261.cluster.com We need to concentrate on the host_name that says healthStatus":"UNKNOWN". Steps to resolve: ambari-agent and ambari-server successfully stopped [root@ambarinn261 ~]# su - postgres Last login: Wed Jan 27 13:14:40 EST 2021 on pts/0 -bash-4.2$ psql psql (9.2.24) Type "help" for help. postgres=# \c ambari You are now connected to database "ambari" as user "postgres". ambari=# select host_id,host_name,discovery_status,last_registration_time,public_host_name from ambari.hosts; host_id | host_name | discovery_status | last_registration_time | public_host_name ---------+-------------------------+------------------+------------------------+------------------------- 201 | ambarinn261.cluster.com | | 1611772466200 | ambarinn261.cluster.com 1 | ambarinn.cluster.com | | 1611768543457 | ambarinn.cluster.com (2 rows) ambari=# select * from ambari.hoststate; agent_version | available_mem | current_state | health_status | host_id | time_in_state | maintenance_state -----------------------+---------------+---------------+----------------------------------------------+---------+---------------+------------------- {"version":"2.6.1.5"} | 279948 | INIT | {"healthStatus":"HEALTHY","healthReport":""} | 201 | 1611772466200 | {"version":"2.6.1.5"} | 2120176 | INIT | {"healthStatus":"UNKNOWN","healthReport":""} | 1 | 1611768543457 | (2 rows) ambari=# UPDATE ambari.hosts SET host_name='ambarinn261.cluster.com' WHERE host_id=1; ERROR: duplicate key value violates unique constraint "uq_hosts_host_name" DETAIL: Key (host_name)=(ambarinn261.cluster.com) already exists. ambari=# UPDATE ambari.hosts SET public_host_name='ambarinn261.cluster.com' WHERE host_id=1; UPDATE 1 ambari=# UPDATE ambari.hosts SET public_host_name='ambarinn261a.cluster.com' WHERE host_id=201; UPDATE 1 ambari=# UPDATE ambari.hosts SET host_name='ambarinn261a.cluster.com' WHERE host_id=201; UPDATE 1 ambari=# UPDATE ambari.hosts SET host_name='ambarinn261.cluster.com' WHERE host_id=1; UPDATE 1 ambari=# \q -bash-4.2$ exit logout [root@ambarinn261 ~]# ambari-server start
... View more