Redis
Redis
Redis - http://redis.io/
"Redis is an open source, BSD licensed, advanced key-value cache and store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs." [1]
Install
Depenencies:
yum install make gcc jemalloc-devel
# stable curl http://download.redis.io/releases/redis-stable.tar.gz > redis-stable.tar.gz tar zxvf redis-stable.tar.gz cd redis-stable
# latest #wget http://download.redis.io/releases/redis-2.8.17.tar.gz #tar -zvxf redis-2.8.17.tar.gz #cd redis-2.8.17
make clean make #make test # need tcl
#cd src #./redis-server
cp src/redis-server /usr/local/bin cp src/redis-cli /usr/local/bin
mkdir -p /var/redis
mkdir /etc/redis cp redis.conf /etc/redis/6379.conf
# replace 10.10.10.25 with you ip address
cat > /etc/redis/redis.conf << "EOF" bind 10.10.10.25 127.0.0.1 dir /var/redis/ daemonize yes pidfile /var/run/redis.pid logfile "/var/log/redis.log" EOF
cat > /etc/redis/redis.conf << "EOF" daemonize yes pidfile /var/run/redis.pid port 6379 tcp-backlog 511 bind 0.0.0.0 timeout 0 tcp-keepalive 0 loglevel notice logfile "/var/log/redis.log" databases 16 save 900 1 save 300 10 save 60 10000 stop-writes-on-bgsave-error yes rdbcompression yes rdbchecksum yes dbfilename dump.rdb dir /var/redis/ slave-serve-stale-data yes slave-read-only yes repl-disable-tcp-nodelay no slave-priority 100 appendonly no appendfilename "appendonly.aof" appendfsync everysec no-appendfsync-on-rewrite no auto-aof-rewrite-percentage 100 auto-aof-rewrite-min-size 64mb lua-time-limit 5000 slowlog-log-slower-than 10000 slowlog-max-len 128 notify-keyspace-events "" hash-max-ziplist-entries 512 hash-max-ziplist-value 64 list-max-ziplist-entries 512 list-max-ziplist-value 64 set-max-intset-entries 512 zset-max-ziplist-entries 128 zset-max-ziplist-value 64 hll-sparse-max-bytes 3000 activerehashing yes client-output-buffer-limit normal 0 0 0 client-output-buffer-limit slave 256mb 64mb 60 client-output-buffer-limit pubsub 32mb 8mb 60 hz 10 aof-rewrite-incremental-fsync yes EOF
# diff redis.conf /etc/redis/6379.conf 37c37 < daemonize no --- > daemonize yes 64a65,66 > bind 172.31.45.18 127.0.0.1 > 103c105 < logfile "" --- > logfile "/var/log/redis.log" 187c189,190 < dir ./ --- > #dir ./ > dir /var/redis/
cp utils/redis_init_script /etc/init.d/redis
chkconfig --add redis chkconfig redis on service redis start
# set iptables for network and port 6379 iptables -A INPUT -i eth0 -p tcp -s 10.10.10.0/24 --dport 6379 -m state --state NEW,ESTABLISHED -j ACCEPT iptables -A OUTPUT -o eth0 -p tcp --sport 6379 -m state --state ESTABLISHED -j ACCEPT
Connect to server
redis-cli -h 10.10.10.25