Installing Redis Service in DC/OS With Persistent Storage Using AWS Volumes

Redis

Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache, and message broker.

It supports various data structures such as Strings, Hashes, Lists, Sets etc. DCOS offers Redis as a service.

Why Do We Use External Persistent Storage for Redis Mesos Containers?

Since Redis is an in-memory database, an instance/service restart will result in loss of data. To counter this, it is always advisable to snapshot the Redis in-memory database from time to time.

This helps Redis instance to recover from the point in time failure.

In DCOS, Redis is deployed as a stateless service. To make it a stateful and persistent data, we can configure local volumes or external volumes.

The disadvantage of having a local volume mapped to Mesos containers is when a slave node goes down, your local volume becomes unavailable, and the data loss occurs.

However, with external persistent volumes, as they are available on each node of the DCOS cluster, a slave node failure does not impact the data availability.

Rex-Ray

REX-Ray is an open source, storage management solution designed to support container runtimes such as Docker and Mesos.

REX-Ray enables stateful applications such as databases to persist and maintain its data after the life cycle of the container has ended. Built-in high availability enables orchestrators such as Docker Swarm, Kubernetes, and Mesos Frameworks like Marathon to automatically orchestrate storage tasks between hosts in a cluster.

Built on top of the libStorage framework, REX-Ray’s simplified architecture consists of a single binary and runs as a stateless service on every host using a configuration file to orchestrate multiple storage platforms.

Objective: To create a Redis service in DC/OS environment with persistent storage.

Warning: The Persistent Volume feature is still in beta Phase for DC/OS Version 1.11.

Prerequisites:

  • Make sure the rexray service is running and is in a healthy state for the cluster.

Steps:

  • Click on the Add button in Services component of DC/OS GUI.
  • Click on JSON Configuration.

Note: For persistent storage, below code should be added in the normal Redis service configuration JSON file to mount external persistent volumes.

  • Make sure the service is up and in a running state:

If you look closely, the service was suspended and respawned on a different slave node. We populated the database with dummy data and saved the snapshot in the data directory.

When the service did come upon a different node 10.0.3.204, the data persisted and the volume was visible on the new node.

  • Check the volume tab:

Note: For external volumes, the status will be unavailable. This is an issue with DC/OS.

The Entire Service JSON file:

Redis entrypoint

To connect with Redis service, use below host:port in your applications:

redis.marathon.l4lb.thisdcos.directory:6379

Conclusion

We learned about Standalone Redis Service deployment from DCOS catalog on DCOS. Also, we saw how to add Persistent storage to it using RexRay. We also learned how RexRay automatically manages volumes over AWS ebs and how to integrate them into DCOS apps/services. Finally, we saw how other applications can communicate with this Redis service.

References

*******************************************************************

This post was originally published on Velotio Blog.

Velotio Technologies is an outsourced software product development partner for technology startups and enterprises. We specialize in enterprise B2B and SaaS product development with a focus on artificial intelligence and machine learning, DevOps, and test engineering.

Interested in learning more about us? We would love to connect with you on our Website, LinkedIn or Twitter.

*******************************************************************

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Velotio Technologies

Velotio Technologies

Velotio Technologies is an outsourced software and product development partner for technology startups & enterprises. #Cloud #DevOps #ML #UI #DataEngineering