Redis学习总结之一——Redis初入

时间:2023-01-26 18:19:57
  • Redis简介

Redis是一个开源的使用ANSI C语言编写、支持网络、可基于内存亦可持久化的日志型、Key-Value数据库,并提供多种语言的API。

Redis是一个key-value存储系统。和Memcached类似,它支持存储的value类型相对更多,包括string(字符串)、list(链表)、set(集合)、zset(sorted set --有序集合)和hash(哈希类型)。这些数据类型都支持push/pop、add/remove及取交集并集和差集及更丰富的操作,而且这些操作都是原子性的。在此基础上,redis支持各种不同方式的排序。与memcached一样,为了保证效率,数据都是缓存在内存中。区别的是redis会周期性的把更新的数据写入磁盘或者把修改操作写入追加的记录文件,并且在此基础上实现了master-slave(主从)同步。

  • Redis相关资源下载
  1. Redis官网:http://redis.io/
  2. Redis Linux版下载:http://redis.io/download
  3. Redis Windows版下载:https://github.com/MSOpenTech/redis
  4. Redis 连接工具Windows版:http://redisdesktop.com/download
  • Windows下启动Redis服务
  1. 打开cmd进入redis的bin目录
  2. 输入命令:
redis-server redis.conf

若出现如下提示:

The Windows version of Redis allocates a memory mapped heap for sharing with
the forked process used for persistence operations. In order to share this
memory, Windows allocates from the system paging file a portion equal to the
size of the Redis heap. At this time there is insufficient contiguous free
space available in the system paging file for this operation (Windows error
0x5AF). To work around this you may either increase the size of the system
paging file, or decrease the size of the Redis heap with the --maxheap flag.
Sometimes a reboot will defragment the system paging file sufficiently for
this operation to complete successfully. Please see the documentation included with the binary distributions for more
details on the --maxheap flag. Redis can not continue. Exiting.

则可加入参数:--maxheap 100M;或在配置文件redis.conf中末尾增加maxheap 100M。