Skip to content

Instantly share code, notes, and snippets.

@sumitdhameja
Created February 27, 2016 17:15
Show Gist options
  • Save sumitdhameja/168dda54c38d4c98d603 to your computer and use it in GitHub Desktop.
Save sumitdhameja/168dda54c38d4c98d603 to your computer and use it in GitHub Desktop.
Install Redis
#---------------------------
# Build Redis from Source
#---------------------------
echo "[-] Install Redis Requirements"
apt-get install -y build-essential tcl8.5
echo "[-] Install Redis Server"
echo " Download Source"
wget http://download.redis.io/releases/redis-2.8.9.tar.gz
tar xzf redis-2.8.9.tar.gz
rm !!:2
echo " Build Source"
cd redis-2.8.9
make
# make test
make install
#---------------------------
# Configure Redis
#---------------------------
echo " Setup Service"
cd utils
# Redis on 6366 - For Bidder Data
cp install_server.sh 6366.sh
sed -i "s/^read /#read /g" 6366.sh
sed -i "s/^#read -r/read -r/g" 6366.sh
sed -i "s/_REDIS_PORT=6379/_REDIS_PORT=6366/g" 6366.sh
#---------------------------
# Setup Redis
#---------------------------
./6366.sh
update-rc.d redis_6366 defaults
sed -i "s|# unixsocket /.*|unixsocket /tmp/redis_6366.sock|g" /etc/redis/6366.conf
sed -i "s|# unixsocketperm .*|unixsocketperm 777|g" /etc/redis/6366.conf
service redis_6366 stop
service redis_6366 start
# If it's slave server
# echo " Setup Redis Salve"
# echo "slaveof redis.master 6366" >> /etc/redis/6366.conf
#---------------------------
# Load Test Redis
#---------------------------
# Normal TCP
redis-benchmark -q -n 100000 -p 6366
# TCP with Pipelining
redis-benchmark -q -n 100000 -P 16 -p 6366
# Normal Unix Socket
redis-benchmark -q -n 100000 -s /tmp/redis_6366.sock
# Unix Socket with Pipelining
redis-benchmark -q -n 100000 -P 16 -s /tmp/redis_6366.sock
# Just SET and LPUSH performance
redis-benchmark -q -n 100000 -t set,lpush -p 6366
# Clear data
redis-cli -p 6366 flushall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment