Managed Valkey
Run Valkey, the open-source Redis-compatible in-memory data store, for caching, sessions and queues, without a server to look after. We take care of provisioning, failover and patch updates.
Create a Valkey database
- Go to Databases and click Create database.
- Select Valkey.
- Enter a Name. It must be unique in your organization.
- Select the Data center your servers run in. See Regions.
- Select a Plan.
- Under Nodes, select Primary + 1 replica, so a replica takes over if the primary fails.
- Turn on Allow public access if clients outside your private networks connect to the database.
- Click Create database.
The database is ready when its status reads Running.
Plans
Every node gets the full plan and bills at the plan's price, so a primary with one replica costs twice the plan. Memory for data is Valkey's memory limit. We keep the rest of the RAM for background saves and replication, so a full instance never runs out of memory. Traffic over private networks, replication included, is free. See Pricing philosophy for internet egress.
Connect to your database
Open the database and find the hostname, the default user and its AUTH token under Connection. Set the hostname as VALKEY_HOST and connect:
A new database is reachable only from the private networks attached to it, on port 6379 without TLS. The hostname always points at the current primary, so clients follow a failover by reconnecting.
Allow public access opens port 6380 on a separate public hostname, with TLS only. The plain port is never public. Certificates are issued by the Better Stack Managed CA, which isn't in system trust stores, so pass the CA certificate to your client. betterstack valkey credentials <name> --availability-zone us-west-2a returns the public hostname in tls_uri and the CA certificate in ca_certificate. Save the certificate as betterstack-db-ca.pem and set the public hostname as VALKEY_PUBLIC_HOST. Restrict who can connect with a firewall. A firewall filters only the public address, not traffic from private networks.
Connection hangs from outside Cloud?
The hostname resolves to a private address, so it works only from your private networks. From the internet, turn on public access and connect to the public hostname.
Rotate credentials
To replace the AUTH token:
- Click Rotate credentials on the database page.
- Click Rotate credentials to confirm.
The previous token keeps working for 24 hours, and open connections stay up, so roll your clients within that window. Only two tokens are valid at once, so rotating again within the 24 hours retires the oldest token right away.
Authentication and commands
AUTH is always on, with a single default user. Every data command works as usual. Commands that would break the managed service are blocked: SHUTDOWN, REPLICAOF and SLAVEOF, FAILOVER, CONFIG, DEBUG, MODULE, ACL, SAVE, BGSAVE, BGREWRITEAOF and CLUSTER.
The database runs as standalone Valkey, not Valkey Cluster, so configure client libraries for standalone mode. A client that probes for a cluster gets ERR This instance has cluster support disabled.
Valkey saves your data to disk periodically, so a restarted node comes back with recent data. When data reaches the memory limit, the noeviction policy applies, so Valkey keeps every key and returns an error for writes that need more memory.
Replicas and failover
Replicas run in the same data center and copy the primary asynchronously. They serve read-only traffic.
With at least one replica, failover is automatic. When the primary is unreachable for about 90 seconds, the most caught-up replica becomes the primary and the hostname moves to it. Writes fail for about 2 minutes end to end.
Because replication is asynchronous, writes that hadn't reached that replica yet are lost. A database without replicas has no failover and is down until its node recovers.
To switch on purpose, for a disaster recovery drill or a planned move:
- Click Fail over on the database page.
- Click Fail over to confirm.
No committed write is lost, and writes fail for about 20 seconds while clients reconnect.
Seeing READONLY errors after a failover?
The old primary stays reachable and rejects writes with READONLY You can't write against a read only replica. Treat it as a signal to reconnect and re-resolve the hostname, and don't cache DNS beyond its 60-second TTL.
Snapshots
Click Take a snapshot on the database page. The database keeps serving while the snapshot is taken, and a restore holds your data as of a few seconds before the capture. Snapshots outlive the database. To restore one, see Database snapshots.
Rescale and memory
To change the plan:
- Click Rescale on the database page.
- Select a Plan and click Rescale database.
With replicas, nodes resize one at a time and clients see a single reconnect.
A database without replicas is unavailable for a few minutes, longer for a big dataset, because Valkey reads it back from disk before it answers again. You can move to a smaller plan only if the memory in use fits within 90% of its memory for data, so delete or expire keys first.
Updates
We apply Valkey patch releases automatically.
Need help?
Please let us know at hello@betterstack.com.
We're happy to help! 🙏