Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!
Labels (1)
avatar
Expert Contributor

Ambari database cleanup - Speed up

ambari-server db-cleanup -d 2016-09-30 --cluster-name=TESTHDP

I have ran this on a ambari database used by on one of the 500 node cluster HDP cluster. It ran for more than 15 hours but without any success. I analyzed the ambari server logs to check where it is taking most of the time, it seems to be spending more time on batch deletes on ambari.alert_notice, ambari.alert_current ,ambari.alert_history table.

To improve the performance of the db cleanup, I have created the index on the ambari.alert_notice table..

-bash-4.1$ psql -U ambari -d ambari 
Password for user ambari: 
psql (8.4.20)
Type "help" for help.
ambari=> CREATE INDEX alert_notice_idx ON ambari.alert_notice(history_id);

After this i ran re-loaded my ambari database from the backup and ran the db-cleanup, it took only less than 2 min to complete the cleanup.

Also to reclaim the disk space and reindex after the cleanup, i ran the following commands as super user "postgres"

Vacuum full;
reindex database ambari;

.


5,127 Views
Comments
avatar
Master Mentor

@Rajesh

Wonderful article. Just added code block for the commands.

avatar
Expert Contributor

@Jay SenSharma - Thanks

avatar

This is wonderful!

Version history
Last update:
‎08-28-2017 06:29 AM
Updated by:
Contributors