# Valkey — Open Source Distributed Key-Value Database > Valkey is a community-driven fork of Redis (post-license change) maintained by the Linux Foundation. Fully compatible with Redis APIs and data formats. The open-source successor for Redis workloads including caching, sessions, queues, and pub/sub. ## Install Save in your project root: ## Quick Use ```bash # Install brew install valkey # macOS sudo apt install valkey-server # Debian/Ubuntu docker run -d --name valkey -p 6379:6379 valkey/valkey:8 # Connect (same CLI as Redis) valkey-cli # Or redis-cli works too redis-cli -p 6379 ``` Usage (identical to Redis): ``` > SET greeting "hello from valkey" OK > GET greeting "hello from valkey" > HSET user:1 name William role admin > HGETALL user:1 > ZADD leaderboard 100 alice 200 bob 150 carol > ZREVRANGE leaderboard 0 -1 WITHSCORES > PUBLISH channel:events "new asset published" > SUBSCRIBE channel:events ``` ## Intro Valkey is an open-source, community-driven fork of Redis, maintained under the Linux Foundation. Created in March 2024 after Redis Labs changed the Redis license from BSD to dual RSALv2 + SSPLv1. Valkey continues development as a fully open-source (BSD-3-Clause) alternative, backed by AWS, Google, Oracle, Ericsson, and many former Redis contributors. - **Repo**: https://github.com/valkey-io/valkey - **Stars**: 25K+ - **Language**: C - **License**: BSD 3-Clause ## What Valkey Does - **Full Redis compatibility** — commands, protocol, data formats - **Data structures** — strings, hashes, lists, sets, sorted sets, streams, bitmaps, HyperLogLog - **Persistence** — RDB snapshots, AOF, hybrid - **Replication** — primary-replica with automatic failover - **Cluster** — hash-slot based sharding (16384 slots) - **Pub/Sub** — channels and patterns - **Lua scripting** — embedded Lua engine - **Streams** — log-based data structure with consumer groups - **Modules** — loadable module API (like Redis Modules) - **ACL** — fine-grained access control ## Architecture Same as Redis: single-threaded event loop with io-threads for I/O (multi-threaded I/O available). Data stored in memory with optional disk persistence. Cluster mode splits keyspace across nodes using consistent hashing (16384 slots). ## Self-Hosting ```yaml version: "3" services: valkey: image: valkey/valkey:8 ports: ["6379:6379"] volumes: - valkey-data:/data command: valkey-server --save 60 1000 --appendonly yes volumes: valkey-data: ``` ## Key Features - BSD 3-Clause (truly open source) - Full Redis command compatibility - Cluster and replication - Persistence (RDB + AOF) - Module API - Streams with consumer groups - ACL system - Linux Foundation governance - Active community development - Drop-in Redis replacement ## Comparison | Store | License | Threads | Origin | |---|---|---|---| | Valkey | BSD 3-Clause | Single + IO threads | Redis fork | | Redis | RSALv2 + SSPL | Single + IO threads | Original | | DragonflyDB | BSL 1.1 | Multi (shared-nothing) | New codebase | | KeyDB | BSD 3-Clause | Multi (shared) | Redis fork | | Garnet | MIT | Multi | Microsoft new | ## 常见问题 FAQ **Q: 和 Redis 有什么区别?** A: 功能基本一致(从 Redis 7.2 分叉)。Valkey 保持 BSD 开源,Redis 改成了 RSALv2+SSPL(限制商用托管)。Valkey 8 开始有独立新功能。 **Q: 能直接替换 Redis 吗?** A: 可以。Valkey 兼容 Redis 协议和数据文件。AWS ElastiCache/MemoryDB 已经默认切换到 Valkey。 **Q: 谁在支持?** A: Linux Foundation 下的顶级项目。AWS、Google Cloud、Oracle、Snap、Ericsson 等公司贡献代码。多位前 Redis 核心开发者参与。 ## 来源与致谢 Sources - Docs: https://valkey.io/docs - GitHub: https://github.com/valkey-io/valkey - License: BSD 3-Clause --- Source: https://tokrepo.com/en/workflows/290afcad-3641-11f1-9bc6-00163e2b0d79 Author: AI Open Source