Install and configure mcrouter.

This commit is contained in:
Brian Simpson
2015-12-21 16:08:19 -08:00
parent 55343c4e91
commit bc74b3205a
2 changed files with 59 additions and 0 deletions

View File

@@ -197,6 +197,7 @@ make
optipng
jpegoptim
mcrouter
memcached
postgresql
postgresql-client
@@ -294,6 +295,50 @@ fi
sudo -u postgres psql reddit < $REDDIT_HOME/src/reddit/sql/functions.sql
###############################################################################
# Configure mcrouter
###############################################################################
if [ ! -d /etc/mcrouter ]; then
mkdir -p /etc/mcrouter
fi
if [ ! -f /etc/mcrouter/global.conf ]; then
cat > /etc/mcrouter/global.conf <<MCROUTER
{
// route all valid prefixes to the local memcached
"pools": {
"local": {
"servers": [
"127.0.0.1:11211",
],
"protocol": "ascii",
"keep_routing_prefix": false,
},
},
"route": {
"type": "PrefixSelectorRoute",
"policies": {
"rend:": {
"type": "PoolRoute",
"pool": "local",
},
"page:": {
"type": "PoolRoute",
"pool": "local",
},
"pane:": {
"type": "PoolRoute",
"pool": "local",
},
},
"wildcard": {
"type": "NullRoute",
},
},
}
MCROUTER
fi
###############################################################################
# Configure RabbitMQ
###############################################################################

View File

@@ -0,0 +1,14 @@
description "Memcache protocol router for scaling Memcached deployments."
start on networking or starting reddit-paster
stop on runlevel [!2345]
respawn
respawn limit 10 5
setuid Debian-mcrouter
setgid Debian-mcrouter
script
exec /usr/bin/mcrouter -f /etc/mcrouter/global.conf -R /././ -p 5050 --stats-root=/var/mcrouter/stats
end script