New to Valkey? This guide walks you through the basics and helps you get up and running.
Starting with new tech can feel overwhelming, but if you’re ready to explore Valkey, you probably want answers, not some fancy sales pitch.
Let’s cut to the chase: Switching tools or trying something new should never slow you down, and Valkey isn’t going to do that.
Valkey is here to give you options, not obstacles. After all, Valkey is open source and community-driven, and it has quickly become a practical choice for teams that want control without headaches.
This post is for anyone who likes to roll up their sleeves and get things working. You’ll find simple steps to get Valkey up and running, along with some quick tips to help you feel at home. We’ll keep it straightforward and actionable, so you can spend less time hunting for answers and more time getting results.
Ready to see what Valkey can do for you?
Valkey is a modern, open source data store that keeps things simple. If you’ve used Redis, you’ll feel right at home. Valkey lets you store and retrieve data at high speed, whether you’re powering real-time dashboards, caching, or just need something dependable behind the scenes.
The big difference? Valkey is genuinely open source, governed by the Linux Foundation, released under a BSD license, and backed by a community that believes in keeping things open. For everyone.
Translation: No messy licensing. No vendor tricks. No surprises down the road.
If you’re looking for a tool that’s fast, familiar, built on open principles, and has comparable enterprise Redis features, Valkey is an easy choice. You gain the freedom to build, experiment, and scale without worrying about lock-in or unexpected changes. It’s a solid foundation you can count on, whether you’re starting fresh or making a switch.
True open source freedom: With its BSD license and Linux Foundation governance, Valkey offers genuine open source benefits: no vendor lock-in, predictable costs, and complete strategic control over your infrastructure.
Expert performance: Built by experienced former Redis maintainers with backing from industry leaders like AWS, Google Cloud, and Percona, Valkey delivers proven performance with continuous innovation.
Drop-in compatibility: Valkey maintains compatibility with Redis, making migration straightforward and offering the peace of mind that comes with true open source licensing.
The fastest way to get Valkey running? Docker. Here’s how to get started in under two minutes:
|
1 |
# Pull the official Valkey image<br>docker pull valkey/valkey:9.0.0<br><br># Run Valkey in a container<br>docker run --name my-valkey -p 6379:6379 -d valkey/valkey:9.0.0<br><br># Connect to Valkey CLI<br>docker exec -it my-valkey valkey-cli<br> |
For production environments, you’ll want to install Valkey directly on your system:
Ubuntu/Debian:
|
1 |
# Download and install from official releases<br>https://download.valkey.io/releases/valkey-9.0.0-jammy-x86_64.tar.gz<br>tar -xvzf valkey-9.0.0-jammy-x86_64.tar.gz<br>cd valkey-9.0.0-jammy-x86_64/<br><br>bin/valkey-server &<br>bin/valkey-cli<br> |
Fedora/RHEL:
|
1 |
# Available through EPEL repository<br>sudo dnf install valkey<br>sudo systemctl start valkey<br>valkey-cli<br> |
You should see the Valkey prompt: 127.0.0.1:6379>
Now that you’re connected, let’s explore what makes Valkey so powerful. At its core, Valkey stores key-value pairs, but it also supports several sophisticated data types.
Strings are the most basic data type, perfect for caching simple values:
|
1 |
# Store a value<br>127.0.0.1:6379> SET user:1001 "Alice Johnson"<br>OK<br><br># Retrieve a value<br>127.0.0.1:6379> GET user:1001<br>"Alice Johnson"<br><br># Store with expiration (TTL in seconds)<br>127.0.0.1:6379> SETEX session:abc123 3600 "user_data"<br>OK<br><br># Check remaining time<br>127.0.0.1:6379> TTL session:abc123<br>(integer) 3595<br> |
Valkey automatically, and atomically, handles numeric operations:
|
1 |
# Store and increment counters<br>127.0.0.1:6379> SET page_views 1000<br>OK<br>127.0.0.1:6379> INCR page_views<br>(integer) 1001<br>127.0.0.1:6379> INCRBY page_views 10<br>(integer) 1011<br> |
Lists are perfect for queues, recent activity feeds, or ordered collections:
|
1 |
# Add items to a list (left push)<br>127.0.0.1:6379> LPUSH recent_orders "order_123" "order_124" "order_125"<br>(integer) 3<br><br># View the entire list<br>127.0.0.1:6379> LRANGE recent_orders 0 -1<br>1) "order_125"<br>2) "order_124"<br>3) "order_123"<br>Note: When LPUSH is given multiple arguments, it pushes them to the head of the list one by one, from left to right. This is why order_125 (the last argument) appears first in the list.<br><br># Remove and return the first item (great for job queues)<br>127.0.0.1:6379> LPOP recent_orders<br>"order_125"<br> |
Hashes are ideal for storing objects with multiple fields:
|
1 |
# Store user information<br>127.0.0.1:6379> HSET user:1002 name "Alice Johnson" email "[email protected]" status "active"<br>(integer) 3<br><br># Get specific fields<br>127.0.0.1:6379> HGET user:1002 email<br>"[email protected]"<br><br># Get all fields<br>127.0.0.1:6379> HGETALL user:1002<br>1) "name"<br>2) "Alice Johnson"<br>3) "email"<br>4) "[email protected]"<br>5) "status"<br>6) "active"<br> |
|
1 |
# Cache expensive database query results<br>127.0.0.1:6379> SET query:popular_products '[{"id":1,"name":"Widget A"},{"id":2,"name":"Widget B"}]'<br># Cache for 5 minutes<br>127.0.0.1:6379> EXPIRE query:popular_products 300<br> |
|
1 |
# Store user session data<br>127.0.0.1:6379> HSET session:user123 user_id 123 login_time 1640995200 last_active 1640998800<br># Session expires in 24 hours<br>127.0.0.1:6379> EXPIRE session:user123 86400 |
|
1 |
# Simple rate limiting (10 requests per minute)<br># Set if not exists, expire in 60 seconds<br>127.0.0.1:6379> SET rate_limit:user123 1 EX 60 NX<br>127.0.0.1:6379> INCR rate_limit:user123 |
|
1 |
# Track daily active users<br>127.0.0.1:6379> SADD daily_active_users:2024-01-15 user123 user456 user789<br># Count unique users<br>127.0.0.1:6379> SCARD daily_active_users:2024-01-15 |
Here are the most important commands you’ll use regularly:
Data operations:
Information commands:
List operations:
While this guide gets you started with Valkey basics, running Valkey in production requires careful configuration, security hardening, backup strategies, and performance tuning.
For comprehensive coverage of these critical production topics, check out our Valkey Configuration and Best Practices Guide. This detailed resource walks you through enterprise-grade Valkey deployments, complete with configuration examples, monitoring strategies, and migration guidance.
Valkey offers a powerful, truly open source solution for in-memory data storage. With its familiar Redis-compatible API, strong performance characteristics, and freedom from licensing restrictions, it’s an excellent choice for modern applications requiring fast data access.
Start experimenting with the commands in this guide, then advance to our comprehensive guide to build production-ready Valkey deployments with confidence. And if you have questions or run into anything unexpected, we’re always here to help.
Ready to go deeper? Read the Valkey Configuration and Best Practices Guide to learn more.