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 …
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?
What is Valkey?
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.
Why choose Valkey over other options?
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.
Quick start: Installing Valkey
The fastest way to get Valkey running? Docker. Here’s how to get started in under two minutes:
Option 1: Docker installation (Recommended for testing)
| 12345678 | # Pull the official Valkey imagedocker pull valkey/valkey:9.0.0# Run Valkey in a containerdocker run –name my-valkey -p 6379:6379 -d valkey/valkey:9.0.0# Connect to Valkey CLIdocker exec -it my-valkey valkey-cli |
Option 2: System installation
For production environments, you’ll want to install Valkey directly on your system:
Ubuntu/Debian:
| 1234567 | # Download and install from official releaseshttps://download.valkey.io/releases/valkey-9.0.0-jammy-x86_64.tar.gztar -xvzf valkey-9.0.0-jammy-x86_64.tar.gzcd valkey-9.0.0-jammy-x86_64/bin/valkey-server &bin/valkey-cli |
Fedora/RHEL:
| 1234 | # Available through EPEL repositorysudo dnf install valkeysudo systemctl start valkeyvalkey-cli |
You should see the Valkey prompt: 127.0.0.1:6379>
Your first Valkey commands
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.
Working with strings
Strings are the most basic data type, perfect for caching simple values:
| 123456789101112131415 | # Store a value127.0.0.1:6379> SET user:1001 “Alice Johnson“OK# Retrieve a value127.0.0.1:6379> GET user:1001“Alice Johnson”# Store with expiration (TTL in seconds)127.0.0.1:6379> SETEX session:abc123 3600 “user_data“OK# Check remaining time127.0.0.1:6379> TTL session:abc123(integer) 3595 |
Working with numbers
Valkey automatically, and atomically, handles numeric operations:
| 1234567 | # Store and increment counters127.0.0.1:6379> SET page_views 1000OK127.0.0.1:6379> INCR page_views(integer) 1001127.0.0.1:6379> INCRBY page_views 10(integer) 1011 |
Working with lists
Lists are perfect for queues, recent activity feeds, or ordered collections:
| 1234567891011121314 | # Add items to a list (left push)127.0.0.1:6379> LPUSH recent_orders “order_123” “order_124” “order_125”(integer) 3# View the entire list127.0.0.1:6379> LRANGE recent_orders 0 -11) “order_125“2) “order_124“3) “order_123“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.# Remove and return the first item (great for job queues)127.0.0.1:6379> LPOP recent_orders“order_125” |
Working with Hashes
Hashes are ideal for storing objects with multiple fields:
| 12345678910111213141516 | # Store user information127.0.0.1:6379> HSET user:1002 name “Alice Johnson” email “[email protected]” status “active”(integer) 3# Get specific fields127.0.0.1:6379> HGET user:1002 email# Get all fields127.0.0.1:6379> HGETALL user:10021) “name“2) “Alice Johnson“3) “email“5) “status“6) “active” |
Common use cases to get you started
1. Database query caching
| 1234 | # Cache expensive database query results127.0.0.1:6379> SET query:popular_products ‘[{“id”:1,“name”:“Widget A”},{“id”:2,“name”:“Widget B”}]’# Cache for 5 minutes127.0.0.1:6379> EXPIRE query:popular_products 300 |
2. Session management
| 1234 | # Store user session data127.0.0.1:6379> HSET session:user123 user_id 123 login_time 1640995200 last_active 1640998800# Session expires in 24 hours127.0.0.1:6379> EXPIRE session:user123 86400 |
3. Rate limiting
| 1234 | # Simple rate limiting (10 requests per minute)# Set if not exists, expire in 60 seconds127.0.0.1:6379> SET rate_limit:user123 1 EX 60 NX127.0.0.1:6379> INCR rate_limit:user123 |
4. Real-time analytics
| 1234 | # Track daily active users127.0.0.1:6379> SADD daily_active_users:2024-01-15 user123 user456 user789# Count unique users127.0.0.1:6379> SCARD daily_active_users:2024-01-15 |
Essential commands to remember
Here are the most important commands you’ll use regularly:
Data operations:
- SET key value – Store a string value
- GET key – Retrieve a value
- DEL key – Delete a key
- EXISTS key – Check if key exists
- EXPIRE key seconds – Set expiration time
Information commands:
- KEYS pattern – Find keys (use sparingly in production)
- TYPE key – Get the data type of a key
- TTL key – Check remaining time to live
- INFO – Server information and statistics
List operations:
- LPUSH/RPUSH key value – Add to list
- LPOP/RPOP key – Remove from list
- LRANGE key start stop – Get range of list elements
Performance tips for beginners
- Use appropriate data types: Don’t store JSON strings when hashes would be more efficient. For native JSON usage in Valkey, check out the valkey-json module.
- Set expiration times: Prevent memory bloat with EXPIRE or SETEX
- Avoid large keys: Keep individual keys under a few MB for best performance. While Valkey can store values up to 512MB, large values can block the server and cause latency. Keep key names short: user:1001 is better than long:descriptive:key:name:for:user:1001.
- Use connection pooling: In production applications, always use connection pooling
- Monitor memory usage: Use INFO memory to track memory consumption
Next steps: Production-ready configuration
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.
Where to go from here (and how we can help)
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.