Comdb2 has been running in production on x86 Linux, PowerPC AIX, and SPARC Solaris systems. This guide is written with Linux in mind. Admin commands for other OSes will be different, but database commands will remain the same.
Installing from source
You can pull the latest source from GitHub.
git clone https://github.com/bloomberg/comdb2 cd comdb2
Our development policy is to tag each release. Major releases are branched. Building from the latest commit in the latest branch is a good bet. Master is for bleeding edge development.
You’ll need to install a few dependencies first. It’s not a big list. Exact names will depend on your distribution type and version. Dependencies for some major distributions:
|Ubuntu 16.04, 16.10||
sudo USER='username' make install
To make testing out Comdb2 easier,
make install will use the value of
$USER to set ownership of log/configuration directories. For a personal/development install
sudo USER=$(whoami) make install is a good option. For database deployments, create a dedicated user.
Comdb2 installs by default rely on a small program called
pmux to deal out port numbers to databases. Port assignments are dynamic. This is very useful if you run large numbers of databases and don’t want to manage port assignment yourself. You’ll need to start this program on system startup. For systemd-based systems, we provide
a pmux.service file. If you’re going to be running databases as the current user, you’re all set. To use a dedicated user, change the
User= line in
tools/pmux/pmux.service To use it:
sudo cp tools/pmux/pmux.service /etc/systemd/system sudo systemctl daemon-reload sudo systemctl enable pmux sudo systemctl start pmux
Installing from a package
Packages can be built from source with
make deb-current on Debian-derived systems, or
make rpm-current on Redhat-derived systems.
Installing a package creates a comdb2 user and group and installs pmux and cdb2sockpool as systemd-managed services. Log/data directories are set up with read/write permissions for the
comdb2 user. Databases should be created and run as
comdb2. As a convenience, installing from a package also starts an instance of supervisord that can be used to manage running databases. A simple script called
comdb2admin is installed to make it easier to start/create databases through supervisord.
Installing (from source or a package) creates a directory structure like this:
/opt/bb ├── bin │ ├── cdb2_dump │ ├── cdb2_printlog │ ├── cdb2_pgdump │ ├── cdb2sql │ ├── cdb2_stat │ ├── cdb2_verify │ ├── comdb2 │ ├── comdb2ar │ ├── comdb2dumpcsc │ ├── copycomdb2 │ └── pmux │ └── comdb2admin ├── etc │ └── cdb2 │ └── config │ ├── comdb2.d │ └── comdb2.lrl ├── include │ └── cdb2api.h ├── lib │ ├── libcdb2api.a │ ├── libcdb2api.so └── var ├── cdb2 └── logs └── cdb2
A quick overview:
||Global database tunables, applies to all databases|
||Global database config files, settings in all *.lrl files in this directory apply to all databases|
||headers and libraries|
||Default location for databases. Every database gets a subdirectory at create time.|
||Default location for database informational log files|