Following are the steps to configure vCenter Server:
1. Connect to your vCenter via SSH or complete all steps from the KVM console.
2. Create a script to clean up the database:
vim /root/cleanup.sql
and add the following text:
DO
$$
DECLARE
rec record;
BEGIN
FOR rec IN
SELECT *
FROM pg_tables
WHERE tablename ~ '^vpx_event_[0-9].*'
ORDER BY tablename
LOOP
EXECUTE 'TRUNCATE TABLE '
|| quote_ident(rec.schemaname) || '.'
|| quote_ident(rec.tablename) || ' CASCADE';
END LOOP;
END$$;
DO
$$
DECLARE
rec record;
BEGIN
FOR rec IN
SELECT *
FROM pg_tables
WHERE tablename ~ '^vpx_event_arg_[0-9].*'
ORDER BY tablename
LOOP
EXECUTE 'TRUNCATE TABLE '
|| quote_ident(rec.schemaname) || '.'
|| quote_ident(rec.tablename) || ' CASCADE';
END LOOP;
END$$;
3. Create a script to run monthly cleanup:
vim /etc/cron.monthly/dbcleanup
and add the following text:
4. Change the permissions so that "cron" can run your procedure correctly:
chmod 700 /etc/cron.monthly/dbcleanup
5. If necessary, initiate the cleanup by executing the script manual:
/etc/cron.monthly/dbcleanup
Also make sure that the "root" user does not have an expired password. It is best to connect to the vCenter on port 5480 with a web browser and set the "Password expires" setting to "No".
No comments:
Post a Comment