Redis初学笔记

1、官网概述

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) 与范围查询, bitmapshyperloglogs地理空间(geospatial) 索引半径查询。 Redis 内置了 复制(replication)LUA脚本(Lua scripting)LRU驱动事件(LRU eviction)事务(transactions) 和不同级别的 磁盘持久化(persistence), 并通过 Redis哨兵(Sentinel)和自动 分区(Cluster)提供高可用性(high availability)。

 

redis与memcached的区别

  • memcached只提供数据内存缓存服务,如服务器宕机,则数据丢失
  • memcached在集群服务时,有多台服务器一起提供统一内存存储,数据是分散在不同服务器上,通过键名hash方式去寻址,一旦某服务器宕机,则丢失其上数据
  • memcached没有提供任何形式的数据持久化功能,而redis提供支持
  • redis支持主从复制模式,保证了数据可靠
  • redis提供了更为丰富的数据存储结构

2、redis文件说明

  • redis-benchmark.exe:Redis性能测试工具,测试Redis在你的系统及你的配置下的读写性能
  • redis-check-aof.exe:更新日志检查
  • redis-check-dump.exe:本地数据库检查
  • redis-cli:Redis命令行操作工具。当然,你也可以用telnet根据其纯文本协议来操作
  • redis-server:Redis服务器的daemon启动程序,主服务程序
  • redis.windows.conf:运行配置文件
  • dump.rdb:数据持久化至硬盘的默认文件

3、运行

  • 启动服务守护程序, cmd下运行 redis-server.exe  redis.windows.conf 或 redis-server.exe (注意:此方式命令窗口须保持打开状态,如关闭则redis服务也会被关闭

2016-3-23 14-48-16    2016-3-23 14-53-51

  • redis-server --service-start (启动redis服务) / redis-server --service-stop (停止redis服务)

2016-3-23 14-57-39

3、客户端连接

  • 自带的redis-cli.exe,cmd下运行

2016-3-23 15-17-59

  • 可视化图形客户端RedisDesktopManager

http://redisdesktop.com/

https://github.com/uglide/RedisDesktopManager

4、其他说明

Redis中的数据库是通过数字来进行命名的,缺省情况下打开的数据库为0。如果程序在运行过程中打算切换数据库,可以使用Redis的select命令来打开其他数据库,如select 1,如果此后还想再切换回缺省数据库,只需执行select 0即可。

 

5、参考资料

http://redis.io/

http://www.redis.cn/

http://www.cnblogs.com/huangxincheng/category/755864.html

http://www.cnblogs.com/caokai520/p/4409712.html

http://www.cnblogs.com/yangecnu/p/Introduct-Redis-in-DotNET.html

http://blog.csdn.net/joyhen/article/details/47358999

posted @ 2016-03-23 15:33  行野摄色  阅读(303)  评论(0编辑  收藏  举报