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

Backup all databases #85

Open
skycult opened this issue Mar 7, 2020 · 9 comments
Open

Backup all databases #85

skycult opened this issue Mar 7, 2020 · 9 comments

Comments

@skycult
Copy link

skycult commented Mar 7, 2020

Hello,
there is an option to backup/restore all databases?
Thank you!

@PulkitSolulab
Copy link

Hello,
there is an option to backup/restore all databases?
Thank you!

Did you find anything till now. How to take all Databases at once

@skycult
Copy link
Author

skycult commented Dec 31, 2020

I created a nodejs small cli app to get a full databases list calling the script for every list item.

@greenais
Copy link

@skycult could you please share your app?
I have plenty of DBs to backup so not inventing wheel once again would be quite time-saving)

@dalgibbard
Copy link
Collaborator

Just curl couchdb, parse it with jq, and pass the list into a for loop? :)

@abheyogy
Copy link

abheyogy commented May 5, 2021

Its a simple curl, please find the snippet in BASH below:

for i in $(curl -X GET http://127.0.0.1:5984/_all_dbs); do \
         i=${i//[/}; i=${i//]/}; i=${i//\"/}
         IFS=, read -ra dbname <<< "$i"
done

for db in "${dbname[@]}"; do \
    echo $db;
done

@schwichti
Copy link

Shouldn't that line be

for db in "${dbname[@]}"; do \

@abheyogy
Copy link

Shouldn't that line be

for db in "${dbname[@]}"; do \

Yes, it was a typo, updated. Thanks for pointing it out.

@schwichti
Copy link

Thanks for sharing the snippet

@backspace
Copy link

Also thanks, I adapted it to extract all the databases into a directory:

for i in $(curl -X GET http://127.0.0.1:5984/_all_dbs); do \
         i=${i//[/}; i=${i//]/}; i=${i//\"/}
         IFS=, read -ra dbname <<< "$i"
done

for db in "${dbname[@]}"; do \
    echo $db;
    ./couchdb-dump.sh -b -H 127.0.0.1 -d ${db} -f dbs/${db}.json
done

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

7 participants