Hi everyone! I have a quick question and was hopin...
# community-help
d
Hi everyone! I have a quick question and was hoping someone in the community could help us understand it better. We're working on setting up an "environment refresh" process in Typesense, where we replicate production data to a development environment. The idea is to take a snapshot of the production cluster and move the files from the snapshot to the development environment. Then, on the development node, we run rm -rf /var/lib/typesense and restore the snapshot from production. However, we noticed a small inconsistency with the API keys. In one test, we wanted to clear the data, and all the API keys were removed after the restore, which was a problem because we had to manually recreate the monitoring and administration keys. However, in another test, the API keys were replaced with the production API keys. Could someone clarify how Typesense handles API keys during this type of snapshot restore? Is there a reliable way to restore everything except the API keys, or at least understand when and why they're overwritten? Thank you so much in advance! Any thoughts or experience would be greatly appreciated.
a
Hi @Diego Chacón Sanchiz, Snapshots should also replicate your API KEYS, which means the correct is for the new cluster to have the same keys and the old one. This inconsistency suggests that there is something happening in the restoring process. You can have a look in the syslogs and Typesense logs and check for abnormalities!
d
Hey @Alan Martini! Yes, in the following tests I've performed, I see that this is the expected behavior, but I was wondering if there's a way to retain the API keys from the development environment. We wanted to add that level of security. Thanks for the response, and best regards!
a
Hey @Diego Chacón Sanchiz, Hmmm, since the snapshot overwrites everything, there's no way to selectively only load particular types of data from a snapshot What can be done, since you'll always have the production API key, is: after you snapshot, use the PROD API key to change the API key to a previously defined one. Doing this via script will make it consistent.
d
Yeah... I had thought about that, but I wanted to have different API KEYs per environment, and there's no way to define the "hash" of the API KEY I want to call... Okay, thanks a lot for the clarification, best regards!