Linux(Redhat)下redis安装

原文:http://www.javaweb1024.com/data/NoSQL/2015/06/29/785.htmlhtml

redis是当前比较热门的NOSQL系统之一,它是一个key-value存储系统。和Memcached相似,但很大程度补偿了memcached的不足,它支持存储的value类型相对更多,包括string、list、set、zset和hash。这些数据类型都支持push/pop、add/remove及取交集并集和差集及更丰富的操做。在此基础上,redis支持各类不一样方式的排序。Redis数据都是缓存在计算机内存中,而且会周期性的把更新的数据写入磁盘或者把修改操做写入追加的记录文件。java

版本:3.0.2web

下载地址:http://download.redis.io/releases/redis-3.0.2.tar.gzredis

下载完之后,放在/home目录下缓存

[root@localhost home]# tar -zxvf redis-3.0.2.tar.gzmemcached

附:我把名字默认目录redis-3.0.2 改成redis测试

[root@localhost home]# cd redisthis

[root@localhost redis]# makeserver

启动 redis 与以前版本不同, redis的启动放在src下htm

[root@localhost src]# ./redis-server ../redis.conf

出现

8169:M 28 Jun 20:48:09.191 * Increased maximum number of open files to 10032 (it was originally set to 1024).

8169:M 28 Jun 20:48:09.199 # Warning: 32 bit instance detected but no memory limit set. Setting 3 GB maxmemory limit with 'noeviction' policy now.

                _._                                                 

           _.-``__ ''-._                                            

      _.-``    `.  `_.  ''-._           Redis 3.0.2 (00000000/0) 32 bit

  .-`` .-```.  ```\/    _.,_ ''-._                                  

 (    '      ,       .-`  | `,    )     Running in standalone mode

 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379

 |    `-._   `._    /     _.-'    |     PID: 8169

  `-._    `-._  `-./  _.-'    _.-'                                  

 |`-._`-._    `-.__.-'    _.-'_.-'|                                 

 |    `-._`-._        _.-'_.-'    |           http://redis.io       

  `-._    `-._`-.__.-'_.-'    _.-'                                  

 |`-._`-._    `-.__.-'    _.-'_.-'|                                 

 |    `-._`-._        _.-'_.-'    |                                 

  `-._    `-._`-.__.-'_.-'    _.-'                                  

      `-._    `-.__.-'    _.-'                                      

          `-._        _.-'                                          

              `-.__.-'                                              

 

8169:M 28 Jun 20:48:09.199 # Server started, Redis version 3.0.2

8169:M 28 Jun 20:48:09.200 # 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.

8169:M 28 Jun 20:48:09.200 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.

8169:M 28 Jun 20:48:09.200 * The server is now ready to accept connections on port 6379

8169:M 28 Jun 21:03:10.091 * 1 changes in 900 seconds. Saving...

8169:M 28 Jun 21:03:10.093 * Background saving started by pid 8311

8311:C 28 Jun 21:03:10.111 * DB saved on disk

8311:C 28 Jun 21:03:10.113 * RDB: 0 MB of memory used by copy-on-write

8169:M 28 Jun 21:03:10.193 * Background saving terminated with success

测试

[root@localhost src]# ./redis-cli

127.0.0.1:6379> set foo 1

OK

127.0.0.1:6379> get foo

"1"

127.0.0.1:6379> TYPE foo

string

127.0.0.1:6379>

表示成功