From 098deda39833e35adddb118ba3f48517ddc9c699 Mon Sep 17 00:00:00 2001 From: Yecheng Fu <cofyc.jackson@gmail.com> Date: Tue, 16 Apr 2019 19:21:53 +0800 Subject: [PATCH 01/11] Improve workflow in docs/google-kubernetes-tutorial.md --- charts/tidb-cluster/templates/NOTES.txt | 7 +++++-- docs/google-kubernetes-tutorial.md | 21 +++++++++------------ 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/charts/tidb-cluster/templates/NOTES.txt b/charts/tidb-cluster/templates/NOTES.txt index b31da27fb6e..e28180ad314 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, if you run in remote server, you need to specify server's external IP address. + In gcloud web console, you can user web preview feature, e.g. https://ssh.cloud.google.com/devshell/proxy&port=3000. + You can 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..9f540041675 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: +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 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: - - kubectl -n tidb port-forward demo-tidb-0 4000:4000 &>/tmp/port-forward.log & + kubectl -n tidb port-forward svc/demo-tidb 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'@'%' = '<change-to-your-password>'; + +_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 From 48a42426d15f22e0d3618d5403fd65946e164c7b Mon Sep 17 00:00:00 2001 From: Greg Weber <greg@gregweber.info> Date: Wed, 17 Apr 2019 01:13:58 +0800 Subject: [PATCH 02/11] Update charts/tidb-cluster/templates/NOTES.txt Co-Authored-By: cofyc <cofyc.jackson@gmail.com> --- charts/tidb-cluster/templates/NOTES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/tidb-cluster/templates/NOTES.txt b/charts/tidb-cluster/templates/NOTES.txt index e28180ad314..f6d92bcd512 100644 --- a/charts/tidb-cluster/templates/NOTES.txt +++ b/charts/tidb-cluster/templates/NOTES.txt @@ -24,7 +24,7 @@ Cluster access * 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, if you run in remote server, you need to specify server's external IP address. + If you are running this from a remote machine, you must specify server's external IP address. In gcloud web console, you can user web preview feature, e.g. https://ssh.cloud.google.com/devshell/proxy&port=3000. You can refer to https://cloud.google.com/shell/docs/using-web-preview for more details. {{- end -}} From 0d7de8aad11a019b24064419d3fe855701352b4c Mon Sep 17 00:00:00 2001 From: Greg Weber <greg@gregweber.info> Date: Wed, 17 Apr 2019 01:14:38 +0800 Subject: [PATCH 03/11] Update docs/google-kubernetes-tutorial.md Co-Authored-By: cofyc <cofyc.jackson@gmail.com> --- docs/google-kubernetes-tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/google-kubernetes-tutorial.md b/docs/google-kubernetes-tutorial.md index 9f540041675..b1f3f6dd94a 100644 --- a/docs/google-kubernetes-tutorial.md +++ b/docs/google-kubernetes-tutorial.md @@ -140,7 +140,7 @@ If you did not specify a password in helm, set one now: SET PASSWORD FOR 'root'@'%' = '<change-to-your-password>'; _Note that, this command contains some special characters which cannot be -auto-populated, you need to copy and paste it into your console manually._ +auto-populated in the google cloud shell tutorial: 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! From bcb219170863dcb656f57a6b77df7ee5f5983b18 Mon Sep 17 00:00:00 2001 From: Yecheng Fu <cofyc.jackson@gmail.com> Date: Wed, 17 Apr 2019 10:24:08 +0800 Subject: [PATCH 04/11] install helm in one command --- docs/google-kubernetes-tutorial.md | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/docs/google-kubernetes-tutorial.md b/docs/google-kubernetes-tutorial.md index 9f540041675..3ec840f5512 100644 --- a/docs/google-kubernetes-tutorial.md +++ b/docs/google-kubernetes-tutorial.md @@ -63,13 +63,9 @@ If you see `Ready` for all nodes, congratulations! You've setup your first Kuber Helm is the package manager for Kubernetes, and is what allows us to install all of the distributed components of TiDB in a single step. Helm requires both a server-side and a client-side component to be installed. -Download the `helm` installer: - - curl https://raw.githubusercontent.com/kubernetes/helm/master/scripts/get > get_helm.sh - Install `helm`: - chmod 700 get_helm.sh && ./get_helm.sh + curl https://raw.githubusercontent.com/helm/helm/master/scripts/get | bash Copy `helm` to your `$HOME` directory so that it will persist after the Cloud Shell reaches its idle timeout: From 47e02150a08997013b55ecff0d30c247fc23c37e Mon Sep 17 00:00:00 2001 From: Yecheng Fu <cofyc.jackson@gmail.com> Date: Wed, 17 Apr 2019 10:32:01 +0800 Subject: [PATCH 05/11] fix link --- charts/tidb-cluster/templates/NOTES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/tidb-cluster/templates/NOTES.txt b/charts/tidb-cluster/templates/NOTES.txt index e28180ad314..cf536ecfb02 100644 --- a/charts/tidb-cluster/templates/NOTES.txt +++ b/charts/tidb-cluster/templates/NOTES.txt @@ -25,6 +25,6 @@ Cluster access 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, if you run in remote server, you need to specify server's external IP address. - In gcloud web console, you can user web preview feature, e.g. https://ssh.cloud.google.com/devshell/proxy&port=3000. + In gcloud web console, you can user web preview feature, e.g. https://ssh.cloud.google.com/devshell/proxy?port=3000 You can refer to https://cloud.google.com/shell/docs/using-web-preview for more details. {{- end -}} From f77e69ad1d8716674a1b1ab38a3ddc6881f2221d Mon Sep 17 00:00:00 2001 From: Yecheng Fu <cofyc.jackson@gmail.com> Date: Wed, 17 Apr 2019 11:00:42 +0800 Subject: [PATCH 06/11] fix typo --- charts/tidb-cluster/templates/NOTES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/tidb-cluster/templates/NOTES.txt b/charts/tidb-cluster/templates/NOTES.txt index 27b561e2c91..557d8338d3e 100644 --- a/charts/tidb-cluster/templates/NOTES.txt +++ b/charts/tidb-cluster/templates/NOTES.txt @@ -25,6 +25,6 @@ Cluster access 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. If you are running this from a remote machine, you must specify server's external IP address. - In gcloud web console, you can user web preview feature, e.g. https://ssh.cloud.google.com/devshell/proxy?port=3000 + In gcloud web console, you can use web preview feature, e.g. https://ssh.cloud.google.com/devshell/proxy?port=3000 You can refer to https://cloud.google.com/shell/docs/using-web-preview for more details. {{- end -}} From 9069d4464d1126d8250b9124f0e07339f70880f9 Mon Sep 17 00:00:00 2001 From: Yecheng Fu <cofyc.jackson@gmail.com> Date: Wed, 17 Apr 2019 11:03:57 +0800 Subject: [PATCH 07/11] specify which pods should be running --- docs/google-kubernetes-tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/google-kubernetes-tutorial.md b/docs/google-kubernetes-tutorial.md index b8d30b79822..bad02ba0cb2 100644 --- a/docs/google-kubernetes-tutorial.md +++ b/docs/google-kubernetes-tutorial.md @@ -96,7 +96,7 @@ We can watch the operator come up with: watch kubectl get pods --namespace tidb-admin -o wide -When you see all pods are `Running`, `Control + C` and proceed to launch a TiDB cluster! +When you see tidb-scheduler and tidb-controller-manager are `Running`, `Control + C` and proceed to launch a TiDB cluster! ## Deploy your first TiDB cluster From d4c82cca77e67a978a75131ad74deee2dc92f7fd Mon Sep 17 00:00:00 2001 From: Yecheng Fu <cofyc.jackson@gmail.com> Date: Wed, 17 Apr 2019 11:32:14 +0800 Subject: [PATCH 08/11] delete note about gcloud web console --- charts/tidb-cluster/templates/NOTES.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/charts/tidb-cluster/templates/NOTES.txt b/charts/tidb-cluster/templates/NOTES.txt index 557d8338d3e..689a1e2762f 100644 --- a/charts/tidb-cluster/templates/NOTES.txt +++ b/charts/tidb-cluster/templates/NOTES.txt @@ -25,6 +25,4 @@ Cluster access 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. If you are running this from a remote machine, you must specify server's external IP address. - In gcloud web console, you can use web preview feature, e.g. https://ssh.cloud.google.com/devshell/proxy?port=3000 - You can refer to https://cloud.google.com/shell/docs/using-web-preview for more details. {{- end -}} From 40120e1ef9896d06acb9ddd505f70915b1ba75f3 Mon Sep 17 00:00:00 2001 From: Lilian Lee <lilin@pingcap.com> Date: Thu, 18 Apr 2019 15:52:46 +0800 Subject: [PATCH 09/11] Update charts/tidb-cluster/templates/NOTES.txt Co-Authored-By: cofyc <cofyc.jackson@gmail.com> --- charts/tidb-cluster/templates/NOTES.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/tidb-cluster/templates/NOTES.txt b/charts/tidb-cluster/templates/NOTES.txt index 689a1e2762f..db12efca9ef 100644 --- a/charts/tidb-cluster/templates/NOTES.txt +++ b/charts/tidb-cluster/templates/NOTES.txt @@ -24,5 +24,5 @@ Cluster access * 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. - If you are running this from a remote machine, you must specify server's external IP address. + If you are running this from a remote machine, you must specify the server's external IP address. {{- end -}} From 00b14a4b6dd4104099f99d3ef607fc8a4cf0bf91 Mon Sep 17 00:00:00 2001 From: Lilian Lee <lilin@pingcap.com> Date: Thu, 18 Apr 2019 15:52:57 +0800 Subject: [PATCH 10/11] Update docs/google-kubernetes-tutorial.md Co-Authored-By: cofyc <cofyc.jackson@gmail.com> --- docs/google-kubernetes-tutorial.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/google-kubernetes-tutorial.md b/docs/google-kubernetes-tutorial.md index bad02ba0cb2..9fda6c5f676 100644 --- a/docs/google-kubernetes-tutorial.md +++ b/docs/google-kubernetes-tutorial.md @@ -96,7 +96,7 @@ We can watch the operator come up with: watch kubectl get pods --namespace tidb-admin -o wide -When you see tidb-scheduler and tidb-controller-manager are `Running`, `Control + C` and proceed to launch a TiDB cluster! +When you see both tidb-scheduler and tidb-controller-manager are `Running`, press <kbd>Ctrl</kbd>+<kbd>C</kbd> and proceed to launch a TiDB cluster! ## Deploy your first TiDB cluster From 72ba12f3f849456afeac55b154bdb0c5d8fcc2eb Mon Sep 17 00:00:00 2001 From: Yecheng Fu <cofyc.jackson@gmail.com> Date: Thu, 18 Apr 2019 18:02:49 +0800 Subject: [PATCH 11/11] Use <kbd>Ctrl</kbd>+<kbd>C</kbd>, better way to show keyboard keys --- docs/google-kubernetes-tutorial.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/google-kubernetes-tutorial.md b/docs/google-kubernetes-tutorial.md index 9fda6c5f676..f3018a7f55b 100644 --- a/docs/google-kubernetes-tutorial.md +++ b/docs/google-kubernetes-tutorial.md @@ -82,7 +82,7 @@ It takes a minute for helm to initialize `tiller`, its server component: watch "kubectl get pods --namespace kube-system | grep tiller" -When you see `Running`, it's time to hit `Control + C` and proceed to the next step! +When you see `Running`, it's time to hit <kbd>Ctrl</kbd>+<kbd>C</kbd> and proceed to the next step! ## Deploy TiDB Operator @@ -108,7 +108,7 @@ It will take a few minutes to launch. You can monitor the progress with: watch kubectl get pods --namespace tidb -o wide -The TiDB cluster includes 2 TiDB pods, 3 TiKV pods, and 3 PD pods. When you see all pods `Running`, it's time to `Control + C` and proceed forward! +The TiDB cluster includes 2 TiDB pods, 3 TiKV pods, and 3 PD pods. When you see all pods `Running`, it's time to <kbd>Ctrl</kbd>+<kbd>C</kbd> and proceed forward! ## Connect to the TiDB cluster @@ -116,7 +116,7 @@ There can be a small delay between the pod being up and running, and the service watch "kubectl get svc -n tidb" -When you see `demo-tidb` appear, you can `Control + C`. The service is ready to connect to! +When you see `demo-tidb` appear, you can <kbd>Ctrl</kbd>+<kbd>C</kbd>. The service is ready to connect to! 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: