Container based setup
When to use Container based deployment?
-
Native packages are not available for all the distributions. Kadalu Storage packages are available for Ubuntu 22.04 and work is in progress for other distributions like Debian, Fedora and CentOS.
-
Clutter-free host machine.
-
Easy setup and management - No need to worry about the dependencies and other things while setting up the Kadalu Storage.
Session and working directory
Create two docker volumes as follows.
-
kadalu_workdir - Directory to persist configurations and state.
-
kadalu_session - Directory to store session details to use the CLI
docker volume create kadalu_workdir docker volume create kadalu_session
Prepare Storage backend
Kadalu Storage supports many backend filesystems. XFS and ZFS are the two widely used backend filesystems with Kadalu Storage or GlusterFS.
ext4
mkfs.ext4 -I 512 /dev/vda mkdir -p /exports/storage1 mount -t ext4 /dev/vda /exports/storage1
XFS
mkfs.xfs -f -i size=512 -n size=8192 -d su=128K,sw=10 /dev/vda mkdir -p /exports/storage1 mount -t xfs /dev/vda /exports/storage1
ZFS
Create a Zpool and then create a dataset
zpool create exports /dev/vda zfs create exports/storage1
A directory from the root filesystem
mkdir -p /exports/storage1
Configure Log directory
Create a directory in the host machine to collect the logs from the container.
mkdir -p /var/log/kadalu
Start the Container
Now start the Kadalu Storage container by running the following command. Make sure to update the export directory path as required in your setup. Note: Add multiple export paths if required (When multiple disks available per node)
sudo docker run -d \ --network host \ -v kadalu_workdir:/var/lib/kadalu \ -v kadalu_session:/root/.kadalu \ -v /exports/storage1:/exports/storage1 \ -v /var/log/kadalu:/var/log/kadalu \ --privileged \ --restart unless-stopped \ --name kadalu-$(hostname) \ --hostname $(hostname) \ kadalu/storage-node:latest
Thats it, now verify that the storage node container is running by executing the following command.
$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3d9506e4900b kadalu/storage-node:latest "/usr/bin/supervisord" About a minute ago Up About a minute kadalu-server1
CLI
Now create the following alias
alias kadalu='sudo docker exec -it kadalu-$(hostname) kadalu'
With this, execute all the kadalu commands from the host machine itself. For example
$ kadalu --version
Above command will be expanded as
sudo docker exec -it kadalu-$(hostname) kadalu --version