Runs Redis on OpenShift using downloadable cartridge support. To install to OpenShift from the CLI (you'll need version 1.9 or later of rhc), create your app and then run:
rhc add-cartridge http://cartreflect-claytondev.rhcloud.com/reflect?github=fidalgo/openshift-redis-cart
Any log output will be generated to $OPENSHIFT_REDIS_DIR/logs/redis.log
Supports clustering and persistence, with monitoring from Redis Sentinel. Does not automatically pull the latest security updates - please monitor the Redis upstream 2.6 branches.
conf/redis.conf.erb
is run before Redis starts and generates a configuration file. It will attempt to load the file .openshift/redis.conf
if it exists. The default configuration will snapshot the db to disk into the $OPENSHIFT_DATA_DIR/.redis/dbs
directory.
At cart creation, a unique password will be generated to the environment variable REDIS_PASSWORD
- the server will require this to connect.
To access redis-cli
from the SSH session, use the $REDIS_CLI environment variable to get the correct config on the gear
$ ssh <gear with redis>
Connectiing to....
$ redis-cli $REDIS_CLI
127.0.32.124 6379>
To connect to Redis from your local shell, run the cartridge-status
command to get the port and authorization info:
$ rhc cartridge-status redis -a <yourapp>
RESULT:
Redis is running
master (receives writes), mode sharded
Connect to: 343928-abc.dev.rhcloud.com:35546 password: 80o9euk80oeu90834
and then run rhc port-forward
to your app:
$ rhc port-forward <yourapp>
....
redis 127.0.0.1:35546 => 343928-abc.dev.rhcloud.com:35546
In another shell window, run redis-cli
$ redis-cli -p 35546 -a 80o9euk80oeu90834
redis 127.0.0.1:35546>
A number of Redis configuration values can be tuned via environment variables:
-
REDIS_URL
The complete URL for accessing Redis, used by Rails and Sidekiq.
-
REDIS_PASSWORD
The password for accessing Redis.
-
REDIS_MAXMEMORY
The maximum memory this instance will allow. No default value.
-
REDIS_APPENDONLY
The value of
appendonly
in redis.conf. Defaults to 'no' -
REDIS_APPENDFSYNC
The value of
appendfsync
in redis.conf. Defaults to 'everysec'
Always restart each gear after setting these environment variables.
If you install this cartridge from source, you will be using a precompiled version of Redis 2.6 for RHEL6. You can run the bin/control update
script on each gear to build and update to the latest version of the Redis 2.6 tree.
$ rhc ssh <yourapp> --gears 'cd redis && ./bin/control update'
$ rhc restart-cartridge redis -a <yourapp>'
We hope to add a more natural update process at a later point.