This plugin uses Datera storage backend as distributed data storage for containers.
There are two ways to use this plugin
Before enabling the plugin, create the configuration file on each node
$ sudo touch /root/.datera-config-file
This is a JSON file with the following structure:
{
"datera-cluster": "1.1.1.1",
"username": "my-user",
"password": "my-pass",
"debug": false,
"ssl": true,
"tenant": "/root",
"os-user": "root"
}
Run this on each node that should use the Datera volume driver
$ sudo docker install dateraiodev/docker-driver
Update the config file with the relevant information for the cluster then run the following:
$ sudo docker plugin enable dateraiodev/docker-driver
Install udev rules on each docker node (from the scripts directory)
sudo ./install_udev_rules.py
WHEN USING THE PLUGIN INSTALLATION METHOD YOU MUST REFER TO THE DRIVER BY THE FORM "repository/image" NOT JUST "image"
Create a volume
$ sudo docker volume create --name my-vol --driver dateraiodev/docker-driver --opt size=5
Start your docker containers with the option --volume-driver=dateraiodev/docker-driver
and use the first part of --volume
to specify the remote volume that you want to connect to:
$ sudo docker run --volume-driver dateraiodev/docker-driver --volume datastore:/data alpine touch /data/hello
Download the latest release of the docker-driver from https://github.com/Datera/docker-driver/releases
Unzip the binary
unzip dddbin.zip
Install udev rules on each docker/mesos node
sudo ./scripts/install_udev_rules.py
This plugin doesn't create volumes in your Datera cluster yet, so you'll have to create them yourself first.
1 - Create the config file
$ sudo touch /root/.datera-config-file
This is a JSON file with the following structure:
{
"datera-cluster": "1.1.1.1",
"username": "my-user",
"password": "my-pass",
"debug": false,
"ssl": true,
"tenant": "/root",
"os-user": "root"
}
Fill out the cluster info in the config file
2 - Start the plugin using this command:
$ sudo ./dddbin
PLEASE NOTE: If installing on a Mesos node, the environment variable
DATERA_FRAMEWORK="dcos-mesos"
or DATERA_FRAMEWORK="dcos-docker"
must be set
3a - Create a volume
$ sudo docker volume create --name my-vol --driver datera --opt size=5
3b - Start your docker containers with the option --volume-driver=dateraiodev/docker-driver
and use the first part of --volume
to specify the remote volume that you want to connect to:
$ sudo docker run --volume-driver dateraiodev/docker-driver --volume datastore:/data alpine touch /data/hello
Currently DCOS and Mesos are very early in their external persistent volume support. Because of this, their volume lifecycle is simpler than other ecosystems. This means only a subset of the Datera product functionality is available through DCOS and Mesos. It also means there are a few wonky behaviors when using the external volume support for DCOS. You can read more about that here: https://dcos.io/docs/1.10/storage/external-storage/#potential-pitfalls
Download the latest release of the docker-driver from https://github.com/Datera/docker-driver/releases
Unzip the binary
unzip dddbin.zip
$ sudo touch datera-config-file.txt
This is a JSON file with the following structure:
{
"datera-cluster": "1.1.1.1",
"username": "my-user",
"password": "my-pass",
"debug": false,
"ssl": true,
"tenant": "/root",
"os-user": "root"
}
scp -i ~/your_ssh_key datera-config-file.txt user@agent-node:/some/location/dddbin
sudo ./dddbin -config datera-config-template.txt
sudo env DATERA_FRAMEWORK=dcos DATERA_VOL_SIZE=33 ./dddbin -config datera-config-template.txt
The following environment variables are available to use for Docker container nodes
DATERA_FRAMEWORK=dcos
DATERA_VOL_SIZE=XX
DATERA_REPLICAS=X
DATERA_PLACEMENT=hybrid
DATERA_MAX_IOPS=100
DATERA_MAX_BW=100
DATERA_FSTYPE=ext4
DATERA_CLONE_SRC=some-app-instance
PLEASE NOTE: These environment variables are necessary only for Docker
containers and will be global for all Docker containers on each Mesos Agent
node. Eg: if DATERA_VOL_SIZE=100
is set on an Agent node EVERY SINGLE DOCKER
CONTAINER USING DATERA STORAGE WILL USE THIS VALUE. Mesos containers are
unaffected
{
"id": "test-datera-2",
"instances": 1,
"cpus": 0.1,
"mem": 32,
"cmd": "/bin/cat /dev/urandom > mesos-test/test.img",
"container": {
"type": "MESOS",
"volumes": [
{
"containerPath": "mesos-test",
"external": {
"name": "datera-mesos-test-volume",
"provider": "dvdi",
"options": {
"dvdi/driver": "datera",
}
},
"mode": "RW"
}
]
},
"upgradeStrategy": {
"minimumHealthCapacity": 0,
"maximumOverCapacity": 0
}
}
The easiest way to generate this JSON config is to go to the DCOS UI and create a new container with an external volume. Then switch "dvdi/driver": "rexray" --> "dvdi/driver": "datera"
The default size for a volume created without providing a "dvdi/size" parameter is 16GB
All 'dvdi/xxxxx' options must be double-quoted strings
{
"id": "test-datera-2",
"instances": 1,
"cpus": 0.1,
"mem": 32,
"cmd": "/bin/cat /dev/urandom > mesos-test/test.img",
"container": {
"type": "MESOS",
"volumes": [
{
"containerPath": "mesos-test",
"external": {
"name": "datera-mesos-test-volume",
"provider": "dvdi",
"options": {
"dvdi/driver": "datera",
"dvdi/size": "33",
"dvdi/replica": "3",
"dvdi/maxIops": "100",
"dvdi/maxBW": "200",
"dvdi/placementMode": "hybrid",
"dvdi/fsType": "ext4",
"dvdi/cloneSrc": "some-app-instance"
}
},
"mode": "RW"
}
]
},
"upgradeStrategy": {
"minimumHealthCapacity": 0,
"maximumOverCapacity": 0
}
}
PLEASE NOTE: "containerPath" cannot start with a "/", this will break the Mesos agent and cause the container spawn to fail
You cannot specify any Datera specific information in this JSON blob due to a limitation in the way DCOS interacts with Mesos and Docker. The relevant options must be specified during driver instantiation time via the environment variables shown in an earlier section.
{
"id": "test-datera-docker",
"instances": 1,
"cpus": 0.1,
"mem": 32,
"cmd": "/bin/cat /dev/urandom > mesos-test/test.img",
"container": {
"type": "DOCKER",
"docker": {
"image": "alpine:3.1",
"network": "HOST",
"forcePullImage": true
},
"volumes": [
{
"containerPath": "/data/test-volume",
"external": {
"name": "datera-docker-volume",
"provider": "dvdi",
"options": { "dvdi/driver": "datera" }
},
"mode": "RW"
}
]
},
"upgradeStrategy": {
"minimumHealthCapacity": 0,
"maximumOverCapacity": 0
},
}