Home | Forum | MAN Pages | Tutorials | Directory | HOWTOs | About Me | Contact
 
Postfix Documentation
General configuration
Basic configuration
Standard configuration examples
Address rewriting
Virtual domain hosting
SASL Authentication
IP Version 6 Support
TLS Encryption and authentication
Installation from source code

Problem solving
Bottleneck analysis
Performance tuning
Debugging strategies
Error messages

Content inspection
Content inspection overview
Stopping backscatter mail
Built-in content inspection
After-queue content filter
Before-queue content Filter

SMTP Relay/access control
Relay/access control overview
Access policy delegation
Address verification
Per-client/user/etc. access
ETRN Support
LAN connected via UUCP

Lookup tables (databases)
Lookup table overview
CDB Howto
Berkeley DB Howto
LDAP Howto
MySQL Howto
PCRE Howto
PostgreSQL Howto

Mailing list support
qmail/ezmlm support
VERP Support

Specific environments
Linux issues
NFS issues
Ultrix support

Other mail delivery agents
Cyrus
Maildrop
LMTP

Other topics
Architecture overview
All main.cf parameters
All Postfix manual pages
Rejecting Unknown Local Recipients
Address Classes
Connection cache howto
Postfix DSN support
Guidelines for Package Builders
Queue Scheduler
XCLIENT Command
XFORWARD Command
FAQS
» Advanced Routing & Traffic Control
» General FAQ
» Squid Proxy Server
» Sendmail
» Fetchmail
» Postfix
» Connecting Mobile Phone
» Paging from Linux
» Standard Commands
» Some common terms
Linux HOWTOs
- Single List of HOWTOs
-
Warning: file(link1.inc) [function.file]: failed to open stream: No such file or directory in /home/linuxfaqs/linux-faqs.com/link1.php on line 12

Warning: Invalid argument supplied for foreach() in /home/linuxfaqs/linux-faqs.com/link1.php on line 16

-
Warning: file(link2.inc) [function.file]: failed to open stream: No such file or directory in /home/linuxfaqs/linux-faqs.com/link2.php on line 12

Warning: Invalid argument supplied for foreach() in /home/linuxfaqs/linux-faqs.com/link2.php on line 16

-
Warning: file(link3.inc) [function.file]: failed to open stream: No such file or directory in /home/linuxfaqs/linux-faqs.com/link3.php on line 12

Warning: Invalid argument supplied for foreach() in /home/linuxfaqs/linux-faqs.com/link3.php on line 16

-
Warning: file(link4.inc) [function.file]: failed to open stream: No such file or directory in /home/linuxfaqs/linux-faqs.com/link4.php on line 12

Warning: Invalid argument supplied for foreach() in /home/linuxfaqs/linux-faqs.com/link4.php on line 16

-
Warning: file(link5.inc) [function.file]: failed to open stream: No such file or directory in /home/linuxfaqs/linux-faqs.com/link5.php on line 12

Warning: Invalid argument supplied for foreach() in /home/linuxfaqs/linux-faqs.com/link5.php on line 16

-
Warning: file(link6.inc) [function.file]: failed to open stream: No such file or directory in /home/linuxfaqs/linux-faqs.com/link6.php on line 12

Warning: Invalid argument supplied for foreach() in /home/linuxfaqs/linux-faqs.com/link6.php on line 16

- IRC
- Kodak-Digitalcam-HOWTO
- Linux+Win9x+Grub-HOWTO
- Mobile-IPv6-HOWTO
- Path
- PCTel-MicroModem-Config
- SCSI-Generic-HOWTO
- Serial-Laplink-HOWTO
- TclTk-HOWTO
- User-Authentication-HOWTO
- VoIP-HOWTO
- Windows-LAN-Server-HOWTO
- XDMCP-HOWTO
- ADSL Bandwidth Management
- Compile Apache
- Make a Bootdisk
- Linux-Windows9x-Grub
- Linux-Windows
- Linux Crash Recovery
- Optimise Squid
- Block websites in Squid
- Broadcast webcam in linux
- Compile RedHat Linux kernel
- Implement Firewall Security
- Increase Harddrive Performance
- Mount NTFS filesystem
- Patch / rebuild SRPM
- Secure Linux
- Set up a DHCP Server
- Set up an FTP server
- Set up Linux as a Router
- Use Cron
- Samba
Miscellaneous
» All Ports
» Spammers fetch email addresses
» Mounting NTFS in linux
» Linux Gazette
» Linux Man Pages
» Linux Directory
Linux Man Pages
- Section 1
- Section 2
- Section 3
- Section 4
- Section 5
- Section 6
- Section 7
- Section 8
Linux Directory
- General Information
- Linux Hardware
- Software / Applications
- Web Technology
- Software Development
- Linux Distributions
- Linux Publications
- Linux Beginners


 

Postfix Berkeley DB Howto


Introduction

Postfix uses databases of various kinds to store and look up information. Postfix databases are specified as "type:name". Berkeley DB implements the Postfix database type "hash" and "btree". The name of a Postfix Berkeley DB database is the name of the database file without the ".db" suffix. Berkeley DB databases are maintained with the postmap(1) command.

Note: Berkeley DB version 4 is not supported by Postfix versions before 2.0.

This document describes:

  1. How to build Postfix on systems without Berkeley DB library.

  2. How to build Postfix on BSD or Linux systems with multiple Berkeley DB versions.

  3. How to tweak performance.

  4. Missing pthread library trouble.

Building Postfix on systems without Berkeley DB

Many commercial UNIXes ship without Berkeley DB support. Examples are Solaris, HP-UX, IRIX, UNIXWARE. In order to build Postfix with Berkeley DB support you need to download and install the source code from http://www.sleepycat.com/

