
Amazon ElastiCache is AWS's managed in-memory caching service. It runs your choice of caching engine on a selected node type, and provisions replication groups, automatic failover, and encryption in transit and at rest through the console or API. It removes the need to operate cache servers yourself, but it ties the deployment to AWS infrastructure, AWS's engine release and maintenance schedule, and per-node-hour or per-GB-hour charges that scale with usage rather than a fixed self-hosting cost.
Valkey is an open-source, high-performance, in-memory key-value data store for caching, session storage, message brokering, and real-time data processing, and it covers the same ground on infrastructure you control. It originated as a community-driven fork of Redis OSS and retains protocol and command compatibility, along with replication, persistence, access control, and clustering. Because it speaks the same RESP protocol as Redis OSS, standard client libraries integrate with it unchanged.
This article explains how to deploy Valkey as a self-hosted alternative to Amazon ElastiCache on a Linux server. It covers installation, memory and eviction configuration, access control, TLS encryption, data persistence, primary-replica replication, high availability with Valkey Sentinel, monitoring, optional benchmarking, backup and restore, and migration strategies from Amazon ElastiCache.
Valkey covers most Amazon ElastiCache components through a self-hosted, Redis-protocol-compatible data store. The following table maps each ElastiCache component to its Valkey counterpart and notes where the equivalence is partial.
Before you begin:
PRIMARY_IP, REPLICA_IP, SELF_IP, PEER_IP, SENTINEL_IP, and SERVER_IP placeholders in this article refer to private IP addresses.Valkey is distributed as source code, and the Valkey project does not provide an official APT repository. Building the latest stable release from source installs a specific, known Valkey version on any Linux distribution and enables optional features such as TLS at compile time. Running the server under systemd as a dedicated unprivileged user starts Valkey at boot, restarts it after failures, and lets systemd supervise the process.
Run the steps in this section on all three servers, unless a step specifies otherwise. The Sentinel node needs the Valkey binaries, the valkey user, and the directories, but it does not run the Valkey server.
Allow SSH connections through the firewall.
Enable the firewall. Enter y if UFW prompts you to confirm.
Update the package index.
Install the build dependencies.
build-essential, pkg-config: Provide the compiler toolchain and build configuration.tcl: Runs the Valkey test suite.libssl-dev: Enables the TLS build.libsystemd-dev: Enables systemd service notifications.Switch to the /usr/local/src directory.
Download the Valkey source archive.
Check the Valkey releases page for the latest stable version.
Extract the archive.
Switch to the extracted source directory.
Build Valkey with TLS and systemd support.
BUILD_TLS=yes: Compiles TLS support for encrypted connections.USE_SYSTEMD=yes: Compiles systemd notification support for service supervision.-j$(nproc): Runs the build in parallel across all available CPU cores.The build may take a few minutes to complete.
Install the compiled binaries to /usr/local/bin.
Verify the installed version.
The output displays the installed version.
Create a dedicated system user and group to run the service.
Create the configuration, data, and log directories.
Create the Valkey configuration file. Run this step and the remaining steps of this section on the primary and the replica only.
Add the following minimal configuration to start Valkey as a service.
Save and close the file.
dir: Directory where Valkey stores its persistence files.pidfile: Path to the process ID file.logfile: Path to the server log file.supervised systemd: Integrates the server with systemd service supervision.Set the ownership of the Valkey directories and configuration file.
Create a systemd service file.
Add the following service definition.
Save and close the file.
Reload the systemd manager configuration.
Enable and start the Valkey service.
Verify that the service is active.
The output confirms that the service runs.
Confirm that Valkey responds to commands.
Valkey replies with PONG.
Valkey reads its runtime settings from valkey.conf, which takes the place of an ElastiCache parameter group for general server behavior. The default configuration binds Valkey to the loopback interface and enables protected mode, which restricts access to the local host. Connection settings such as maxclients, the idle timeout, and TCP keepalive determine how many clients the server holds open and how quickly it reclaims connections from clients that disappeared without closing them.
Run the steps in this section on the primary and the replica.
Open the Valkey configuration file.
Add the following network and general settings.
Save and close the file.
protected-mode: Rejects external connections when no password and no explicit bind address are configured.port: TCP port for client connections. The default is 6379.tcp-backlog: Maximum length of the pending connection queue.timeout: Seconds of client inactivity before Valkey closes the connection. A value of 0 disables the timeout.tcp-keepalive: Interval in seconds for TCP keepalive probes on idle connections.maxclients: Maximum number of simultaneous client connections.loglevel: Verbosity of the server log. The notice level suits production use.databases: Number of logical databases available to clients.To accept connections from other hosts, add the server's routable address to the bind directive and require authentication. The Configure Access Control section adds a password, and the Configure Replication section updates the bind address for the primary.
Restart the Valkey service to apply the changes.
Verify an applied setting.
The output shows the configured value.
Valkey keeps its dataset in memory, so a memory limit prevents the server from consuming all available system memory. When the dataset reaches the limit, the eviction policy determines which keys Valkey removes to accept new writes. These settings replace the memory and eviction parameters in an ElastiCache parameter group. Run the steps in this section on the primary and the replica.
Valkey's official documentation also recommends keeping swap enabled, sized to match the system RAM, as a safety net: without swap, the Linux out-of-memory (OOM) killer can terminate Valkey when the server runs out of memory.
Open the Valkey configuration file.
Add the memory limit and eviction policy.
Save and close the file.
maxmemory: Maximum memory Valkey uses for the dataset. Set this value below the total system memory to leave room for the operating system and replication buffers.maxmemory-policy: Strategy Valkey applies when the dataset reaches maxmemory. The allkeys-lru policy evicts the least recently used keys and suits general caching.Valkey's actual memory consumption exceeds the size of the stored data, because of memory fragmentation, client connection buffers, and replication buffers. Do not set maxmemory to the literal amount of data you want to cache. Choose a value that leaves headroom for this overhead within the memory available to Valkey.
Restart the Valkey service to apply the changes.
Verify the eviction policy.
The output shows the configured policy.
Set a key with a 100-second expiration to test time-based expiry.
Confirm the remaining time to live.
The output shows the seconds remaining before Valkey removes the key.
Test the eviction policy by lowering the memory limit and loading more data than fits.
Load 300,000 random keys with valkey-benchmark.
-t set: Runs the SET benchmark.-n 300000: Issues 300,000 write requests.-r 300000: Uses up to 300,000 distinct random keys.-d 200: Sets a 200-byte value size.-q: Prints only the summary line.Confirm that Valkey evicted keys to stay within the limit.
The output shows a non-zero eviction count, which confirms that the policy removed keys to enforce the limit.
Restore the production memory limit.
Clear the test data.
Valkey uses Access Control Lists (ACLs) to define users, passwords, and the commands and keys each user can access. This capability replaces ElastiCache users and access controls. By default, Valkey provides a single default user with full access and no password. Run the steps in this section on the primary and the replica.
Create an ACL file.
Add the following user definitions. Replace ADMIN_PASSWORD and APP_PASSWORD with strong passwords.
Save and close the file.
on: Enables the user.>ADMIN_PASSWORD: Sets the user's password.~* and ~app:*: Define the key patterns the user can access. The default user accesses all keys, while cacheapp accesses only keys in the app: namespace.&*: Grants access to all Pub/Sub channels.+@all: Grants every command to the default administrative user.+@read +@write +@connection: Grants the cacheapp user the read, write, and connection command categories.-@dangerous: Removes administrative and destructive commands, such as FLUSHALL and CONFIG, from the cacheapp user.Set the ownership.
Restrict the file permissions.
Open the main configuration file to reference the ACL file.
Add the aclfile directive.
Save and close the file.
Restart the Valkey service to apply the changes.
Confirm that Valkey rejects unauthenticated commands.
The command fails with a NOAUTH Authentication required error.
Export the administrative password so valkey-cli authenticates as the default user for the rest of the shell session. Replace ADMIN_PASSWORD with the administrative password.
The VALKEYCLI_AUTH environment variable applies only to the current shell session and avoids passing the password as a command-line argument. To authenticate a single command instead, run valkey-cli --user default --pass ADMIN_PASSWORD.
List the configured users.
The output shows both users and their permissions.
Verify that the application user can write to an allowed key. Replace APP_PASSWORD with the application password.
The output shows OK.
Confirm that the application user cannot access keys outside its namespace.
The command fails with a NOPERM error, because the key is outside the app: namespace.
Confirm that the application user cannot run dangerous commands.
The command fails with a NOPERM error, because the user has no permission to run FLUSHALL.
Valkey supports Transport Layer Security (TLS) to encrypt client connections and replication traffic, which replaces ElastiCache encryption in transit. The TLS support compiled into the server can listen on a dedicated tls-port alongside the plaintext port, and clients verify the server's identity against a certificate authority (CA). Mutual TLS additionally requires clients to present their own certificates. Running TLS on a separate port keeps the plaintext port available on the loopback interface for local administration.
Run the steps in this section on the primary and the replica, unless a step names one server. The primary creates one CA, and both servers sign their certificates with it, so clients trust the whole deployment with a single ca.crt file.
Create a directory for the TLS certificates.
Switch to the TLS directory.
On the primary, generate a private key for the certificate authority.
On the primary, create a self-signed CA certificate.
On the primary, display the CA certificate, and copy the output.
On the replica, create the CA certificate file, paste the copied certificate, then save and close the file.
On the primary, display the CA private key, and copy the output.
On the replica, create the CA private key file, paste the copied key, then save and close the file.
Generate a private key for the Valkey server.
Create a certificate signing request. Add the server's routable address to the subject alternative name (SAN) so remote clients can verify the certificate against the address they actually connect to. Replace SERVER_IP with the server's address.
Sign the server certificate with the CA.
Set the ownership.
Restrict private key permissions.
Open the Valkey configuration file.
Add the TLS settings.
Save and close the file.
tls-port: Port that accepts TLS connections. Running TLS on a separate port keeps the plaintext port available on the loopback interface for local administration.tls-cert-file and tls-key-file: Server certificate and private key.tls-ca-cert-file: CA certificate that clients use to verify the server.tls-auth-clients: When set to no, clients are not required to present a certificate. Set it to yes to require mutual TLS.Restart the Valkey service to apply the changes.
Verify an encrypted connection on the TLS port.
Valkey responds with PONG.
Encrypting replication traffic with tls-replication yes, or disabling the plaintext port with port 0, requires TLS on every node, including Sentinel. The later sections monitor the plaintext port 6379, and Sentinel rewrites the replicaof directive on each replica to the address and port it monitors. Applying either option without also configuring TLS for Sentinel breaks replication and failover. To encrypt an entire deployment, configure TLS on the Valkey servers and the Sentinel instances together, as described in the Valkey TLS documentation.
Valkey provides two persistence mechanisms that write the in-memory dataset to disk, which replaces ElastiCache snapshots. The Valkey Database (RDB) mechanism creates point-in-time snapshots at configured intervals, and the Append-Only File (AOF) logs every write operation for finer-grained durability. Enabling both provides fast restarts from the snapshot and minimal data loss from the log. Run the steps in this section on the primary and the replica.
Enable memory overcommit so that background saves do not fail when memory is tight. This setting also applies to the AOF rewrite and to the full synchronization a replica requests from its primary.
Without vm.overcommit_memory = 1, the kernel can refuse the memory allocation for the background save when the dataset is large relative to the available RAM, which causes BGSAVE to fail or the server to run into out-of-memory conditions.
Apply the setting.
Verify the setting.
The output shows 1.
Disable Transparent Huge Pages (THP), which increase latency and memory usage during background saves.
Verify the THP setting.
The output shows never in brackets.
The echo command changes the THP setting only until the next reboot. The following steps create a systemd service that disables THP at every boot.
Create a systemd service file to persist the THP setting across reboots.
Add the following service definition.
Save and close the file.
Reload the systemd manager configuration.
Enable and start the service.
Open the Valkey configuration file.
Add the persistence settings.
Save and close the file.
save: Creates an RDB snapshot when the specified number of keys change within the interval.dbfilename: Name of the RDB snapshot file.appendonly: Enables the append-only file for operation-level durability.appendfsync: Frequency of flushing the AOF to disk. The everysec value flushes once per second and balances durability and performance. Valkey stores both files in the configured dir directory. The AOF uses a multi-part layout inside the appendonlydir subdirectory.
Restart the Valkey service to apply the changes.
Write a test key.
Trigger a background snapshot.
Confirm that the persistence files exist.
The output lists the RDB file and the AOF directory:
Restart the Valkey service to apply the changes.
Confirm that the data survives.
Valkey returns the value from the persisted data.
Valkey stores values as typed data structures, such as strings, hashes, lists, and sets, and each type has dedicated commands that the server executes atomically. Strings with an expiration suit cached values and tokens, atomic counters suit rate limiting and statistics, and hashes suit session and object caching because they let you read or update individual fields without rewriting the whole value. Run the steps in this section on the primary.
Store a string value.
Retrieve the string value.
Set a key with a 60-second expiration.
Check the key's remaining time to live.
The output shows the seconds remaining.
Increment a counter.
Increment the counter by a specific amount.
The output shows the incremented counter value.
Store a hash, which suits session and object caching.
Retrieve the hash.
The output lists the hash fields and values.
Delete a key.
Confirm the key's removal.
The output shows 0, which confirms that the key no longer exists.
Inspect the memory that a key uses.
The output shows the memory in bytes.
Applications connect to Valkey through a client library that speaks the RESP protocol. Because Valkey uses the same protocol as Redis OSS, existing Redis client libraries work unchanged, and Valkey-specific clients such as valkey-py offer the same interface. The cache-aside pattern checks Valkey first, queries the primary data source only on a cache miss, and stores the result in Valkey for later requests. The application owns the caching logic, and the expiration set on each key bounds how stale a cached value can become. Run the steps in this section on the primary.
Install the Python virtual environment package.
Create a virtual environment.
Activate the virtual environment.
Install the Valkey client library.
Create the application file.
Add the following code. Replace APP_PASSWORD with the application user's password.
valkey.Valkey(...): Connects to Valkey as the cacheapp user.get_product: Returns the cached value on a hit, or queries the data source and caches the result on a miss.client.set(key, value, ex=300): Stores the result with a 300-second expiration.Run the application.
The first call misses the cache and runs the simulated query, while the second call returns the cached value in a fraction of the time.
Deactivate the virtual environment.
Valkey replication copies the primary's dataset to one or more replicas, which replaces an ElastiCache replication group with read replicas. Replicas serve read traffic, provide redundancy, and act as promotion candidates during a failover. Replication is asynchronous, so a replica can briefly lag behind the primary. A replica connects to the primary, performs a full synchronization of the dataset, and then receives the stream of write commands as they happen.
Run the first six steps on the primary server, and the remaining steps on the replica server.
On the primary, open the configuration file.
Add the bind directive. Replace PRIMARY_IP with the primary server's IP address.
Save and close the file.
Open the ACL file.
Add a dedicated replication user. Replace REPLICATION_PASSWORD with a strong password.
Save and close the file.
Allow the replica to reach the Valkey port through the firewall. Replace REPLICA_IP with the replica server's IP address.
Restart the Valkey service to apply the changes.
Valkey replication fails with a Timeout connecting to the PRIMARY error in the replica log when the firewall blocks port 6379. Restrict the rule to the replica's address instead of opening the port to all sources.
On the replica, open the configuration file.
Add the replication settings. Replace PRIMARY_IP with the primary server's IP address, REPLICATION_PASSWORD with the replication user's password, and REPLICA_IP with the replica server's address.
Save and close the file.
replicaof: Address and port of the primary server.masteruser and masterauth: Credentials the replica uses to authenticate to the primary.replica-read-only: Rejects writes sent directly to the replica, which prevents divergence from the primary.Add the same replicator line to the /etc/valkey/users.acl file on the replica. The replica applies it when Sentinel promotes the replica to primary.
Allow the primary to reach the replica through the firewall. Replace PRIMARY_IP with the primary server's IP address.
Restart the Valkey service on the replica.
Verify the replication status on the replica.
The output confirms the replica role and an active link to the primary:
master_link_status:up: Confirms that the replica connected to the primary. A value of down indicates a network, authentication, or firewall problem.On the primary, confirm that the replica is attached.
The output lists the connected replica and its offset.
Write a key on the primary to test replication.
On the replica, confirm that the key arrived.
The replica returns the value written on the primary:
Confirm that the replica rejects direct writes.
The command fails with a READONLY error, which confirms read-only enforcement.
Valkey Sentinel monitors the primary and its replicas, detects failures, promotes a replica to primary, and reconfigures the remaining nodes, which replaces ElastiCache automatic failover. Sentinel requires an odd number of instances, and at least three, because a failover needs agreement from a majority of the Sentinel instances. Two Sentinel instances cannot complete a failover when the primary server fails, because the single surviving instance never reaches a majority.
Run all the steps in this section on all three servers, unless a step specifies a particular server.
Open the ACL file on the primary and replica servers.
On both servers, add a Sentinel user to the ACL file. Replace SENTINEL_PASSWORD with a strong password.
Save and close the file.
Sentinel needs these commands to query server state, publish and subscribe to its coordination channel, and promote a replica during a failover.
Open the configuration file on the primary server.
Add the replication credentials so the node can synchronize after a failover demotes it to a replica. Replace REPLICATION_PASSWORD with the replication user's password.
Save and close the file.
Configure masteruser and masterauth on every node, including the current primary. Sentinel demotes a recovered primary to a replica, and without these credentials the node fails to resynchronize and logs Unexpected reply to PSYNC from primary: -NOAUTH Authentication required.
Restart Valkey on the primary and the replica to apply the ACL and configuration changes.
Create the Sentinel configuration file on each of the three servers.
Add the following configuration. Replace SELF_IP with the address of the server you are configuring, PRIMARY_IP with the primary server's address, and SENTINEL_PASSWORD with the Sentinel user's password.
Save and close the file.
sentinel announce-ip: Address this Sentinel advertises to its peers.sentinel monitor: Names the monitored group, sets the primary's address, and sets the quorum. The quorum of 2 is the number of Sentinels that must agree the primary is unreachable.sentinel auth-user and sentinel auth-pass: Credentials Sentinel uses to query the monitored servers.sentinel down-after-milliseconds: Time without a valid reply before Sentinel marks the primary as down.sentinel failover-timeout: Maximum time allowed for a failover attempt.sentinel parallel-syncs: Number of replicas that resynchronize with the new primary at the same time.Sentinel rewrites this file at runtime to record the current topology, so the file and its directory must be writable by the valkey user.
Create the Sentinel data directory.
Set the directory ownership.
Create a systemd service file for Sentinel.
Add the following configuration.
Save and close the file.
Allow the Sentinel port between all three servers. Run this command on each server for the other two addresses. Replace PEER_IP with the other server's address.
Allow the Valkey port on the primary and the replica for every other server that runs Sentinel. Replace SENTINEL_IP with the address of the Sentinel server.
Reload the systemd manager configuration.
Enable and start Sentinel.
Confirm that Sentinel discovered the primary, the replica, and the other Sentinel instances.
The SENTINEL master command returns a long list of alternating field names and values. The paste and grep commands pair each field with its value and select the fields that confirm the topology.
Sentinel does not use the Valkey ACL users, so it requires no password on port 26379. When VALKEYCLI_AUTH is exported in the current shell, valkey-cli still sends the password and prints AUTH failed: ERR AUTH <password> called without any password configured for the default user before the result. The command still succeeds. To suppress the message, prefix Sentinel commands with env -u VALKEYCLI_AUTH.
The output reports the monitored primary, one replica, and two peer Sentinels:
flags master: Sentinel considers the primary reachable. A value of s_down or o_down indicates a failure.num-slaves 1: Sentinel discovered the replica.num-other-sentinels 2: Sentinel discovered the two peer instances.Sentinel accepts commands on port 26379 without a password, and the UFW rules limit that port to the three servers. To require a password, set requirepass in sentinel.conf and sentinel sentinel-pass to the same value on every Sentinel instance. For more information, see the Valkey Sentinel documentation.
Verify that the deployment can authorize a failover.
The output confirms that enough Sentinels are available:
Write a key on the primary to confirm the data present before the failover.
Stop Valkey on the primary to simulate a failure.
On the Sentinel node, query Sentinel for the current primary address. Wait a few seconds for Sentinel to detect the failure and complete the promotion.
Sentinel reports the replica's address, which confirms the promotion.
On the promoted server, confirm the new role.
The promoted server now accepts writes as the primary.
On the promoted server, check if the data survived.
The promoted server retains the replicated data.
Start Valkey on the failed server to restore it.
Confirm that Sentinel reconfigured the recovered server as a replica of the new primary.
The recovered server rejoins as a replica and synchronizes from the new primary.
Applications that must follow failovers automatically should connect through a Sentinel-aware client. Such a client queries Sentinel for the current primary address instead of connecting to a fixed address.
The health of a cache comes down to a few signals: memory use against maxmemory, the cache hit ratio, the eviction rate, replication status, and command latency. Valkey exposes these through the INFO command, records slow commands in the slow log, and tracks latency spikes through the latency monitor. These built-in tools replace the Amazon CloudWatch metrics that ElastiCache publishes.
Display the server section to confirm the version and uptime.
The output includes the version, port, and uptime:
Inspect memory usage.
The output reports current usage, peak usage, the configured limit, and fragmentation:
used_memory_human: Memory the dataset currently uses.used_memory_peak_human: Highest memory usage since the server started.maxmemory_human: Configured memory limit.mem_fragmentation_ratio: Ratio of memory the operating system allocated to memory Valkey requested. Values far above 1 on a busy server indicate fragmentation.Review throughput and cache effectiveness.
The output reports connection counts, command throughput, and cache hit statistics:
keyspace_hits and keyspace_misses: Calculate the cache hit ratio as hits / (hits + misses).evicted_keys: Number of keys removed because of the memory limit. A steadily rising value indicates that the dataset exceeds maxmemory.expired_keys: Number of keys removed because their time to live elapsed.Check connected clients.
The output shows the current client count:
Display the number of keys per database.
The output lists the key count and expiration statistics:
Set the slow log threshold to capture commands slower than 10 milliseconds.
The threshold uses microseconds, so 10000 equals 10 milliseconds.
Display the number of recorded slow commands.
Review the most recent slow command entries.
Each entry lists the entry ID, timestamp, execution time in microseconds, the command, and the client address:
Enable the latency monitor for events slower than 100 milliseconds.
Display recorded latency events.
An empty result confirms that no command exceeded the threshold. When events occur, the output pairs each timestamp with the recorded latency in milliseconds.
Add slowlog-log-slower-than 10000 and latency-monitor-threshold 100 to valkey.conf to keep these settings after a restart.
Valkey backups copy the RDB snapshot file to a separate location, which replaces managed ElastiCache snapshots. Restoring loads the snapshot into a Valkey instance. When AOF persistence is enabled, Valkey loads the AOF instead of the RDB at startup, so the restore procedure disables AOF while the snapshot loads and re-enables it afterward. Sentinel fails over to the replica when the primary stops, so the restore stops Sentinel first. Run the steps on the current primary, unless a step says otherwise.
Create a backup directory.
Write a test key to include in the backup.
Trigger a snapshot of the current dataset.
Valkey writes the snapshot in the background.
BGSAVE forks a child process, so it depends on the vm.overcommit_memory setting described in the Configure Data Persistence section. Apply that setting on every server that creates snapshots.
Confirm that the snapshot finished.
A value of 0 confirms that no snapshot is in progress.
Copy the snapshot to the backup directory with a dated filename.
Schedule this copy with a cron job and transfer the file to remote storage. A backup stored only on the Valkey server does not protect against server loss.
On all three servers, stop Sentinel so that it does not fail over while the primary is down.
Stop the Valkey service before restoring.
Open the configuration file to disable AOF for the restore.
Change the appendonly directive to no.
Save and close the file.
Valkey loads the AOF instead of the RDB snapshot when appendonly is set to yes. Restoring a snapshot without disabling AOF first starts the server with an empty dataset.
Remove the existing AOF directory.
Copy the backup into the data directory. Replace BACKUP_FILE with the name of the dated backup file, such as dump-20261204.rdb.
Set the ownership of the restored snapshot.
Start the Valkey service to load the snapshot.
Verify that the restored keys are present.
Retrieve a specific restored key.
The output shows "backup-value", which confirms that Valkey loaded the snapshot.
Re-enable AOF at runtime, which rebuilds the append-only file from the restored dataset.
Open the configuration file.
Set appendonly back to yes so the setting survives a restart.
Save and close the file.
Confirm that AOF is active again.
The output confirms that AOF persistence is enabled.
On all three servers, start Sentinel again.
On the replica, confirm that it resynchronized the restored data.
The output shows "backup-value".
The features configured in this article depend on each other. Replication and Sentinel rely on ACL users and firewall rules, while persistence and eviction depend on the memory and kernel settings. A layer can fail without affecting the others, such as a replica whose link to the primary is down while the primary keeps serving clients. Checking each capability end to end confirms that the layers work together. Run these checks on the current primary unless a step specifies otherwise.
If you completed the failover test in the Configure High Availability with Valkey Sentinel section, the original replica is now the primary and the original primary is now a replica. Run the following checks on the current primary.
Confirm that both services run.
Both services report active.
Confirm that Valkey rejects unauthenticated access. Open a new shell without VALKEYCLI_AUTH exported, then run the following command.
The command fails with a NOAUTH Authentication required error.
Confirm that the application user can write within its namespace. Replace APP_PASSWORD with the application password.
The output shows OK.
Confirm that the application user is denied write access outside its namespace. Replace APP_PASSWORD with the application password.
The command fails with a NOPERM error.
Confirm that the TLS port serves encrypted connections.
Valkey responds with PONG.
Set a key with an expiration to confirm key expiration works.
Check the remaining time to live.
The output shows a positive number of seconds, up to 30.
Confirm the memory limit and eviction policy.
Confirm that persistence is active.
The output confirms that AOF is enabled and the last snapshot succeeded.
Confirm the replication topology.
Write a key on the primary, then read it on the replica to confirm that replication delivers data.
On the replica, run the following command.
Confirm that Sentinel can authorize a failover.
Confirm that monitoring statistics report activity.
The output reports the cache hit and miss counters used to calculate the hit ratio.
Migrating from Amazon ElastiCache to Valkey replaces a managed cache with a self-hosted deployment that you configure and operate. The sections below outline how to review the existing deployment, prepare Valkey, move the data, update applications, and validate the result.
Document the current ElastiCache deployment so the Valkey configuration reproduces its behavior.
Map each ElastiCache setting to the equivalent Valkey configuration on the target servers.
maxmemory and maxmemory-policy to match the node memory and the parameter group's eviction policy.The migration method depends on whether the workload treats the cache as disposable or as a source of record.
Point applications at the Valkey endpoint and align their client settings with the new deployment.
Confirm that Valkey serves traffic correctly before decommissioning ElastiCache.
The following items require attention during the migration:
INFO, SLOWLOG, and latency monitoring, or an external monitoring stack.You have successfully deployed Valkey as an alternative to Amazon ElastiCache, with memory and eviction limits, access control, TLS encryption, persistence, primary-replica replication, high availability through Valkey Sentinel, monitoring, and backups. Applications connect to it with their existing Redis or Valkey client libraries. For more information about configuration, commands, and operational guidance, refer to the official Valkey documentation.
0 Comments
Be the first to comment and share your perspective with the community.