您的位置:首页 > 数据库 > Redis

Redis介绍以及安装(Linux)

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

redis官网地址:http://www.redis.io/

最新版本:2.8.3

在Linux下安装Redis非常简单,具体步骤如下(官网有说明):

1、下载源码,解压缩后编译源码。

$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz $ tar xzf redis-2.8.3.tar.gz
$ cd redis-2.8.3
$ make


2、编译完成后,在Src目录下,有四个可执行文件redis-server、redis-benchmark、redis-cli和redis.conf。然后拷贝到一个目录下。

mkdir /usr/redis
cp redis-server  /usr/redis
cp redis-benchmark /usr/redis
cp redis-cli  /usr/redis

cd ..
cp redis.conf  /usr/redis
cd /usr/redis


3、启动Redis服务。

$ redis-server   redis.conf


启动界面:很卡哇伊哦
[root@localhost redis-3.0.2]# redis-server redis.conf
9152:M 10 Jun 23:06:09.930 * Increased maximum number of open files to 10032 (it was originally set to 1024).
_._
_.-``__ ''-._
_.-``    `.  `_.  ''-._           Redis 3.0.2 (00000000/0) 64 bit
.-`` .-```.  ```\/    _.,_ ''-._
(    '      ,       .-`  | `,    )     Running in standalone mode
|`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
|    `-._   `._    /     _.-'    |     PID: 9152
`-._    `-._  `-./  _.-'    _.-'
|`-._`-._    `-.__.-'    _.-'_.-'|
|    `-._`-._        _.-'_.-'    |           http://redis.io `-._    `-._`-.__.-'_.-'    _.-'
|`-._`-._    `-.__.-'    _.-'_.-'|
|    `-._`-._        _.-'_.-'    |
`-._    `-._`-.__.-'_.-'    _.-'
`-._    `-.__.-'    _.-'
`-._        _.-'
`-.__.-'

9152:M 10 Jun 23:06:09.932 # Server started, Redis version 3.0.2
9152:M 10 Jun 23:06:09.932 # 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.
9152:M 10 Jun 23:06:09.932 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
9152:M 10 Jun 23:06:09.933 * The server is now ready to accept connections on port 6379


4、然后用客户端测试一下是否启动成功。

$ redis-cli
redis> set foo bar
OK
redis> get foo
"bar"
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: