你的位置:首页 > 数据库

[数据库]Redis 单节点安装


Redis is an open source (BSD licensed), in-memory data structure store, used as database, cache and message broker. It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs and geospatial indexes with radius queries. Redis has built-in replication, Lua scripting, LRU eviction, transactions and different levels of on-disk persistence, and provides high availability via Redis Sentinel and automatic partitioning with Redis Cluster.

 

Redis是个开源的(BSD协议),内存数据结构存储,用来当做数据库,缓存和消息中间件。支持的数据结果有strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs和地理空间索引半径查询。Redis有内嵌副本,Lua脚本,最近最少使用回收,事物以及不同级别的硬盘持久化。通过Redis Sentinel提供高可用和Redis Cluster的自动分区。

 

官网地址:

http://www.redis.io/

 

NoSql分类:

 

数据库引擎排名网址:

http://db-engines.com/en/ranking

 

Redis可视化客户端:

RedisDesktopManager

 

Redis单节点安装

操作系统 CentOS 6.5

 

安装依赖包

yum install -y gcc tcl

 

解压安装包

tar xf redis-2.8.18.tar.gz

 

创建安装目录

mkdir -p /usr/redis

 

编译

make

然后

make install   #默认安装到/usr/local/bin

make PREFIX=/usr/redis install  #指定安装目录/usr/redis

 

Redis可执行程序:

redis-benchmark redis-check-aof redis-check-dump redis-cli redis-server

 

配置环境变量

export REDIS_HOME=/usr/redisexport PATH=$PATH:$REDIS_HOME/bin

 

安装启动服务

cd utils./install_server.sh

 

重命名服务文件

mv /etc/init.d/redis_6379 /etc/init.d/redisd

开机启动

chkconfig redisd on

启动服务

service redisd start

配置文件:

vim /etc/redis/6379.conf

# 后台服务daemonize yesport 6379# 缺省DB是0,设置DB的数目databases 16# 2种持久化方式# RDB: Redis DB 默认开启# 下面是执行快照的条件#  In the example below the behaviour will be to save:#  after 900 sec (15 min) if at least 1 key changed#  after 300 sec (5 min) if at least 10 keys changed#  after 60 sec if at least 10000 keys changedsave 900 1save 300 10save 60 10000dbfilename dump.rdb# AOF 默认关闭appendonly noappendfilename "appendonly.aof"appendfsync everysec