DCNM Vacuum and Autovacuum Postgres Databases

This chapter describes how to vacuum the postgres database in Microsoft Windows and Linux.

This chapter includes the following sections:

Background Information

It is absolutely critical to vacuum postgres databases in order for the databases to properly function. Through the life of the database, new entries are added and current entries are updated. By design, postgres does not immediately remove the iterations of a record as it gets updated. Therefore, postgres databases can contain a large number of stale, unused records. These old records should be removed at least every two weeks with the vacuum function in order to reduce disk usage and improve the speed of database queries. It is even more effective if you configure postgres to automatically vacuum the database without the need to stop the Data Center Network Manager (DCNM) services.

note.gif

Noteblank.gif $INSTALLDIR throughout this article refers to "C:\Program Files\Cisco Systems\" or "/usr/local/cisco/" based on the operating system, Microsoft Windows or Linux respectively. The install path could be changed from these defaults during installation.


Vacuum DCNM's Postgresql Database in Windows


Step 1blank.gif Stop the DCNM services by clicking Stop DCNM Servers button, or enter the command as below:

$INSTALLDIR/dcm/dcnm/bin/stopLANSANserver.bat

Step 2blank.gif Obtain the database name, username, and password. Locate the postgresql.cfg.xml file on the DCNM server.

  • In DCNM Version 6.2.x, enter:

$INSTALLDIR/dcm/jboss-4.2.2.GA/server/dcnm/conf/database/postgresql.cfg.xml

  • In DCNM Version 6.3.x, enter:

$INSTALLDIR/dcm/Jboss-as-7.2.0.Final/standalone/conf/postgresql.cfg.xml

Step 3blank.gif Open PgAdmin III.exe, which is a helpful GUI for the postgres database. Then, right-click the object in the list and connect to the database. Enter the password from Step 2 here.

Step 4blank.gif Navigate through the drop-down menus to the dcmdb database.

Step 5blank.gif Right-click dcmdb and select Maintenance. Select the Vacuum, Full, Analyze, and Verbose options in the Maintain Database dcmdb dialog box.

note.gif

Noteblank.gif The vacuum operation usually completes within an hour, but can take much longer for larger databases. Remember to restart the DCNM services.



 

Vacuum DCNM's Postgresql Database in Linux


Step 1blank.gif Stop dcnm by using the appmgr stop dcnm command.

Step 2blank.gif Open the psql prompt:

./usr/local/cisco/dcm/db/bin/psql -U <dbUsername> dcmdb

Step 3blank.gif Run the database vacuum and quit:

dcmdb=> VACUUM FULL ANALYZE VERBOSE;

Many pages of output pass on the screen. The vacuum is finished when you see a message similar to this one:

Current limits are: 532000 page slots, 1000 relations, using 3182 kB.

VACUUM

dcmdb=>

dcmdb=> \q

The previous command exits the sql prompt.

Step 4blank.gif Start DCNM services by using the appmgr start dcnm command.