Warning: some Linux system libraries use Berkeley DB, as do some third-party libraries such as SASL. If you compile Postfix with a different Berkeley DB implementation, then every Postfix program will dump core because either the system library, SASL library, or Postfix itself ends up using the wrong version.

The more recent Berkeley DB versions have a compile-time switch, "--with-uniquename", which renames the symbols so that multiple versions of Berkeley DB can co-exist in the same application. Although wasteful, this may be the only way to keep things from falling apart.

To build Postfix after you installed the Berkeley DB from http://www.sleepycat.com/, use something like:

% make tidy
% make makefiles CCARGS="-DHAS_DB -I/usr/local/BerkeleyDB/include" \
    AUXLIBS="-L/usr/local/BerkeleyDB/lib -ldb"
% make

Solaris needs this:

% make tidy
% make makefiles CCARGS="-DHAS_DB -I/usr/local/BerkeleyDB/include" \
    AUXLIBS="-R/usr/local/BerkeleyDB/lib -L/usr/local/BerkeleyDB/lib -ldb"
% make

The exact pathnames depend on the Berkeley DB version, and on how it was installed.

Warning: the file format produced by Berkeley DB version 1 is not compatible with that of versions 2 and 3 (versions 2 and 3 have the same format). If you switch between DB versions, then you may have to rebuild all your Postfix DB files.

Warning: if you use Berkeley DB version 2 or later, do not enable DB 1.85 compatibility mode. Doing so would break fcntl file locking.

Warning: if you use Perl to manipulate Postfix's Berkeley DB files, then you need to use the same Berkeley DB version in Perl as in Postfix.

Building Postfix on BSD systems with multiple Berkeley DB versions

Some BSD systems ship with multiple Berkeley DB implementations. Normally, Postfix builds with the default DB version that ships with the system.

To build Postfix on BSD systems with a specific DB version, use a variant of the following commands:

% make tidy
% make makefiles CCARGS=-I/usr/include/db3 AUXLIBS=-ldb3
% make

Warning: the file format produced by Berkeley DB version 1 is not compatible with that of versions 2 and 3 (versions 2 and 3 have the same format). If you switch between DB versions, then you may have to rebuild all your Postfix DB files.

Warning: if you use Berkeley DB version 2 or later, do not enable DB 1.85 compatibility mode. Doing so would break fcntl file locking.

Warning: if you use Perl to manipulate Postfix's Berkeley DB files, then you need to use the same Berkeley DB version in Perl as in Postfix.

Building Postfix on Linux systems with multiple Berkeley DB versions

Some Linux systems ship with multiple Berkeley DB implementations. Normally, Postfix builds with the default DB version that ships with the system.

Warning: some Linux system libraries use Berkeley DB. If you compile Postfix with a non-default Berkeley DB implementation, then every Postfix program will dump core because either the system library or Postfix itself ends up using the wrong version.

On Linux, you need to edit the makedefs script in order to specify a non-default DB library. The reason is that the location of the default db.h include file changes randomly between vendors and between versions, so that Postfix has to choose the file for you.

Warning: the file format produced by Berkeley DB version 1 is not compatible with that of versions 2 and 3 (versions 2 and 3 have the same format). If you switch between DB versions, then you may have to rebuild all your Postfix DB files.

Warning: if you use Berkeley DB version 2 or later, do not enable DB 1.85 compatibility mode. Doing so would break fcntl file locking.

Warning: if you use Perl to manipulate Postfix's Berkeley DB files, then you need to use the same Berkeley DB version in Perl as in Postfix.

Tweaking performance

Postfix provides two configuration parameters that control how much buffering memory Berkeley DB will use.

  • berkeley_db_create_buffer_size (default: 16 MBytes per table). This setting is used by the commands that maintain Berkeley DB files: postalias(1) and postmap(1). For "hash" files, create performance degrades rapidly unless the memory pool is O(file size). For "btree" files, create performance is good with sorted input even for small memory pools, but with random input degrades rapidly unless the memory pool is O(file size).

  • berkeley_db_read_buffer_size (default: 128 kBytes per table). This setting is used by all other Postfix programs. The buffer size is adequate for reading. If the cache is smaller than the table, random read performance is hardly cache size dependent, except with btree tables, where the cache size must be large enough to contain the entire path from the root node. Empirical evidence shows that 64 kBytes may be sufficient. We double the size to play safe, and to anticipate changes in implementation and bloat.

Missing pthread library trouble

When building Postfix fails with:

undefined reference to `pthread_condattr_setpshared'
undefined reference to `pthread_mutexattr_destroy'
undefined reference to `pthread_mutexattr_init'
undefined reference to `pthread_mutex_trylock'

Add the "-lpthread" library to the "make makefiles" command.

% make makefiles .... AUXLIBS="... -lpthread"

More information is available at http://www.sleepycat.com/.


 
Random Linux Commands
Startup Services
These are background processes; essentially another popular name for Daemon.

Common Linux terms
Linux-FAQs Forum Categories
» About Forum
» Hardware Troubleshooting in Linux
» Linux Entertainment
» Resources
» Software toubleshooting and configuration
All Linux-FAQs Forums
» Crash Recovery
» FAQs
» Forum Talk
» Games
» General
» Linux Audio Support
» Linux Hardware / Driver
» Linux Installation Support
» Linux misc.
» Linux Networking
» Linux Newbies
» Linux Printing Support
» Linux Security
» Linux Video Support
» Mail Server
» Multimedia
» Tutorials
» Web Proxy Server
» Web Server
Partners Link
Linux, Windows, Ubuntu, Debian Freaking Tips


 
Powered by HTML
Linux-faqs.com Copyright, All rights reserved www.linux-faqs.com. Peeyush Maurya.