You can use the dbpurger
command to connect to your metrics database
and to purge old data. This command also enables you to retain a specified amount
of data, and to archive all data.
For details on configuring the connection to your metrics database, see the API Gateway Installation Guide.
You can run the dbpurger
command from the following directory:
Command options
You can specify the following options to the dbpurger
command:
Option | Description |
---|---|
-h, --help |
Displays help message and exits. |
-p PASSPHRASE, --passphrase=PASSPHRASE |
Specifies the configuration passphrase (leave blank for zero length). |
--dbname=DBNAME |
Specifies the database name (mutually exclusive with dburl ,
dbuser , and dbpass options).
|
--dburl=DBURL |
Specifies the database URL. |
--dbuser=DBUSER |
Specifies the database user. |
--dbpass=DBPASS |
Specifies the database passphrase. |
--archive |
Archive all data. |
--out=OUT |
Archive all data in the specified directory. |
--purge |
Purge data from the database. You must also specify the
--retain option.
|
--retain=RETAIN |
Specifies the amount of data to retain (for example,
30days , 1month , or 1year ).
You must specify this option with the --retain option.
|
This section shows examples of running dbpurger
in default interactive
mode and of specifying command-line options.
Running dbpurger in interactive mode
The following example shows the output when running the dbpurger
command
in interactive mode. This example archives all data, retains three months of data, and
purges older data from the database:
>dbpurger Choosing: Default Database Connection Archive database (Y, N) [N]: y Archive path [./archive]: Purge an amount of data from the database (Y, N) [N]: y Amount of data to retain (e.g. 1year, 3months, 7days) [3months]: Wrote archive: .\archive\process_groups.xml Wrote archive: .\archive\processes.xml Wrote archive: .\archive\metric_types.xml Wrote archive: .\archive\audit_log_sign.xml Wrote archive: .\archive\time_window_types.xml Wrote archive: .\archive\audit_log_points.xml Wrote archive: .\archive\audit_message_payload.xml Wrote archive: .\archive\transaction_data.xml Wrote archive: .\archive\metric_groups.xml Wrote archive: .\archive\metric_group_types.xml Wrote archive: .\archive\metrics_alerts.xml Wrote archive: .\archive\metrics_data.xml Purging data older than: Wed Jun 27 15:26:00 BST 2012 Purging table: audit_log_sign... deleted 0 rows Purging table: transaction_data... deleted 0 rows Purging table: audit_message_payload... deleted 7 rows Purging table: audit_log_points... deleted 16 rows Purging table: metrics_alerts... deleted 4 rows Purging table: metrics_data... deleted 703 rows
Specify command-line options to dbpurger
The following example shows the output when specifying options the dbpurger
command. This example retains 30 days of data, and purges older data from the database:
dbpurger.bat --dburl=jdbc:mysql://127.0.0.1:3306/reports --dbuser=root --dbpass=fred --purge --retain=30days
Note | |
---|---|
You can run dbpurger.bat --dbname="Default Database Connection" --archive --out=archive.dat
|