From 834d5aa6137ac518b80183ddae6194d07e389106 Mon Sep 17 00:00:00 2001 From: Eamonn O'Toole Date: Thu, 25 Sep 2014 11:19:34 +0100 Subject: [PATCH] Fix memcache listen port setting on debian-based OSes On debian-based systems, we need to set "-l 0.0.0.0" in /etc/memcached.conf. This is to avoid memcached connection errors, for instance when running the Swift proxy code. RedHat-based systems already have this setting by default. Change-Id: Ie8837cffdff7d384cabf5deff7811eebd4968e2c --- elements/memcached/README.md | 5 +++++ elements/memcached/install.d/74-memcached | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/elements/memcached/README.md b/elements/memcached/README.md index 45873f699..3a929af44 100644 --- a/elements/memcached/README.md +++ b/elements/memcached/README.md @@ -1,2 +1,7 @@ Element to install memcached +On debian-based systems, we need to set "-l 0.0.0.0" in +/etc/memcached.conf. This is to avoid memcached +connection errors, for instance when running the Swift +proxy code. RedHat-based systems already have this +setting by default. diff --git a/elements/memcached/install.d/74-memcached b/elements/memcached/install.d/74-memcached index b2f9b8462..55ec1e025 100755 --- a/elements/memcached/install.d/74-memcached +++ b/elements/memcached/install.d/74-memcached @@ -3,4 +3,12 @@ set -eux install-packages memcached + +# On debian-based distros set memcached daemon to listen on port 0.0.0.0 +# This is the default on RedHat-based distros. +# Without this setting the memcached daemon will suffer connection errors +if [[ "ubuntu debian" =~ "$DISTRO_NAME" ]]; then + sed -i -r "s/\-l( )*(([0-9]{1,3}\.){3}[0-9]{1,3})/\-l 0\.0\.0\.0/" /etc/memcached.conf +fi + os-svc-enable -n memcached