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

use tidb-lightning in restore instead of loader (#2068) #2083

Merged
merged 4 commits into from
Mar 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions cmd/backup-manager/app/import/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,17 @@ func (ro *Options) loadTidbClusterData(restorePath string) error {
return fmt.Errorf("dir %s does not exist or is not a dir", restorePath)
}
args := []string{
fmt.Sprintf("-d=%s", restorePath),
fmt.Sprintf("-h=%s", ro.Host),
fmt.Sprintf("-P=%d", ro.Port),
fmt.Sprintf("-u=%s", ro.User),
fmt.Sprintf("-p=%s", ro.Password),
"--status-addr=0.0.0.0:8289",
"--backend=tidb",
"--server-mode=false",
"–-log-file=",
fmt.Sprintf("--tidb-user=%s", ro.User),
fmt.Sprintf("--tidb-password=%s", ro.Password),
fmt.Sprintf("--tidb-host=%s", ro.Host),
fmt.Sprintf("--d=%s", restorePath),
}

output, err := exec.Command("/loader", args...).CombinedOutput()
output, err := exec.Command("/tidb-lightning", args...).CombinedOutput()
if err != nil {
return fmt.Errorf("cluster %s, execute loader command %v failed, output: %s, err: %v", ro, args, string(output), err)
}
Expand Down
11 changes: 11 additions & 0 deletions images/tidb-backup-manager/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
FROM pingcap/tidb-enterprise-tools:latest
ARG VERSION=v1.51.0
ARG SHUSH_VERSION=v1.4.0
ARG TOOLKIT_VERSION=v3.0.12
RUN apk update && apk add ca-certificates

RUN wget -nv https://github.com/ncw/rclone/releases/download/${VERSION}/rclone-${VERSION}-linux-amd64.zip \
Expand All @@ -19,7 +20,17 @@ RUN wget -nv https://github.com/realestate-com-au/shush/releases/download/${SHUS
&& mv shush_linux_amd64 /usr/local/bin/shush \
&& chmod 755 /usr/local/bin/shush

RUN \
wget -nv https://download.pingcap.org/tidb-toolkit-${TOOLKIT_VERSION}-linux-amd64.tar.gz \
&& tar -xzf tidb-toolkit-${TOOLKIT_VERSION}-linux-amd64.tar.gz \
&& mv tidb-toolkit-${TOOLKIT_VERSION}-linux-amd64/bin/tidb-lightning /tidb-lightning \
&& mv tidb-toolkit-${TOOLKIT_VERSION}-linux-amd64/bin/tidb-lightning-ctl /tidb-lightning-ctl \
&& chmod 755 /tidb-lightning /tidb-lightning-ctl \
&& rm -rf tidb-toolkit-${TOOLKIT_VERSION}-linux-amd64.tar.gz \
&& rm -rf tidb-toolkit-${TOOLKIT_VERSION}-linux-amd64

COPY bin/tidb-backup-manager /tidb-backup-manager
COPY entrypoint.sh /entrypoint.sh


ENTRYPOINT ["/entrypoint.sh"]