Redis 实践

发布于 2015-09-26 / Linux / 0条评论 / 2,720浏览

上次折腾了半天把memcached简单的按照网上的教程实践了一把,其实之前我就知道Redis这么一个东西的,网络上都说这个比memcached好,但是还是看实际情况的
不多说了,开始折腾吧。GO
我一直都是偏爱CentOS,现在开始也随大流用Ubuntu
之前的 yum 比现在的 ‘apt-get’ or ‘sudo apt-get’ 拼写简单好多。。。
真的要进入正文了
安装

#apt-get install redis-server

启动

#redis-server
[11591] 28 Sep 23:07:28.103 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 2.8.4 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in stand alone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 11591
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

[11591] 28 Sep 23:07:28.106 # Server started, Redis version 2.8.4
[11591] 28 Sep 23:07:28.106 # 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.
[11591] 28 Sep 23:07:28.106 * The server is now ready to accept connections on port 6379

Ctrl+C
这样就安装好了。。
玩一把

#redis-cli
127.0.0.1:6379> set name 'denghb'
OK
127.0.0.1:6379> get name
"denghb"
127.0.0.1:6379> 

感觉又水了一篇,在官网找到一个redis命令文档commands有兴趣的可以去研究

评论
站长统计