Redis安装

环境介绍:CentOS 6.5 64位

redis版本:3.0.2

参考链接:http://redis.io/download

1,下载redis3.0.2,并安装安装依存环境包

[root@]# yum -y install tcl

[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

 

这一步推荐必做,可以检查出redis潜在异常

[root@redis-3.0.2]# make test

[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 

 

参数优化:echo 'vm.overcommit_memory=1' >> /etc/sysctl.conf

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 

 

我已经写好了,一键部署脚本,如有需要,请及时QQ:342930411

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值