Back up an embedded etcd
If you started Omni with the--etcd-embedded=true flag (the default), the etcd server runs inside the Omni process. Starting with Omni v1.13.0, the embedded etcd does not listen on any address by default, and Omni connects to it in-memory.
To take snapshots of the embedded etcd with etcdctl, enable its TLS listener first. The listener only accepts clients that present a certificate it trusts.
The
--etcd-embedded-cert-path, --etcd-embedded-key-path and --etcd-embedded-ca-path flags and their configuration fields are for the embedded etcd only. They have no effect when Omni uses an external etcd.Enable the TLS listener
The simplest setup uses a single self-signed certificate. Omni uses it as the server certificate and as the CA, soetcdctl connects with the same certificate and key.
-
Generate the certificate and its key on the Omni host:
This command requires OpenSSL 1.1.1 or later.
-
Add the certificate and the key to the Omni start command. If Omni runs in Docker, mount both files into the container:
Then pass their paths inside the container to Omni:The same settings in the Omni configuration file:
- Restart Omni with the new settings. If Omni runs in Docker, recreate the container with the new mounts and flags, and keep its existing data directory mounts.
--etcd-endpoints (http://localhost:2379 by default). The scheme in these addresses is ignored. The listener always serves TLS.
The certificate file must contain a single certificate. Omni refuses to start when it contains a chain, because every certificate in the chain would be trusted to issue client certificates.
Use your own CA
To giveetcdctl its own client certificate instead of sharing the server’s key, use a CA. Omni then accepts every client certificate signed by that CA.
-
Create a CA, a server certificate for Omni and a client certificate for
etcdctl:These commands require OpenSSL 3.0 or later. Theopensslthat ships with macOS (LibreSSL) does not support them. The client certificate expires after a year. Issue a new one from the same CA before then. -
Add the server certificate, its key and the CA certificate to the Omni start command. If Omni runs in Docker, mount the three files into the container:
Then pass their paths inside the container to Omni:The same settings in the Omni configuration file:
- Restart Omni with the new settings, as described above.
Take a snapshot
Run the following command on the same host where Omni is running. If Omni is running in Docker, make sure the container is started with--net=host.
--cacert ca.crt --cert client.crt --key client.key instead.
This command saves a snapshot of the database to snapshot.db in your current directory.
We recommend scheduling periodic snapshots, for example, using a cron job, and storing them in a secure location such as an S3 bucket.
Back up an external etcd
If you started Omni with--etcd-embedded=false, etcd is managed outside of Omni and is not backed up automatically. You are responsible for backing it up regularly.
For guidance on backup and recovery procedures, see the etcd disaster recovery documentation.