Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
iml-backup
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IML Open Source
iml-backup
Commits
ecb6735d
Commit
ecb6735d
authored
3 years ago
by
Hahn Axel (hahn)
Browse files
Options
Downloads
Patches
Plain Diff
couchdb2 v1.2 added fastmode in restore
parent
8c7256ca
No related branches found
No related tags found
1 merge request
!15
couchdb2 v1.2 added fastmode in restore
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
plugins/localdump/couchdb2.sh
+24
-17
24 additions, 17 deletions
plugins/localdump/couchdb2.sh
with
24 additions
and
17 deletions
plugins/localdump/couchdb2.sh
+
24
−
17
View file @
ecb6735d
...
@@ -13,6 +13,8 @@
...
@@ -13,6 +13,8 @@
# 2019-11-13 ..... v1.0 initial version with backup and restore (single DB)
# 2019-11-13 ..... v1.0 initial version with backup and restore (single DB)
# 2020-05-19 ..... v1.1 backup a single or multiple couchdb instances by globbing param
# 2020-05-19 ..... v1.1 backup a single or multiple couchdb instances by globbing param
# ./localdump.sh backup couchdb2 demo
# ./localdump.sh backup couchdb2 demo
# 2021-10-11 ..... v1.2 added fastmode in restore: no test connect, do not
# delete DB before create request
# ================================================================================
# ================================================================================
if
[
-z
$BACKUP_TARGETDIR
]
;
then
if
[
-z
$BACKUP_TARGETDIR
]
;
then
...
@@ -203,6 +205,8 @@ function _doBackupOfSingleInstance(){
...
@@ -203,6 +205,8 @@ function _doBackupOfSingleInstance(){
function
restoreByFile
(){
function
restoreByFile
(){
sMyfile
=
$1
sMyfile
=
$1
sMyDb
=
$2
sMyDb
=
$2
bFastMode
=
1
echo
echo
h2
"analyze dump
$sMyfile
"
h2
"analyze dump
$sMyfile
"
...
@@ -218,20 +222,21 @@ function restoreByFile(){
...
@@ -218,20 +222,21 @@ function restoreByFile(){
echo
echo
loadInstance
$COUCHDB_INSTANCE
loadInstance
$COUCHDB_INSTANCE
echo
connect
$couchdbhost
on port
$couchdbport
with user
$couchdbuser
if
[
$bFastMode
-eq
0
]
;
then
curl
--head
-X
GET
$COUCH_URL
2>/dev/null |
grep
"^HTTP.*
\
200
\
"
>
/dev/null
echo
connect
$couchdbhost
on port
$couchdbport
with user
$couchdbuser
if
[
$?
-ne
0
]
;
then
curl
--head
-X
GET
$COUCH_URL
2>/dev/null |
grep
"^HTTP.*
\
200
\
"
>
/dev/null
color error
if
[
$?
-ne
0
]
;
then
echo
ERROR: couch DB instance is not available
color error
curl
-X
GET
$COUCH_URL
echo
ERROR: couch DB instance is not available
curl
-X
GET
$COUCH_URL
color reset
exit
1
fi
color ok
echo
OK
color reset
color reset
exit
1
fi
fi
color ok
echo
OK
color reset
echo
echo
...
@@ -240,11 +245,13 @@ function restoreByFile(){
...
@@ -240,11 +245,13 @@ function restoreByFile(){
# echo DB exists ... need to drop it first
# echo DB exists ... need to drop it first
# fi
# fi
h2 deleting database
[
$sMyDb
]
...
if
[
$bFastMode
-eq
0
]
;
then
color cmd
h2 deleting database
[
$sMyDb
]
...
_couchapi DELETE
$sMyDb
color cmd
fetchrc
_couchapi DELETE
$sMyDb
color reset
fetchrc
color reset
fi
h2 creating database
[
$sMyDb
]
...
h2 creating database
[
$sMyDb
]
...
color cmd
color cmd
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment