Welcome to part 2 of the DC/OS 101 Tutorial.
By now, you should have a running DC/OS cluster and the DC/OS CLI installed and configured. If that isn’t the case, please follow the first part of this tutorial. The next stage of this tutorial uses jq, a command line JSON processor to simplify some of the commands. Follow the instructions here to install JQ for your operating system.
By the end of this session you will have installed your first service - Redis - from the DC/OS Catalog repository. Redis is a key-value store, which you will use for persisting data in this tutorial.
Search the Catalog repository for Redis packages:
dcos package search redis
This should return two entries (mr-redis and redis).
You are interested in the Redis package, which installs a single Redis container. Install the package with this command:
dcos package install redis
You can use any of the following methods to check that Redis is running:
- By looking at the GUI: The Redis task should be displayed in the Service Health tab along with the health status.
- By looking at all DC/OS tasks with the
dcos taskcommand. This command will show us all running DC/OS tasks (i.e. Mesos tasks).
- By looking at all Marathon apps:
dcos marathon app list. This command will show us all running Marathon apps. Since services are started via Marathon, you should see Redis here as well. Note that the health status (i.e. 1/1) is also shown here.
- By looking at the Redis log:
dcos task log redis. This command will show us the logs (stdout and stderr) of the Redis task. This allows you to check whether the actual startup was successful. You can increase the number of log lines displayed by using the
--lines=argument, the default is 10.
Let’s use Redis by storing a key manually via the redis-cli command
SSH into the node where Redis is running:
dcos node ssh --master-proxy --mesos-id=$(dcos task redis --json | jq -r '. | .slave_id')
Because Redis is running in a Docker container, you can list all Docker containers using
docker psand get the ContainerID of the container running the Redis service.
Start a bash session in the running container, substituting CONTAINER_ID with the ContainerID you got from the previous command:
sudo docker exec -i -t CONTAINER_ID /bin/bash
Start the Redis CLI:
Set a key with a value:
set mykey key1
Check the value is there:
You have just successfully installed your first service from the Catalog repository and verified it is running!
Catalog is a package repository made available for DC/OS Clusters. It enables you to easily install services such as Apache Spark or Apache Cassandra in your cluster without having to deal with manual configuration. Catalog packages are developed and maintained by many different contributors.
There are currently two categories of packages:
- Curated packages that have undergone testing and certification.
- Community contributed packages, which may not be as well tested.
You can also add your own repo that includes your custom packages. See the documentation for details.