Installation

SmartOS

Starting with 14.4.0 Datasets, Joyent introduced signed packages.

In order to install DalmatinerDB from the latest pre-built binary, the Project-FiFo public key is required and can be installed with the following commands:

curl -O https://project-fifo.net/fifo.gpg
gpg --primary-keyring /opt/local/etc/gnupg/pkgsrc.gpg --import < fifo.gpg
gpg --keyring /opt/local/etc/gnupg/pkgsrc.gpg --fingerprint

πŸ“˜

Key verification

The key id is BB975564 and the fingerprint CE62 C662 67D5 9129 B291 62A0 ADDF 278A BB97 5564 should be returned respectively.

The DalmatinerDB SmartOS package can be installed from the Project-FiFo repository, using pkgin:

VERSION='dev' # use 'rel' for release packages
echo "http://release.project-fifo.net/pkg/${VERSION}" >>/opt/local/etc/pkgin/repositories.conf
pkgin -fy up
pkgin install dalmatinerdb  # To install the backend package
svcadm enable epmd          # To enable epmd
svcadm enable dalmatiner/db # To enable dalmatinerdb

From source

These dependencies should be met before installing from source:

  • Erlang R19
  • Git
  • GCC
  • G++
  • Make

The following instructions will create a self-contained build of DalmatinerDB:

git clone https://gitlab.com/Project-FiFo/DalmatinerDB/dalmatinerdb.git
cd dalmatinerdb
TARGET_DIRECTORY=/usr/local # or where your OS stores local binaries
./rebar3 release
cp -r _build/prod/rel/ddb $TARGET_DIRECTORY
cd $TARGET_DIRECTORY/ddb
cp etc/dalmatinerdb.conf /data/ddb/etc/dalmatinerdb.conf
vi /data/ddb/etc/dalmatinerdb.conf # configure and change settings as needed
mkdir /data/ddb/log/
chown dalmatiner /data/ddb/log/
./bin/ddb start

πŸ“˜

Dalmatiner user

DalmatinerFrontend by default expects to run as the user dalmatiner, this can be changed or disabled by changing/removing the bin/dalmatinerfe file’s entry RUNNER_USER.
This user should have read access to the etc directory and read/write access to the data and logs directories.

πŸ“˜

Configuration changes

In order for configuration changes to take effect, the service must be restarted.

Debian based Linux

🚧

DalmatinerDB is designed to run on the ZFS filesystem, and it is strongly recommended to have a working installation before proceeding.

ZFS

The following instructions were tested on Debian 9 but should also work on recent Ubuntu releases (installation assumes systemd is used).

First step is to add "contribs" to your sources.list file and install the ZFS kernel module:

# Add contrib
sed -i "s/main/main contrib/g" /etc/apt/sources.list
apt update

# Install
apt install linux-headers-$(uname -r)
ln -s /bin/rm /usr/bin/rm
apt install zfs-dkms

Before rebooting the system, it's important to load the ZFS module and set up an initial filesystem. Otherwise the module will not load on boot.

# Load kernel module
/sbin/modprobe zfs
systemctl restart zfs-import-cache
systemctl restart zfs-import-scan
systemctl restart zfs-mount
systemctl restart zfs-share

# Create ZFS filesystems
zpool create -f -o ashift=12 data /dev/sdb1 /dev/sdb2
zfs create data/dalmatinerdb -o compression=lz4 -o atime=off -o logbias=throughput

# If installing the front-end and proxy on the same machine:
zfs create data/dalmatinerfe
zfs create data/dalmatinerpx

# Ensure state is ONLINE
zpool status

mkdir /data/dalmatinerdb/log

Now reboot and ensure ZFS is loaded and the log directory created above is reachable.

πŸ“˜

If you can't set up ZFS on a disk (for production) or on a partition (for testing), it is also possible to create a file and use this as a device for testing. However This should not be done in production!

# Change 4G to appropriate allocation size
cd / && touch vdev1 && truncate -s 4G vdev1

zpool create -f -o ashift=12 data /vdev1

PostgreSQL

DalmatinerDB requires PostgreSQL to function properly, version 9.6 or later is recommended.

apt install postgresql-9.6

su postgres

# create the user, when prompted enter "ddb" for the password
createuser -P ddb

# create the database, setting the user created above as the owner
createdb -O ddb metric_metadata

# depending on your default permissions you may need to manually add extensions
pgsql
\c metric_metadata
CREATE EXTENSION hstore;
CREATE EXTENSION btree_gin;
\q

πŸ“˜

You can change the database name and user in the configuration files.
You should change the password when deploying to production!

Building

Currently there are no official packages but you can build your own.

First, set up the build chain:

apt install git make gcc g++ zlib1g-dev erlang erlang-os-mon

mkdir /data/build

git clone https://gitlab.com/Project-FiFo/DalmatinerDB/dalmatinerdb.git /data/build/dalmatinerdb

🚧

Make sure your Erlang version is R19

You can then either build and manually install or build a .deb package (see the Makefile options).

The recommended method is to build a .deb package and install it:

cd /data/build/dalmatinerdb
make deb-package

dpkg -i rel/deb/stage.deb

systemctl enable dalmatinerdb
systemctl start dalmatinerdb