<p>I am trying to take snapshot backups with Velero in Kubernetes of a 12 node test CockroachDB cluster with Velero such that, if the cluster failed, we could rebuild the cluster and restore the cockroachdb from these snapshots.</p>

<p>We're using Velero to do that and the snapshot and restore seems to work, but on recovery, we seem to have issues with CockroachDB losing ranges.</p>

<p>Has anyone gotten snapshot backups to work with CockroachDB with a high scale database?  (Given the size of the dataset, doing dumps or restores from dumps is not viable.)</p>

outside2344
<p>Performing backups of the underlying disks while CockroachDB nodes are running is unlikely to work as expected.</p>
<p>The main reason is that even if a persistent disk snapshot is atomic, there is no way to ensure that all disks are captured at the exact same time (time being defined by CockroachDB's consistency mechanism). The restore would contain data with replicas across nodes at different commit indices, resulting in data loss or loss of quorum (show in the Admin UI as &quot;unavailable&quot; ranges).</p>
<p>You have a few options (in order or convenience):</p>
<ul>
<li><a href="https://www.cockroachlabs.com/docs/v20.2/backup.html" rel="nofollow noreferrer">CockroachDB BACKUP</a> which has all nodes write data to external storage (S3, GCS, etc...). Before version 20.2, this is only available with an <a href="https://www.cockroachlabs.com/product/" rel="nofollow noreferrer">enterprise license</a>.</li>
<li><a href="https://www.cockroachlabs.com/docs/v19.1/sql-dump.html" rel="nofollow noreferrer">SQL dump</a> which is impractical for large datasets</li>
<li>stop all nodes, snapshot all disks, startup all nodes again. <strong>warning</strong>: this is something we have used to quickly load testing datasets but have not used it in production environments.</li>
</ul>
