首页 > 其他 > 详细

Redis安装

时间:2015-10-10 20:15:15      阅读:323      评论:0      收藏:0      [点我收藏+]

环境介绍:CentOS 6.5 64位
参考链接:http://redis.io/download
1,下载redis3.0.2
[root@]# wget http://download.redis.io/releases/redis-3.0.2.tar.gz  
[root@]# ls  
redis-3.0.2.tar.gz
2,解压并编译
[root@]# $ tar xzf redis-3.0.2.tar.gz  
[root@]# ls  
redis-3.0.2  redis-3.0.2.tar.gz
[root@]# cd redis-3.0.2  

[root@redis-3.0.2]# make

[root@redis-3.0.2]# make install

安装完成后再linux系统执行

#redis-(按tab键),如果和下图一样,可以进行第3步了

技术分享

3,运行redis
1).开启Server进程
[root@redis-3.0.2]# ./src/redis-server  
15:48:49[root@vstar75 src]# ./redis-server 
15:48:4917908:C 05 Jun 15:48:57.313 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
15:48:49                _._                                                  
15:48:49           _.-``__ ‘‘-._                                             
15:48:49      _.-``    `.  `_.  ‘‘-._           Redis 3.0.2 (00000000/0) 64 bit
15:48:49  .-`` .-```.  ```\/    _.,_ ‘‘-._                                   
15:48:49 (    ‘      ,       .-`  | `,    )     Running in standalone mode
15:48:49 |`-._`-...-` __...-.``-._|‘` _.-‘|     Port: 6379
15:48:49 |    `-._   `._    /     _.-‘    |     PID: 17908
15:48:49  `-._    `-._  `-./  _.-‘    _.-‘                                   
15:48:49 |`-._`-._    `-.__.-‘    _.-‘_.-‘|                                  
15:48:49 |    `-._`-._        _.-‘_.-‘    |           http://redis.io        
15:48:49  `-._    `-._`-.__.-‘_.-‘    _.-‘                                   
15:48:49 |`-._`-._    `-.__.-‘    _.-‘_.-‘|                                  
15:48:49 |    `-._`-._        _.-‘_.-‘    |                                  
15:48:49  `-._    `-._`-.__.-‘_.-‘    _.-‘                                   
15:48:49      `-._    `-.__.-‘    _.-‘                                       
15:48:49          `-._        _.-‘                                           
15:48:49              `-.__.-‘                                               
15:48:49
15:48:4917908:M 05 Jun 15:48:57.315 # Server started, Redis version 3.0.2
15:48:4917908:M 05 Jun 15:48:57.316 # 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.
15:48:4917908:M 05 Jun 15:48:57.316 # 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.
15:48:4917908:M 05 Jun 15:48:57.316 * The server is now ready to accept connections on port 6379 
2).关闭Server进程

[root@redis-3.0.2]#./redis-cli shutdown

或者登入客户端进行关闭

[root@redis-3.0.2]#./redis-cli 

127.0.0.1:6379> shutdown
not connected> 

4.程序验证:
[root@vstar75 src]# ./redis-cli 
127.0.0.1:6379> set MyName ‘Jacson.Bai‘
OK
127.0.0.1:6379> get MyName
"Jacson.Bai"

127.0.0.1:6379> 

技术分享

5:以启动参数方式启动Serverredis.conf
[root@redis-3.0.2]# ./src/redis-server redis.conf

Redis安装

原文:http://my.oschina.net/u/1425545/blog/515374

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!