1

whats the best practice for this?

sure i can delete the config, but i also want the client out of the clients-table within the databasebackend of the server.

should i delete from the database ? (in my case mysql) (but shouldn't bacula handle this somehow)

dpkg -l | grep bacula
ii  bacula-common                                          5.0.2-2.2+squeeze1             network backup, rec                         overy and verification - common support files
ii  bacula-common-pgsql                                    5.0.2-2.2+squeeze1             network backup, rec                         overy and verification - PostgreSQL common files
ii  bacula-console                                         5.0.2-2.2+squeeze1             network backup, rec                         overy and verification - text console
ii  bacula-console-qt                                      5.0.2-2.2+squeeze1             Bacula Administrati                         on Tool Console
ii  bacula-director-common                                 5.0.2-2.2+squeeze1             network backup, rec                         overy and verification - Director common files
ii  bacula-director-pgsql                                  5.0.2-2.2+squeeze1             network backup, rec                         overy and verification - PostgreSQL storage for Director
ii  bacula-fd                                              5.0.2-2.2+squeeze1             network backup, rec                         overy and verification - file daemon
ii  bacula-sd                                              5.0.2-2.2+squeeze1             network backup, rec                         overy and verification - storage daemon
ii  bacula-sd-pgsql                                        5.0.2-2.2+squeeze1             network backup, rec                         overy and verification - PostgreSQL SD tools

2 Answers 2

2

dbcheck tool can remove obsolete Client records, among other things. Shut down the director before you run it.

Simply use the option

12) Eliminate orphaned Client records
5
  • Is there something similar available for postgres databases? Nov 24, 2015 at 20:06
  • what kind of something do you have in mind? Nov 25, 2015 at 6:17
  • Cleaning up clients from the database. One thing I find is in our server environment is people will stand up test servers quickly, but turn off there backup. Because I no longer need these backups, I want to clean them out of the database [because there are now more deleted servers in my web console interface than not.. I found dbcheck is a Bacula binary and I was concerned it was only for mysql. I'll include this step to be run periodically. Nov 26, 2015 at 2:01
  • Not sure I understand the scope of your question, it appears to be related Postgres backups, not Bacula backups? Nov 26, 2015 at 20:04
  • dbcheck won't remove clients from the database that have been removed from the configuration. what it does is essentially this: DELETE FROM Client WHERE ClientId NOT IN (SELECT DISTINCT ClientId FROM Job);, ie. delete clients that don't have jobs associated. it's perfectly possible an old client sticks around the database if its jobs are still around as well.
    – anarcat
    Nov 25, 2021 at 1:56
0

I believe the procedure is simply, in bconsole:

delete client=foo.example.com-fd

where foo.example.com-fd is the name of the file storage server you want to destroy. This will take care of removing related jobs, but I am not sure (yet?) that it will remove related file records. One can hope, and if that fails then dbcheck can be used.

Do note that dbcheck is really, really slow and should be used only if you are stuck in MySQL land. In PostgreSQL there is a much more efficient dbcheck.sql script that can be run directly in a SQL console, and that will keep changes inside a transaction so you can review changes before committing. Pretty amazing stuff, but dbcheck should not be needed in normal Bacula operation, according to the upstream documentation. To quote that manual:

By the way, I personally run dbcheck only where I have messed up my database due to a bug in developing Bacula code, so normally you should never need to run dbcheck in spite of the recommendations given above, which are given so that users don't waste their time running dbcheck too often.

So really, you should only need the delete command to destroy an old client, at least in theory.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .