Monday, December 15, 2025

Rotate SSL/TLS Certificates in Valkey/Redis With out Downtime


In case your Valkey/Redis deployments use SSL/TLS, you’ll finally must rotate the TLS certificates. Maybe it’s as a result of the certificates are expiring, otherwise you made errors when creating them, or it might be that the personal key has been leaked. This text explains the method of rotating the TLS/SSL certificates utilized by Valkey/Redis deployments with out affecting service availability.

Setting and configurations

On this publish, we are going to rotate TLS certificates for a 6-node Valkey cluster (the method may also apply to standalone or Sentinel deployments)

Our working listing can have the next recordsdata: the server-new.pem and server-new-key.pem recordsdata would be the key pair used to switch server.pem and server-key.pem (You’ll be able to shortly create TLS key pairs by following our information on GitHub)

The configuration recordsdata for every node can have the next parameters associated to TLS (along with different parameters required for clustering):

Again up the TLS certificates presently getting used

Earlier than we do something, it’s very best to have a backup prepared. Within the occasion that something goes unsuitable, we are able to nonetheless revert to the earlier configurations.

Overwrite the presently used certificates with the brand new ones

We are going to exchange the content material of the outdated certificates with the brand new ones (server-new.pem and server-new-key.pem), and Valkey/Redis situations will decide it up after they reload the configuration

“Why can’t I simply replace the configs to level to the brand new key pair?”

In case you execute a CONFIG SET to level the tls-*-file configs to the brand new location, it won’t work. It’s because Valkey/Redis will reconfigure itself with each CONFIG SET command, and since you can’t replace a number of parameters directly, updating it sequentially will end in a key pair mismatch error:

And the log file will present the next entries:

Reload the TLS configuration in Valkey situations

After overwriting the important thing pair contents, we are able to instruct Valkey situations to select up the brand new keys by executing CONFIG SET on a TLS-related parameter (we are able to set it to the present worth, no want to alter something right here):

Observe: Please bear in mind to run the CONFIG SET command on all nodes within the cluster

We will affirm that no lack of service occurred by grepping the situations’ log recordsdata for errors, or by querying the cluster’s standing:

As we are able to see, after rotating, the situations can nonetheless talk with one another.

On the Shopper’s aspect

In case your Valkey/Redis situations have their new TLS certificates signed by the outdated Certificates Authority (CA), then your purchasers can nonetheless connect with the deployment usually. Nonetheless, when you would not have a CA (i.e., utilizing self-signed certificates) or use one other CA, be sure that your purchasers’ truststores have the related public keys imported to take care of service connectivity.

Conclusion

On this article, we’ve mentioned the process for rotating SSL/TLS certificates in a Valkey/Redis deployment with out incurring any downtime. Nonetheless, as at all times, please check the process earlier than making use of it to your manufacturing setting.

 

Redis vs Valkey: Selecting the Proper Match for Your Group

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles