VCSA database storage /storage/db is full or nearly full (51981)
Last Updated: 2021/2/9Categories: TroubleshootingTotal Views: 249806Language:subscribe
Symptoms
PurposeThis article provides steps to allow the application to continue to function while giving steps to allow reduce the footprint of the database on disk.
Cause
Most likely the database is holding redundant data. The redundant data that the database is holding is referred to as bloat.
Bloat can be caused by a variety of reasons:
- Bugs in applications which connect to the database
- Long running idle transactions
- Internal database processes not aggressive enough to do database housekeeping.
- VCSA OS has lost control of the thread of the automatic database clean-up utility process
Impact / Risks
The required service vmware-vpxd will not start and VCSA will be inaccessible through the client.
Resolution
- Reboot the vCenter Server
This will resolve any problem with lost process threads.
- Note the percentage space full you saw when running df -h from the command line.
- Find if the VCSA virtual machine is managed through another vCenter Server. If the vCenter Server is on a host in the cluster find which ESXi host manages the vCenter Server virtual machine. Access the host client by opening a web browser tab to the host web client at https://<host IP or FQDN>.
- Open a console window to the VCSA VM.
- Select to shut down the guest operating system. Do not power off.
- After reboot wait 30 minutes then run df -h again to check the space available.
- If space free is not any better than before, continue with the steps below.
- Resolving a completely full partitition
- If the database disk is 100% full you will have to extend it. The cleanup utility does need some space as overhead to function. Increase the disk size and extend the partition that’s full on the df -h output.
- To increase the disk size, see Increasing the disk space for the VMware vCenter Server Appliance in vSphere 6.5, 6.7 and 7.0
- Check for bloat
- Download the script attached to this KB 51981_check_bloat.sql
- Connect to the DB: /opt/vmware/vpostgres/current/bin/psql -U postgres -d VCDB
- Copy and paste the content of the file and hit enter.
- Check the results. If the tbloat column or the ibloat column are >25 then schedule maintenance to reduce the bloat in this database.
Note: This query looks at table , index structure, and the number of rows in a table, and estimates the minimum size required to hold that data. It then compares this estimate to the actual current size, to estimate bloat.
- Remove the bloat
- Stop all the services:
service-control –stop –all
- Run the below command to start the vpostgres:
service-control –start vmware-vpostgres
- Run the command to connect to postgres service:
/opt/vmware/vpostgres/current/bin/psql -U postgres -d VCDB
- To rebuild all the tables and indexes on the database:
vacuum full; Note: This command will remove all bloat.
- To collect new statistics for the planner to use for optimal performance
vacuum analyze;
- To quit from the path:
\q
- Run the command to start all the service:
service-control –start –all