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

restore database from cloud #160

Merged
merged 13 commits into from
Nov 7, 2018
Merged

Conversation

xiaojingchen
Copy link
Contributor

this PR add restore job, the feature can restore data to a TiDB cluster, the premise is that the data is saved in the cloud (recommended gcs)

* add readiness probes for tidb service
@gregwebs
Copy link
Contributor

What's the plan to make this scale?

  1. Download one file first
  2. Start loading the first file while downloading the second
  3. Delete the first file once it is loaded.

@xiaojingchen xiaojingchen changed the title [WIP] restore database from cloud restore database from cloud Nov 1, 2018
secret:
secretName: {{ .Values.clusterName }}-restore-secret
{{- end }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new line.

requests:
storage: {{ .Values.restore.storage }}
storageClassName: {{ .Values.restore.storageClassName }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

app.kubernetes.io/name: {{ template "chart.name" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
app.kubernetes.io/instance: {{ .Values.clusterName }}
app.kubernetes.io/component: restore-secret
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
app.kubernetes.io/component: restore-secret
app.kubernetes.io/component: restore

apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.clusterName }}-restore-secret
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: {{ .Values.clusterName }}-restore-secret
name: {{ .Values.clusterName }}-restore

credentials.json: {{ .Values.restore.gcp.credentialsData }}
{{- end }}
user-password: {{ .Values.restore.password | b64enc | quote }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new line

@@ -5,7 +5,7 @@ host=`echo {{ .Values.clusterName }}_TIDB_SERVICE_HOST | tr '[a-z]' '[A-Z]'`
mkdir -p /data/${dirname}/
cp /savepoint-dir/savepoint /data/${dirname}/

mydumper \
./mydumper \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change mydumper to ./mydumper?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new version image: pingcap/tidb-cloud-backup:latest will base pingcap/tidb-enterprise-tools:latest , the mydumper and loader's path change.
look at:
tennix/tidb-cloud-backup#1

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If so, please use an absolute path.

-p ${TIDB_PASSWORD} \
-P 4000 \
{{ .Values.restore.options }}
{{- end }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add new line

set -euo pipefail

dirname=`date +%Y-%m-%dT%H%M%S`-${MY_POD_NAME}
mkdir -p /data/${dirname}/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

difine /data/${dirname}/ as a var.

--destDir=/data/${dirname}

dataDir=/data/${dirname}/{{ .Values.restore.gcp.srcDir }}
./loader \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
./loader \
loader \

?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

@tennix
Copy link
Member

tennix commented Nov 1, 2018

@gregwebs I think it's a long-term plan to make loader support cloud natively.
/cc @GregoryIan

@tennix tennix self-assigned this Nov 1, 2018
@xiaojingchen
Copy link
Contributor Author

@gregwebs the plan is:

  1. download all the data files from gcs to pv first
  2. the loader restore the datas to tidb

if any step failed then the job is failed and quit

@xiaojingchen
Copy link
Contributor Author

/run-e2e-tests

weekface
weekface previously approved these changes Nov 6, 2018
Copy link
Contributor

@weekface weekface left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

tennix
tennix previously approved these changes Nov 6, 2018
Copy link
Member

@tennix tennix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

secretKeyRef:
name: {{ .Values.clusterName }}-restore-secret
key: user-password
restartPolicy: OnFailure
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is here a second time.

host=`echo {{ .Values.clusterName }}_TIDB_SERVICE_HOST | tr '[a-z]' '[A-Z]'`

{{- if .Values.restore.gcp }}
downloader \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fails for me. /bin/sh: line 7: downloader: command not found

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest image is just pushed to DockerHub.

@xiaojingchen xiaojingchen dismissed stale reviews from tennix and weekface via 01140c1 November 7, 2018 06:16
@xiaojingchen
Copy link
Contributor Author

/run-e2e-tests

2 similar comments
@xiaojingchen
Copy link
Contributor Author

/run-e2e-tests

@weekface
Copy link
Contributor

weekface commented Nov 7, 2018

/run-e2e-tests

@xiaojingchen
Copy link
Contributor Author

/run-e2e-tests

Copy link
Contributor

@weekface weekface left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tennix tennix merged commit 744fd54 into pingcap:master Nov 7, 2018
queenliuxx pushed a commit to queenliuxx/tidb-operator that referenced this pull request Dec 19, 2018
* TiDB readiness probes (pingcap#147)

* add readiness probes for tidb service

* fix script
fgksgf pushed a commit to fgksgf/tidb-operator that referenced this pull request Dec 23, 2024
Signed-off-by: liubo02 <liubo02@pingcap.com>
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

Successfully merging this pull request may close these issues.

4 participants