redis 安装

下载:https://redis.io/download

选择稳定版本

[root@localhost opt]# tar xvf redis-3.2.8.tar.gz

root@localhost opt]# cd redis-3.2.8

[root@localhost redis-3.2.8]# ls
00-RELEASENOTES  CONTRIBUTING  deps     Makefile   README.md   runtest          runtest-sentinel  src    utils
BUGS             COPYING       INSTALL  MANIFESTO  redis.conf  runtest-cluster  sentinel.conf     tests

直接make就可以了
[root@localhost redis-3.2.8]# make 
[root@localhost redis-3.2.8]# make PREFIX=/usr/local/redis install   #安装到指定目录
cd src && make install
make[1]: Entering directory `/opt/redis-3.2.8/src'

Hint: It's a good idea to run 'make test' ;)

    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
    INSTALL install
make[1]: Leaving directory `/opt/redis-3.2.8/src'
[root@localhost bin]# pwd
/usr/local/redis/bin
[root@localhost bin]# ls -1
redis-benchmark         redis性能测试工具
redis-check-aof         检查aof日志工具
redis-check-rdb         检查rdb日志工具
redis-cli               连接用的客户端
redis-sentinel            
redis-server            redis服务进程
[root@localhost bin]#  cp /opt/redis-3.2.8/redis.conf  .
[root@localhost redis]#  ./bin/redis-server  ./bin/redis.conf 
7487:M 30 Mar 01:45:36.130 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.2.8 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 7487
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

7487:M 30 Mar 01:45:36.157 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
7487:M 30 Mar 01:45:36.157 # Server started, Redis version 3.2.8
7487:M 30 Mar 01:45:36.157 # 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.
7487:M 30 Mar 01:45:36.157 # 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.
7487:M 30 Mar 01:45:36.157 * The server is now ready to accept connections on port 6379
[root@localhost bin]# ./redis-cli 
127.0.0.1:6379> set name wwb
OK
127.0.0.1:6379> get name
"wwb"

让redis server后台运行

[root@localhost bin]# grep daemonize  redis.conf 
# Note that Redis will write a pid file in /var/run/redis.pid when daemonized.
daemonize  yes
# When the server runs non daemonized, no pid file is created if none is
# specified in the configuration. When the server is daemonized, the pid file
# output for logging but daemonize, logs will be sent to /dev/null
[root@localhost redis]# ./bin/redis-server  ./bin/redis.conf 
[root@localhost redis]# netstat -nalp | grep redis
tcp        0      0 127.0.0.1:6379              0.0.0.0:*                   LISTEN      7538/./bin/redis-se 

 

posted @ 2017-03-30 15:58  Time.catcher  阅读(249)  评论(0编辑  收藏  举报