Build Redis service under Ubuntu14.04

There is no need to introduce the Redis service. In addition to installing directly from the software source through apt-get, it can also be compiled and installed through the source package. This article takes the redis-2.8.7.tar.gz source package as an example.


1. Installation:
Upload the redis-2.8.7.tar.gz package to the /home/itrst/software directory
cd /home/itrst/software

tar -zxf redis-2.8.7.tar.gz
cd redis
make MALLOC=libc

2. Configuration file:
cd /home/itrst/software/redis-2.8.7

vi redis.conf 

daemonize no
pidfile /var/run/redis.pid
port 6379
bind 0.0.0.0
timeout 300
tcp-keepalive 0
loglevel verbose
logfile /home/itrst /software/redis-2.8.7/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 /home/itrst/software /redis-2.8.7/data
slave-serve-stale-data yes
slave-read-only yes
repl-disable-tcp-nodelay no
slave-priority 100
maxmemory 3221225472
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
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
activerehashing yes
maxclients 12800
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
#requirepass 123456

3. Create Log and data path:
mkdir -p /home/itrst/software/redis-2.8.7/log
mkdir -p /home/itrst/software/redis-2.8.7/data

4. Start redis:
Support user
/home/itrst /software/redis-2.8.7/src/redis-server /home/itrst/software/redis-2.8.7/redis.conf

Add boot entry:
echo “/home/itrst/software/redis-2.8.7/ src/redis-server /home/itrst/software/redis-2.8.7/redis.conf
” >> /etc/rc.local

5. Redis master-slave synchronization configuration:
add the following content to the redis slave library configuration file redis.conf Available:

slaveof 200.31.147.211 6379
masterauth 123456


description: The above IP is subject to the actual environment configuration

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325686396&siteId=291194637