# HG changeset patch # User Brian Neal # Date 1420330968 21600 # Node ID a423e8fd082ddcd3190635a297249daa6fb79fc2 # Parent fb0d2871afa480baa05d235ac4fc5fdf017fb8cc Access redis via UNIX socket. diff -r fb0d2871afa4 -r a423e8fd082d core/services.py --- a/core/services.py Sat Jan 03 14:24:52 2015 -0600 +++ b/core/services.py Sat Jan 03 18:22:48 2015 -0600 @@ -11,11 +11,15 @@ REDIS_HOST = getattr(settings, 'REDIS_HOST', 'localhost') REDIS_PORT = getattr(settings, 'REDIS_PORT', 6379) REDIS_DB = getattr(settings, 'REDIS_DB', 0) +REDIS_SOCKET = getattr(settings, 'REDIS_UNIX_SOCKET', None) -def get_redis_connection(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB): +def get_redis_connection(host=REDIS_HOST, port=REDIS_PORT, db=REDIS_DB, + unix_socket_path=REDIS_SOCKET): """ Create and return a Redis connection using the supplied parameters. """ + if unix_socket_path: + return redis.StrictRedis(unix_socket_path=unix_socket_path, db=db) return redis.StrictRedis(host=host, port=port, db=db) diff -r fb0d2871afa4 -r a423e8fd082d requirements.txt --- a/requirements.txt Sat Jan 03 14:24:52 2015 -0600 +++ b/requirements.txt Sat Jan 03 18:22:48 2015 -0600 @@ -9,7 +9,7 @@ bleach==1.4 pytz==2013b queued-search==2.1.0 -queues==0.6.3 +hg+https://bgneal@bitbucket.org/bgneal/queues@862e884#egg=queues redis==2.7.2 repoze.timeago==0.5 -e git+https://github.com/notanumber/xapian-haystack.git@37add92bc43fe50bf165e91f370269c26272f1eb#egg=xapian_haystack-dev diff -r fb0d2871afa4 -r a423e8fd082d requirements_dev.txt --- a/requirements_dev.txt Sat Jan 03 14:24:52 2015 -0600 +++ b/requirements_dev.txt Sat Jan 03 18:22:48 2015 -0600 @@ -10,7 +10,7 @@ bleach==1.4 pytz==2013b queued-search==2.1.0 -queues==0.6.3 +hg+https://bgneal@bitbucket.org/bgneal/queues@862e884#egg=queues redis==2.7.2 repoze.timeago==0.5 -e git+https://github.com/notanumber/xapian-haystack.git@37add92bc43fe50bf165e91f370269c26272f1eb#egg=xapian_haystack-master diff -r fb0d2871afa4 -r a423e8fd082d sg101/settings/base.py --- a/sg101/settings/base.py Sat Jan 03 14:24:52 2015 -0600 +++ b/sg101/settings/base.py Sat Jan 03 18:22:48 2015 -0600 @@ -202,14 +202,13 @@ ####################################################################### # Redis integration & settings ####################################################################### -REDIS_HOST = 'localhost' -REDIS_PORT = 6379 +REDIS_UNIX_SOCKET = '/var/run/redis/redis.sock' REDIS_DB = 0 ####################################################################### # Celery integration & settings ####################################################################### -BROKER_URL = 'redis://localhost:6379/1' +BROKER_URL = 'redis+socket:///var/run/redis/redis.sock?virtual_host=1' BROKER_POOL_LIMIT = 10 CELERY_TIMEZONE = TIME_ZONE @@ -301,7 +300,7 @@ # Asynchronous settings (queues, queued_search, redis, celery, etc) ####################################################################### QUEUE_BACKEND = 'redisd' -QUEUE_REDIS_CONNECTION = 'localhost:6379' +QUEUE_REDIS_UNIX_SOCKET = REDIS_UNIX_SOCKET QUEUE_REDIS_DB = 0 #######################################################################