The Railway Redis database service allows you to provision and connect to a Redis database with zero configuration.
You can add a Redis database via the
CMD + K menu or by clicking the
+ New button on the Project Canvas.
There are two ways to connect to a Redis database:
When you deploy your Redis database, you will have access to two environment variables that enable one of the two connection types (private or public).
As you create more services in your project, you can use Reference Variables to easily connect to the Redis database.
To access your Redis database from another service within the same project, you can use the
REDIS_PRIVATE_URL environment variable.
This connection string uses Private Networking to route communication to your service over the private network.
To access your Redis database over the public internet, you can use the connection string stored in the
REDIS_URL environment variable available in the service.
This connection string uses the TCP Proxy connection to route communication to your service over the public internet.
You can also connect using redis-cli:
The following variables are included in the Redis service and can be referenced in other services:
Connect to your Redis container using your library of choice and supplying the appropriate environment variables.
The Redis database service uses the bitnami/redis:latest docker image.
Tailor your Redis service to your needs by adding any variables relevant to the bitnami/redis:latest image.
Edit this file on GitHub