1、编译

1
2
3
4
5
6
7
wget http://download.redis.io/releases/redis-5.0.3.tar.gz
tar -xvf redis-5.0.3.tar.gz
cd redis-5.0.3
# 编译
make
# 安装
make PREFIX=/usr/local/redis install

2、启动

1
2
cp /data/install/redis-5.0.3/redis.conf /usr/local/redis
/usr/local/redis/bin/redis-server /usr/local/redis/redis.conf
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
[root@localhost redis]# /usr/local/redis/bin/redis-server /usr/local/redis/redis.conf
7879:C 31 Jan 2019 16:25:37.691 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
7879:C 31 Jan 2019 16:25:37.691 # Redis version=5.0.3, bits=64, commit=00000000, modified=0, pid=7879, just started
7879:C 31 Jan 2019 16:25:37.691 # Configuration loaded
7879:M 31 Jan 2019 16:25:37.693 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 5.0.3 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 7879
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

7879:M 31 Jan 2019 16:25:37.697 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
7879:M 31 Jan 2019 16:25:37.697 # Server initialized
7879:M 31 Jan 2019 16:25:37.697 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
7879:M 31 Jan 2019 16:25:37.712 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
7879:M 31 Jan 2019 16:25:37.712 * Ready to accept connections
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#!/bin/bash
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
   echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
echo 1 > /proc/sys/vm/overcommit_memory
echo 511 > /proc/sys/net/core/somaxconn
#echo "net.core.somaxconn = 551" > /etc/sysctl.conf
#echo "vm.overcommit_memory=1" >> /etc/sysctl.conf
ulimit -n 10032
/usr/local/redis/bin/redis-server /usr/local/redis/redis.conf

3、哨兵