Redis 4.0-rc1 发布了,这是 4.0 的首个 RC 版。Redis 是一个高性能的key-value数据库。Redis 的出现,很大程度补偿了memcached这类keyvalue存储的不足,在部分场合可以对关系数据库起到很好的补充作用。它提供了Python,Ruby,Erlang,PHP客户端,使用很方便。
以下是该版本发布值得关注的内容:
Major features
-
Redis 模块化系统。Redis now allows developers to write modules that can extend the Redis functionalities and implement new data types. The module API implements a complete abstraction layer that separates the Redis core from the module implementation, allowing the same module to be loaded by different versions of Redis without modifications.
-
部分复制 (PSYNC) 版本 2。The replication protocol was enhanced (in a backward compatible way, so that 4.0 can still act as a slave of older instances) in order to be able to partially resynchronize slaves and masters in conditions where it was impossible in the past: after a master switch because of a failover and when a slave instance is restared. Even masters turned into slaves will usually be able to partially resynchronize with the new master, if the new master was a former slave of the old master instance. The way the replication work for chained slaves (sub-slaves) is now very different, and each slave receives the same replication stream generated by the top-level master.
-
缓存淘汰算法改进。Redis 4.0 implements LFU (Least Frequently Used) as a new eviction algorithm, and improves the functionality, performances and precision of the existing algorithms.
-
键的异步释放。Redis is now able to delete keys in the background in a different thread without blocking the server. The new `UNLINK` command is the same as `DEL` but working in a non blocking way. Similarly an `ASYNC` option was added to `FLUSHALL` and `FLUSHDB` in order to let the entire dataset or a single database to be freed asynchronously.
-
混合 RDB-AOF 格式。If enabled the new format is used when rewriting the AOF file: the rewrite uses the more compact and faster to generate RDB format, and an AOF stream is appended to the file. This allows faster rewrites and reloads when using the AOF persistence.
-
新的内存监控命令, able to perform memory analysis of different kinds: troubleshooting of memory issues (with MEMORY DOCTOR, similar to LATENCY DOCTOR), reporting of the amount of memory used by a single key, more in-depth reporting of Redis memory usage compared to what the INFO command offers.
-
Redis 集群对 NAT / Docker 的支持。 There are new functionalities in order to force cluster instances to announce specific sets of IP address, client and bus ports, to the rest of the cluster, regardless of the auto detected IP. This required a bus protocol change that will force users to mass-restart all the nodes of a Redis 3.2 installation in order to upgrade to 4.0.
-
Redis现在使用更少的内存,以便存储相同数量的数据。 The gain depends a lot on the kind of dataset stored.
Smaller features
-
改进 RDB 格式以支持 64 位长度,二进制排序集分数等。 The RDB file check utility now uses the same code base of the one used by Redis itself in order to load the RDB file in memory.
-
SWAPDB 命令: ability to completely and immediately (no latency) replace two Redis databases.
-
Improvements to `dict.c`, the Redis hash table implementation.
-
Security improvements mapping POST and Host: commands to QUIT in order to prevent cross protocol scripting attacks.
-
RPUSHX and LPUSHX now accept a variable number of elements.
-
Reporting of additional memory used by copy on write in the INFO output.
-
Serious refactoring of many core parts of Redis.
了解更多更新信息,查看完整发布说明:https://raw.githubusercontent.com/antirez/redis/4.0/00-RELEASENOTES