Openly serious about storage
REX-Ray delivers persistent storage access for container runtimes, such as Docker and Mesos, and provides an easy interface for enabling advanced storage functionality across common storage, virtualization and cloud platforms. For example, here's how to list the volumes for a VirtualBox VM running Linux with REX-Ray:
$ rexray volume --service virtualbox - attachments: - instanceID: id: e71578b0-1bfb-4fa5-bcd5-4ae982fd4a9b driver: virtualbox status: /Users/akutz/VirtualBox/libStorage/libStorage.vmdk volumeID: 1b819454-a280-4cff-aff5-141f4e8fd154 name: libStorage.vmdk size: 64 status: /Users/akutz/VirtualBox/libStorage/libStorage.vmdk id: 1b819454-a280-4cff-aff5-141f4e8fd154 type: ""
REX-Ray is a storage orchestration tool that provides a set of common commands for managing multiple storage platforms. Built on top of the libStorage framework, REX-Ray connects enables persistent storage for container runtimes such as Docker and Mesos.
The initial REX-Ray 0.4.x release omits support for several, previously verified storage platforms. These providers will be reintroduced incrementally, beginning with 0.4.1. If an absent driver prevents the use of REX-Ray, please continue to use 0.3.3 until such time the storage platform is introduced in REX-Ray 0.4.x. Instructions on how to install and configure REX-Ray 0.3.3 are both available.
Storage Provider Support
The following storage providers and platforms are supported by REX-Ray.
|Oracle VirtualBox||Virtual Media|
Support for the following storage providers will be reintroduced in upcoming releases:
|Google Compute Engine||Disk|
Operating System Support
The following operating systems (OS) are supported by REX-Ray:
|OS X Yosemite+||Yes||No|
Container Platform Support
REX-Ray currently supports the following container platforms:
|Docker||Volume Driver Plugin|
|Mesos||Volume Driver Isolator module|
|Mesos + Docker||Volume Driver Plugin|
This section will help in getting REX-Ray up and running quickly.
The following command will download the most recent, stable build of REX-Ray
and install it to
/usr/bin/rexray on Linux systems. REX-Ray will be
registered as either a SystemD or SystemV service depending upon the OS.
$ curl -sSL https://dl.bintray.com/emccode/rexray/install | sh
Refer to the User Guide's installation topic for instructions on building REX-Ray from source, installing specific versions, and more.
REX-Ray requires a configuration file for storing details used to communicate with storage providers. This can include authentication credentials and driver-specific configuration options. Refer to the libStorage Storage Providers documentation for sample configurations of all supported storage platforms. Additionally, look at core properties & logging for advanced configurations.
Create a configuration file on the host at
/etc/rexray/config.yml. Here is a
simple example for using Oracle VirtualBox:
libstorage: service: virtualbox
Refer to the VirtualBox documentation for additional VirtualBox configuration options.
From here, REX-Ray can now be used as a command line tool. View the commands available:
$ rexray --help
To verify the configuration file, use REX-Ray to list the volumes:
$ rexray volume - attachments: - instanceID: id: e71578b0-1bfb-4fa5-bcd5-4ae982fd4a9b driver: virtualbox status: /Users/akutz/VirtualBox/libStorage/libStorage.vmdk volumeID: 1b819454-a280-4cff-aff5-141f4e8fd154 name: libStorage.vmdk size: 64 status: /Users/akutz/VirtualBox/libStorage/libStorage.vmdk id: 1b819454-a280-4cff-aff5-141f4e8fd154 type: ""
If there is an error, use the
-l debug flag and consult
Start REX-Ray as a Service
Container platforms rely on REX-Ray to be running as a service to function properly. For instance, Docker communicates to the REX-Ray Volume Driver via a UNIX socket file.
$ rexray service start
In the grand tradition of technical documentation, the first true end-to-end
example of REX-Ray is called
Hello REX-Ray. It showcases a two-node
deployment with the first node configured as a REX-Ray/libStorage server and
the second node as merely a client. Both nodes have Docker (1.11+) installed
and configured to leverage REX-Ray for persistent storage.
The below example does have a few requirements:
- VirtualBox 5.0+
- Vagrant 1.8+
- Ruby 2.0+
Start REX-Ray Vagrant Environment
Before bringing the Vagrant environment online, please ensure it is accomplished in a clean directory:
$ cd $(mktemp -d)
Inside the newly created, temporary directory, download the REX-Ray Vagrantfile:
$ curl -fsSLO https://raw.githubusercontent.com/emccode/rexray/master/Vagrantfile
Now it is time to bring the REX-Ray environment online:
The next step could potentially open up the system on which the command is executed to security vulnerabilities. The Vagrantfile brings the VirtualBox web service online if it is not already running. However, in the name of simplicity the Vagrantfile also disables the web server's authentication module. Please do not disable authentication for the VirtualBox web server if this example is being executed on an open network or without some type of firewall in place.
$ vagrant up
The above command should result in output similar to this Gist.
Once the command has been completed successfully there will be two VMs online
node1. Both nodes are running Docker and REX-Ray with
node0 configured to act as a libStorage server.
Now that the environment is online it is time to showcase Docker leveraging REX-Ray to create persistent storage as well as illustrating REX-Ray'a distributed deployment capabilities.
First, SSH into
$ vagrant ssh node0
node0 use Docker with REX-Ray to create a new volume named
vagrant@node0:~$ docker volume create --driver rexray --opt size=1 \ --name hellopersistence
After the volume is created, mount it to the host and container using the
-v flag in the
docker run command:
vagrant@node0:~$ docker run -tid --volume-driver=rexray \ -v hellopersistence:/mystore \ --name temp01 busybox
Create a new file named
myfile on the file system backed by the persistent
vagrant@node0:~$ docker exec temp01 touch /mystore/myfile
Verify the file was successfully created by listing the contents of the persistent volume:
vagrant@node0:~$ docker exec temp01 ls /mystore
Remove the container that was used to write the data to the persistent volume:
vagrant@node0:~$ docker rm -f temp01
Finally, exit the SSH session to
It's time to connect to
node1 and use the volume
hellopersistence that was
created in the previous section from
node1 runs both the Docker and REX-Ray services like
REX-Ray service on
node0 in no way understands or is configured for the
VirtualBox storage driver. All interactions with the VirtualBox web service
node0's libStorage server with which
Use the vagrant command to SSH into
$ vagrant ssh node1
Next, create a new container that mounts the existing volume,
vagrant@node1:~$ docker run -tid --volume-driver=rexray \ -v hellopersistence:/mystore \ --name temp01 busybox
The next command validates the file
myfile created from
node0 in the
previous section has persisted inside the volume across machines:
vagrant@node1:~$ docker exec temp01 ls /mystore
Finally, exit the SSH session to
Be sure to kill the VirtualBox web server with a quick
killall vboxwebsrv and
to tear down the Vagrant environment with
vagrant destroy. Omitting these
commands will leave the web service and REX-Ray Vagrant nodes online and
consume additional system resources.
REX-Ray has been used to provide persistence for stateless containers! Examples using MongoDB, Postgres, and more with persistent storage can be found at Application Examples.
Having issues? No worries, let's figure it out together.
-l debug flag can be appended to any command in order to get verbose
output. The following command will list all of the volumes visible to REX-Ray
with debug logging enabled:
$ rexray volume -l debug
For an example of the full output from the above command, please refer to this Gist.