Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assistance: How to use thsi to restore backups from local into confluent cloud #36

Open
beckyshaw opened this issue Jan 29, 2024 · 9 comments

Comments

@beckyshaw
Copy link

beckyshaw commented Jan 29, 2024

Hello!
How can I use this to backup using <go run ./cmd/ccloud-schema-exporter.go -getLocalCopy -syncDeletes -localPath .$@/${ENV}/${datestring}> and then restore back to confluent cloud if a schema is deleted from schema registry please?

So if i bring a backup from ccloud in local, what command would i need to send it back to ccloud?

@beckyshaw
Copy link
Author

@abraham-leal is there a way to skip any existing schemas when pushing to a destination so it will upload any missing ones in a batch whilst leaving duplicates (source file exists in destination) alone?

@beckyshaw
Copy link
Author

beckyshaw commented Feb 6, 2024

---------------------------------------------------------------------------------- mkdir -p .schema_restore/nonprod/2024-02-06 go run ./cmd/ccloud-schema-exporter.go -fromLocalCopy -syncDeletes -localPath .schema_restore/nonprod/2024-02-06 2024/02/06
10:33:13 You have existing subjects registered in the destination registry, exporter cannot write schemas when previous schemas exist in batch mode.

@aadubey
Copy link

aadubey commented Feb 6, 2024

Hi @beckyshaw - Thanks a lot for raising this issue. If your destination schema isn't blank and you are simply trying to restore some subjects from your local file system, then you can run this command with -noPrompt flag. This will bypass all the preflight checks - you need to ensure that the destination schema compatibility mode for these subjects and the import mode is correctly set for the subjects being imported. As long as these are properly set, bypassing the pre-flight check should do the trick for you. Please reach out if this doesn't work.

@abraham-leal
Copy link
Owner

Hey @beckyshaw thanks for the questions. As @aadubey mentioned, you can override the checks with -noPrompt. The tool will attempt to register all schemas, and fail with the ones that already exist (have the same schema ID). Keep in mind you may also use allow/deny lists to achieve filtering.

@beckyshaw
Copy link
Author

Thanks both. I no longer get errors with it so will run a few more tests and make sure i can backup schemas :)

@beckyshaw
Copy link
Author

beckyshaw commented Feb 19, 2024

Hi @abraham-leal @aadubey
can you help with figuring out why schema restore is saying it's complete but it's not sending back to ccloud schema registry as a destination? Is fromLocalCopy the correct option?
edit:
I managed to get it working again but on one particular schema i deleted as a test to restore it gave the below error:

2024/02/19 11:54:24 ERROR: Received status code 422 instead of 200 for POST, on [redacted]/subjects/beck-testing-1/versions, HTTP Response:

@aadubey
Copy link

aadubey commented Feb 19, 2024

Hi @beckyshaw - could you please post the full logs?

422 is expected when the schema isn't valid.
https://docs.confluent.io/platform/current/schema-registry/develop/api.html#post--subjects-(string-%20subject)-versions

@beckyshaw
Copy link
Author

when you say it's not valid what do you mean? It technically doesnt exist at the destination side yet because it was deleted but it was created in ccloud and backed up using the schema exporter so it should be valid.

@aadubey
Copy link

aadubey commented Feb 19, 2024

Hi @beckyshaw - we need to see the reason for 422 (which is masked in your original update). Could you please share the full logs from exporter?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants