Maintaining BerkeleyDB Databases

Introduction

ze-filter uses two kinds of databases :

  • CDB (constant databases) -
  • WDB (working databases) -

ze-makemap tool

BerkeleyDB command line tools

BerkeleyDB package come with some command line tools to help you maintaining ze-filter databases :

  • db_archive
  • db_checkpoint
  • db_deadlock
  • db_dump
  • db_hotbackup
  • db_load
  • db_printlog
  • db_recover
  • db_stat
  • db_upgrade
  • db_verify

These tools are installed inside /var/ze-filter/dbtools. Documentation for these tools can be find at BerkeleyDB utilities documentation, at the library distribution or at Oracle web site.

Database Hot-Backup

A good thing is to periodically backup working databases. You can use db_hotbackup, launched by cron :

10 0,6,12,18 * * *      cd /var/ze-filter; bin/backup-wdb

Where backup-wdb script is as follows :

#! /bin/sh

cd /var/ze-filter
dbtools/db_hotbackup -v  -h wdb -b backup-me
chown -hR smmsp:smmsp backup-me
chmod 660 backup-me/log*
chmod 664 backup-me/*db

To restore working databases if they become corrupted, just replace the contents of working database directory (/var/ze-filter/wdb) by the backup :

#! /bin/sh
/etc/init.d/ze-filter stop
cd /var/ze-filter
rm -f wdb/*
cp -p backup-me/* wdb/
/etc/init.d/ze-filter start

Notes

ze-filter uses BerkeleyDB database manager. To avoid compatibility problems with other possibly already installed versions, BerkeleyDB source code is distributed with ze-filter, without its documentation, to reduce size. You can get all original BerkeleyDB stuff from Oracle.
doc/maintaining/databases.txt · Last modified: 2018/02/09 15:54 by 127.0.0.1
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0