From 5ce719aae6770d7ce7eed70a38aae78a9df39c3d Mon Sep 17 00:00:00 2001 From: Yecheng Fu Date: Tue, 16 Apr 2019 19:21:53 +0800 Subject: [PATCH] Improve workflow in docs/google-kubernetes-tutorial.md --- charts/tidb-cluster/templates/NOTES.txt | 7 +++++-- docs/google-kubernetes-tutorial.md | 19 ++++++++----------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/charts/tidb-cluster/templates/NOTES.txt b/charts/tidb-cluster/templates/NOTES.txt index b31da27fb6e..5112f1eb377 100644 --- a/charts/tidb-cluster/templates/NOTES.txt +++ b/charts/tidb-cluster/templates/NOTES.txt @@ -15,13 +15,16 @@ Cluster access kubectl port-forward -n {{ .Release.Namespace }} svc/{{ template "cluster.name" . }}-tidb 4000:4000 & {{- if .Values.tidb.passwordSecretName }} mysql -h 127.0.0.1 -P 4000 -u root -D test -p -{{- else -}} +{{- else }} mysql -h 127.0.0.1 -P 4000 -u root -D test Set a password for your user - SET PASSWORD FOR 'root'@'%' = '{{ (randAlphaNum 10) }}'; FLUSH PRIVILEGES + SET PASSWORD FOR 'root'@'%' = '{{ (randAlphaNum 10) }}'; FLUSH PRIVILEGES; {{- end -}} {{- if .Values.monitor.create }} * View monitor dashboard for TiDB cluster kubectl port-forward -n {{ .Release.Namespace }} svc/{{ template "cluster.name" . }}-grafana 3000:3000 Open browser at http://localhost:3000. The default username and password is admin/admin. + Note that, this works only on your local machine, if you test in remote server, you need to specify your server's external IP address. + For gcloud web console users, you can use web preview feature, e.g. https://ssh.cloud.google.com/devshell/proxy&port=3000. + Please refer to https://cloud.google.com/shell/docs/using-web-preview for more details. {{- end -}} diff --git a/docs/google-kubernetes-tutorial.md b/docs/google-kubernetes-tutorial.md index 8809d5ec1ff..8962af05cc9 100644 --- a/docs/google-kubernetes-tutorial.md +++ b/docs/google-kubernetes-tutorial.md @@ -79,7 +79,6 @@ Copy `helm` to your `$HOME` directory so that it will persist after the Cloud Sh Helm will also need a couple of permissions to work properly: - kubectl create serviceaccount tiller --namespace kube-system && kubectl apply -f ./manifests/tiller-rbac.yaml && helm init --service-account tiller --upgrade @@ -101,7 +100,7 @@ We can watch the operator come up with: watch kubectl get pods --namespace tidb-admin -o wide -When you see `Running`, `Control + C` and proceed to launch a TiDB cluster! +When you see all pods are `Running`, `Control + C` and proceed to launch a TiDB cluster! ## Deploy your first TiDB cluster @@ -123,20 +122,14 @@ There can be a small delay between the pod being up and running, and the service When you see `demo-tidb` appear, you can `Control + C`. The service is ready to connect to! -You can connect to the clustered service within the Kubernetes cluster: - - kubectl run -n tidb mysql-client --rm -i --tty --image mysql -- mysql -P 4000 -u root -h $(kubectl get svc demo-tidb -n tidb -o jsonpath='{.spec.clusterIP}') -p - -Congratulations, you are now up and running with a distributed TiDB database compatible with MySQL! - -In addition to connecting to TiDB within the Kubernetes cluster, you can also establish a tunnel between the TiDB service and your Cloud Shell. This is recommended only for debugging purposes, because the tunnel will not automatically be transferred if your Cloud Shell restarts. To establish a tunnel: +To connect to TiDB within the Kubernetes cluster, you can establish a tunnel between the TiDB service and your Cloud Shell. This is recommended only for debugging purposes, because the tunnel will not automatically be transferred if your Cloud Shell restarts. To establish a tunnel: kubectl -n tidb port-forward demo-tidb-0 4000:4000 &>/tmp/port-forward.log & From your Cloud Shell: sudo apt-get install -y mysql-client && - mysql -h 127.0.0.1 -u root -P 4000 -p + mysql -h 127.0.0.1 -u root -P 4000 Try out a MySQL command inside your MySQL terminal: @@ -144,8 +137,12 @@ Try out a MySQL command inside your MySQL terminal: If you did not specify a password in helm, set one now: - SET PASSWORD FOR 'root'@'%' = + SET PASSWORD FOR 'root'@'%' = ''; + +Note that, this command contains some special characters which cannot be +auto-populated, you need to copy and paste it into your console manually. +Congratulations, you are now up and running with a distributed TiDB database compatible with MySQL! ## Scale out the TiDB cluster