# Update certificates

```json metadata
{
  "schema_version": 2,
  "title": "Update certificates",
  "description": "Update certificates in a Redis Enterprise cluster.",
  "categories": ["docs","operate","rs"],
  "tableOfContents": {"sections":[{"id":"prerequisites","title":"Prerequisites"},{"children":[{"id":"use-the-cluster-manager-ui","title":"Use the Cluster Manager UI"},{"id":"use-the-cli","title":"Use the CLI"},{"id":"use-the-rest-api","title":"Use the REST API"}],"id":"how-to-update-certificates","title":"How to update certificates"},{"children":[{"id":"update-ap-proxy-certs","title":"Update proxy certificates"}],"id":"replica-of-database-certificates","title":"Replica Of database certificates"},{"children":[{"id":"update-aa-proxy-certs","title":"Update proxy certificates"},{"id":"update-aa-syncer-certs","title":"Update syncer certificates"}],"id":"active-active-database-certificates","title":"Active-Active database certificates"}]}

,
  "codeExamples": []
}
```


> [!WARNING]
> When you update the certificates, the new certificate replaces the same certificates on all nodes in the cluster.

## Prerequisites

You need to create new certificates before you can update them in the cluster. To create replacement certificates, see [Renew self-signed certificates](https://redis.io/docs/latest/operate/rs/security/certificates/create-certificates#renew-self-signed-certificates) or [Create CA-signed certificates](https://redis.io/docs/latest/operate/rs/security/certificates/create-certificates#create-ca-signed-certificates) for detailed instructions.

## How to update certificates

You can use the [`rladmin`](https://redis.io/docs/latest/operate/rs/references/cli-utilities/rladmin) command-line interface (CLI) or the [REST API](https://redis.io/docs/latest/operate/rs/references/rest-api) to update certificates. The Cluster Manager UI lets you update proxy and syncer certificates on the **Cluster > Security > Certificates** screen.

The new certificates are used the next time the clients connect to the database.

When you upgrade Redis Enterprise Software, the upgrade process copies the certificates that are on the first upgraded node to all of the nodes in the cluster.

> [!NOTE]
> Don't manually overwrite the files located in `/etc/opt/redislabs`. Instead, upload new certificates to a temporary location on one of the cluster nodes, such as the `/tmp` directory.

### Use the Cluster Manager UI

To replace proxy or syncer certificates using the Cluster Manager UI:

1. Go to **Cluster > Security > Certificates**.

1. Expand the section for the certificate you want to update:
    - For the proxy certificate, expand **Server authentication**.
    - For the syncer certificate, expand **Replica Of and Active-Active authentication**.

    ![Expanded proxy certificate for server authentication.](https://redis.io/docs/latest/images/rs/screenshots/cluster/security-expand-proxy-cert.png)

1. Click **Replace Certificate** to open the dialog.

    ![Replace proxy certificate dialog.](https://redis.io/docs/latest/images/rs/screenshots/cluster/security-replace-proxy-cert.png)

1. Upload the key file.

1. Upload the new certificate.

1. Click **Save**.

### Use the CLI

To replace certificates with the `rladmin` CLI, run the [`cluster certificate set`](https://redis.io/docs/latest/operate/rs/references/cli-utilities/rladmin/cluster/certificate) command:

```sh
 rladmin cluster certificate set <cert-name> certificate_file <cert-file-name>.pem key_file <key-file-name>.pem
```

Replace the following variables with your own values:

- `<cert-name>` - The name of the certificate you want to replace. See the [certificates table](https://redis.io/docs/latest/operate/rs/security/certificates) for the list of valid certificate names.
- `<cert-file-name>` - The name of your certificate file
- `<key-file-name>` - The name of your key file

For example, to replace the Cluster Manager UI (`cm`) certificate with the private key `key.pem` and the certificate file `cluster.pem`:

```sh
rladmin cluster certificate set cm certificate_file cluster.pem key_file key.pem
```

### Use the REST API

To replace a certificate using the REST API, use [`PUT /v1/cluster/update_cert`](https://redis.io/docs/latest/operate/rs/references/rest-api/requests/cluster/certificates#put-cluster-update_cert):

```sh
PUT https://[host][:port]/v1/cluster/update_cert
    '{ "name": "<cert_name>", "key": "<key>", "certificate": "<cert>" }'
```

Replace the following variables with your own values:

- `<cert_name>` - The name of the certificate to replace. See the [certificates table](https://redis.io/docs/latest/operate/rs/security/certificates) for the list of valid certificate names.
- `<key>` - The contents of the \*\_key.pem file

    > [!TIP]
    >   The key file contains `\n` end of line characters (EOL) that you cannot paste into the API call.
    >   You can use `sed -z 's/\n/\\\n/g'` to escape the EOL characters.
    >

- `<cert>` - The contents of the \*\_cert.pem file

## Replica Of database certificates

This section describes how to update certificates for Replica Of databases.

### Update proxy certificates {#update-ap-proxy-certs}

To update the proxy certificate on clusters running Replica Of databases:

1. Use the Cluster Manager UI, `rladmin`, or the REST API to update the proxy certificate on the source database cluster.

1. From the Cluster Manager UI, update the destination database (_replica_) configuration with the [new certificate](https://redis.io/docs/latest/operate/rs/databases/import-export/replica-of/create#encrypt-replica-database-traffic).

> [!NOTE]
> - Perform step 2 as quickly as possible after performing step 1.  Connections using the previous certificate are rejected after applying the new certificate.  Until both steps are performed, recovery of the database sync cannot be established.

## Active-Active database certificates

### Update proxy certificates {#update-aa-proxy-certs}

To update proxy certificate on clusters running Active-Active databases:

1. Use the Cluster Manager UI, `rladmin`, or the REST API to update proxy certificates on a single cluster, multiple clusters, or all participating clusters.

1. Use the [`crdb-cli`](https://redis.io/docs/latest/operate/rs/references/cli-utilities/crdb-cli) utility to update Active-Active database configuration from the command line. Run the following command once for each Active-Active database residing on the modified clusters:

    ```sh
    crdb-cli crdb update --crdb-guid <CRDB-GUID> --force
    ```

> [!NOTE]
> - Perform step 2 as quickly as possible after performing step 1.  Connections using the previous certificate are rejected after applying the new certificate.  Until both steps are performed, recovery of the database sync cannot be established.<br/>
> - Do not run any other `crdb-cli crdb update` operations between the two steps.

### Update syncer certificates {#update-aa-syncer-certs}

To update your syncer certificate on clusters running Active-Active databases, follow these steps:

1. Update your syncer certificate on one or more of the participating clusters using the Cluster Manager UI, `rladmin`, or the REST API. You can update a single cluster, multiple clusters, or all participating clusters.

1. Update the Active-Active database configuration from the command line with the [`crdb-cli`](https://redis.io/docs/latest/operate/rs/references/cli-utilities/crdb-cli) utility. Run this command once for each Active-Active database that resides on the modified clusters:

    ```sh
    crdb-cli crdb update --crdb-guid <CRDB-GUID> --force
    ```

> [!NOTE]
> - Run step 2 as quickly as possible after step 1. Between the two steps, new syncer connections that use the ‘old’ certificate will get rejected by the cluster that has been updated with the new certificate (in step 1).<br/>
> - Do not run any other `crdb-cli crdb update` operations between the two steps.<br/>
> - **Known limitation**: Updating syncer certificate on versions prior to 6.0.20-81 will restart the proxy and syncer connections. In these cases, we recommend scheduling certificate replacement carefully to minimize customer impact.

