To reduce performance
degradation, use an Ambari server CLI command to automate removal of historical records from
the Ambari server database.
After months of operating a larger cluster, an Ambari server
may begin to accrue a large amount of historical data in its database. Data accrual can
cause UI performance degradation.The db-purge-history command takes two
arguments, the name of the cluster, and the date of the earliest record to purge. The
following example steps demonstrate purging history records created before August 1st, 2017
for the cluster named [PROD].-
Stop the Ambari Server by using ambari-server
stop.
# ambari-server stop
Using python /usr/bin/python
Stopping ambari-server
Waiting for server stop
Ambari Server stopped
-
Run db-purge-history .
# ambari-server db-purge-history --cluster-name [PROD] --from-date 2017-08-01
Using python /usr/bin/python
Purge database history...
Ambari Server configured for Embedded Postgres. Confirm you have made a backup of the Ambari Server database [y/n] y
Ambari server is using db type Embedded Postgres. Cleanable database entries older than 2017-08-01 will be purged. Proceed [y/n] y
Purging historical data from the database ...
Purging historical data completed. Check the ambari-server.log for details.
Ambari Server 'db-purge-history' completed successfully.
-
Start the Ambari Server: by using ambari-server
start .
# ambari-server start
Using python /usr/bin/python
Starting ambari-server
Ambari Server running with administrator privileges.
Organizing resource files at /var/lib/ambari-server/resources...
Ambari database consistency check started...
Server PID at: /var/run/ambari-server/ambari-server.pid
Server out at: /var/log/ambari-server/ambari-server.out
Server log at: /var/log/ambari-server/ambari-server.log
Waiting for server start........................
Server started listening on 8080
DB configs consistency check: no errors and warnings were found.
Ambari Server 'start' completed successfully.
The db-purge-history command analyzes tables in the Ambari Server database and removes those
rows that can be deleted which have a --create-date after the --from-date specified when
the command runs. In this example, the rows deleted would be:
- AlertCurrent
- AlertNotice
- ExecutionCommand
- HostRoleCommand
- Request
- RequestOperationLevel
- RequestResourceFilter
- RoleSuccessCriteria
- Stage
- TopologyHostRequest
- TopologyHostTask
- TopologyLogicalTask