Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
7fe1e06f
Commit
7fe1e06f
authored
Oct 28, 2016
by
Wojciech Tyczynski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support events in restore script
parent
2f756e4e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
restore-from-backup.sh
cluster/restore-from-backup.sh
+16
-3
No files found.
cluster/restore-from-backup.sh
View file @
7fe1e06f
...
@@ -30,9 +30,8 @@
...
@@ -30,9 +30,8 @@
# - in case of etcd2 - *.snap and *.wal files are in current directory
# - in case of etcd2 - *.snap and *.wal files are in current directory
# - in case of etcd3 - *.db file is in the current directory
# - in case of etcd3 - *.db file is in the current directory
# - the script is run as root
# - the script is run as root
#
# - for event etcd, we only support clearing it - to do it, you need to
# The script doesn't support restoring event etcd.
# set RESET_EVENT_ETCD=true env var.
set
-o
errexit
set
-o
errexit
set
-o
nounset
set
-o
nounset
...
@@ -45,6 +44,12 @@ set -o pipefail
...
@@ -45,6 +44,12 @@ set -o pipefail
# the current one and create a file with such configuration.
# the current one and create a file with such configuration.
# The restore procedure is chosen based on this information.
# The restore procedure is chosen based on this information.
VERSION_FILE
=
"version.txt"
VERSION_FILE
=
"version.txt"
# Make it possible to overwrite version file (or default version)
# with VERSION_CONTENTS env var.
if
[
-n
"
${
VERSION_CONTENTS
:-}
"
]
;
then
echo
"
${
VERSION_CONTENTS
}
"
>
"
${
VERSION_FILE
}
"
fi
if
[
!
-f
"
${
VERSION_FILE
}
"
]
;
then
if
[
!
-f
"
${
VERSION_FILE
}
"
]
;
then
echo
"2.2.1/etcd2"
>
"
${
VERSION_FILE
}
"
echo
"2.2.1/etcd2"
>
"
${
VERSION_FILE
}
"
fi
fi
...
@@ -205,6 +210,14 @@ mv /var/etcd/data "${MNT_DISK}/var/etcd-corrupted"
...
@@ -205,6 +210,14 @@ mv /var/etcd/data "${MNT_DISK}/var/etcd-corrupted"
# Replace the corrupted data dir with the resotred data.
# Replace the corrupted data dir with the resotred data.
mv
"
${
BACKUP_DIR
}
"
/var/etcd/data
mv
"
${
BACKUP_DIR
}
"
/var/etcd/data
if
[
"
${
RESET_EVENT_ETCD
:-}
"
==
"true"
]
;
then
EVENTS_CORRUPTED_DIR
=
"
${
MNT_DISK
}
/var/etcd-events-corrupted"
# Save the corrupted data (clean directory if it is already non-empty).
rm
-rf
"
${
EVENTS_CORRUPTED_DIR
}
"
mkdir
-p
"
${
EVENTS_CORRUPTED_DIR
}
"
mv
/var/etcd/data-events
"
${
EVENTS_CORRUPTED_DIR
}
"
fi
# Start etcd and kube-apiserver again.
# Start etcd and kube-apiserver again.
echo
"Restarting etcd and apiserver from restored snapshot"
echo
"Restarting etcd and apiserver from restored snapshot"
mv
"
${
MANIFEST_BACKUP_DIR
}
"
/
*
"
${
MANIFEST_DIR
}
/"
mv
"
${
MANIFEST_BACKUP_DIR
}
"
/
*
"
${
MANIFEST_DIR
}
/"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment