2.1 环境安装

2.1.1 安装

从redis.cn 下载最新redis包,3.0稳定版系列.

tar -zxvf redis-3.2.1.tar.gz
cd redis-3.2.1/

首先打开README.md,翻阅基本build和install方式。

make

尝试环境是否可以正常使用。

make test

如果出现

\o/ All tests passed without errors!

表示redis环境没有问题。

最后安装路径

sudo make install

2.1.2 启动redis

$redis-server

出现以下代表启动成功

8652:C 22 Jul 17:16:59.587 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 3.2.1 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 8652
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

8652:M 22 Jul 17:16:59.594 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
8652:M 22 Jul 17:16:59.594 # Server started, Redis version 3.2.1
8652:M 22 Jul 17:16:59.594 # 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.
8652:M 22 Jul 17:16:59.594 * The server is now ready to accept connections on port 6379

2.1.2 链接redis服务器

新开一个窗口,或者redis-server后台启动。

通过

$ redis-cli

得到

127.0.0.1:6379>
127.0.0.1:6379> ping
PONG

代表redis服务器已经正常安装并且可以使用了。

results matching ""

    No results matching ""