环境介绍: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