Valkey - Getting Started Guide
Valkey is an open-source, high-performance in-memory data store - a fork of Redis compatible with all Redis clients and libraries. It is commonly used for caching, session storage, message queues and real-time analytics. This server comes with Valkey fully configured with the password you specified during the order.
Step 1 - Verify Valkey Works
Your server's IP address and root password are shown on the Server Details page in your client panel. SSH into your server and use valkey-cli to verify the service is running:
ssh root@your.server.ip
valkey-cli -a your_password
Basic commands to verify everything works:
# Test connection
PING
# Expected: PONG
# Store and retrieve a value
SET mykey "Hello Valkey"
GET mykey
# Check server info
INFO server
Valkey is a backend service and doesn't need public internet access. For secure access, place the server on a private network behind a VyOS router and connect over a VPN to reach Valkey on the server's private IP.
Step 2 - Connect from Your Application
Valkey accepts remote connections on port 6379. It is fully compatible with Redis clients - use any Redis library in your application:
| Parameter | Value |
|---|---|
| Host | your.server.ip |
| Port | 6379 |
| Password | your_password (from order) |
Connection string format:
redis://default:your_password@your.server.ip:6379
Example - Python:
import redis
r = redis.Redis(host='your.server.ip', port=6379, password='your_password')
r.set('key', 'value')
print(r.get('key'))
Example - Node.js:
const Redis = require('ioredis');
const client = new Redis({
host: 'your.server.ip',
port: 6379,
password: 'your_password'
});
Note: Port 6379 is the Valkey/Redis protocol - it cannot be opened in a browser. Use a client library or valkey-cli.
Step 3 - Connect with a GUI Tool (Optional)
You can use any Redis-compatible GUI tool to manage your Valkey server:
- Another Redis Desktop Manager (ARDM) - free, cross-platform
- Redis Commander - web-based, MIT license
- Medis - macOS
Use the same connection details from Step 2 (host, port 6379, password).
Common Use Cases
Caching
Use Valkey as a cache layer for your web application to reduce database load:
# Set a value with 1 hour expiration (3600 seconds)
SET page:home "<html>..." EX 3600
# Check remaining time to live
TTL page:home
Session Storage
Store user sessions in Valkey for fast access across multiple application servers:
# Store session data (hash)
HSET session:abc123 user_id 42 role admin
EXPIRE session:abc123 1800
# Retrieve session
HGETALL session:abc123
Message Queue
Use Valkey lists as a simple message queue:
# Producer: add tasks to queue
LPUSH tasks '{"type":"email","to":"user@example.com"}'
# Consumer: wait for and process tasks
BRPOP tasks 0
Post-Installation
Fail2Ban - Brute-Force Protection
Your server comes with Fail2Ban pre-configured to protect SSH from brute-force attacks.
| Rule | Max Attempts | Ban Duration |
|---|---|---|
| SSH | 5 failed logins | 10 minutes |
Useful commands:
# Check banned IPs
fail2ban-client status sshd
# Unban an IP
fail2ban-client set sshd unbanip 1.2.3.4
If you accidentally lock yourself out, connect via VNC console in your client panel and unban your IP.
Service Management
Valkey runs via systemd. Common commands:
# Check service status
systemctl status valkey-server
# Restart Valkey
systemctl restart valkey-server
# View Valkey logs
journalctl -u valkey-server -n 100
Performance Tuning
Valkey is automatically tuned on first boot. To check current settings:
valkey-cli -a your_password INFO memory
valkey-cli -a your_password CONFIG GET maxmemory
valkey-cli -a your_password CONFIG GET maxmemory-policy
To adjust maxmemory (e.g., to 2 GB):
valkey-cli -a your_password CONFIG SET maxmemory 2gb
valkey-cli -a your_password CONFIG REWRITE
Available eviction policies: allkeys-lru (default), volatile-lru, allkeys-lfu, noeviction. Use noeviction if you want Valkey to return errors instead of removing keys when memory is full.
Persistence
Valkey saves data to disk using RDB snapshots by default. Data survives server restarts. To check persistence status:
valkey-cli -a your_password INFO persistence
To enable AOF (Append Only File) for more durable persistence:
valkey-cli -a your_password CONFIG SET appendonly yes
valkey-cli -a your_password CONFIG REWRITE
AOF logs every write operation. Combined with RDB, this provides the most reliable data protection.
Change Password
To change the Valkey password:
valkey-cli -a current_password CONFIG SET requirepass new_password
valkey-cli -a new_password CONFIG REWRITE
Update /root/.valkey_credentials with the new password for reference.
Server Credentials
Valkey credentials are stored in /root/.valkey_credentials.
What's Pre-Configured
- Remote access: Valkey accepts connections from any IP on port 6379 (password required)
- maxmemory: Automatically set to 75% of available RAM on first boot
- Eviction policy: allkeys-lru - least recently used keys are removed when memory limit is reached
- Persistence: RDB snapshots enabled by default (automatic point-in-time backups to disk)
- System tuning: vm.overcommit_memory, somaxconn and Transparent Huge Pages optimized for Valkey
Software Included
| Component | Version |
|---|---|
| Ubuntu | 24.04 LTS |
| Valkey | 7.2 |
| Fail2Ban | 1.0 |
Troubleshooting
| Problem | Solution |
|---|---|
| Can't connect to Valkey remotely | Check that port 6379 is not blocked by firewall. Verify bind 0.0.0.0 in /etc/valkey/valkey.conf |
| NOAUTH Authentication required | Provide the password: valkey-cli -a your_password or AUTH your_password. Check /root/.valkey_credentials |
| OOM command not allowed | Memory limit reached. Increase maxmemory or change eviction policy. Check usage: valkey-cli -a pass INFO memory |
| Valkey won't start | Check logs: journalctl -u valkey-server -n 50. Common cause: invalid config or disk full (df -h /) |
| Forgot Valkey password | SSH in and check /root/.valkey_credentials |
| Blocked by Fail2Ban | Use VNC console in your client panel to unban your IP |
| Forgot root password | Use VNC console in your client panel to reset it |