You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: en/initialize-a-cluster.md
+7-17Lines changed: 7 additions & 17 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,14 +14,12 @@ This document describes how to initialize a TiDB cluster on Kubernetes (K8s), sp
14
14
15
15
## Configure TidbInitializer
16
16
17
-
Refer to [TidbInitializer configuration example](<https://github.com/pingcap/tidb-operator/blob/{{{ .tidb_operator_version }}}/manifests/initializer/tidb-initializer.yaml>), [API documentation](<https://github.com/pingcap/tidb-operator/blob/{{{ .tidb_operator_version }}}/docs/api-references/docs.md>), and the following steps to complete TidbInitializer Custom Resource (CR), and save it to the `${cluster_name}/tidb-initializer.yaml` file. When referring to the TidbInitializer configuration example and API documentation, you need to switch the branch to the TiDB Operator version currently in use.
17
+
Refer to [TidbInitializer configuration example](<https://github.com/pingcap/tidb-operator/blob/{{{ .tidb_operator_version }}}/manifests/initializer/tidb-initializer.yaml>), [API documentation](<https://github.com/pingcap/tidb-operator/blob/{{{ .tidb_operator_version }}}/docs/api-references/docs.md#tidbinitializer>), and the following steps to complete TidbInitializer Custom Resource (CR), and save it to the `${cluster_name}/tidb-initializer.yaml` file. When referring to the TidbInitializer configuration example and API documentation, you need to switch the branch to the TiDB Operator version currently in use.
18
18
19
19
### Set the cluster namespace and name
20
20
21
21
In the `${cluster_name}/tidb-initializer.yaml` file, modify the `spec.cluster.namespace` and `spec.cluster.name` fields:
22
22
23
-
{{< copyable "shell-regular" >}}
24
-
25
23
```yaml
26
24
# ...
27
25
spec:
@@ -37,22 +35,24 @@ When a cluster is created, a default account `root` is created with no password.
37
35
38
36
- Create a [`secret`](https://kubernetes.io/docs/concepts/configuration/secret/) to specify the password for `root`:
This command creates `root` and `developer` users with their passwords, which are saved in the `tidb-secret` object. By default, the regular `developer` user is only granted with the `USAGE` privilege. You can set other privileges in the `initSql` configuration item.
55
49
50
+
Make sure to do these before creating the cluster:
51
+
52
+
- Create the secret.
53
+
- Match the `passwordSecret` in the `TidbInitializer` with the secret name that you used for the root password.
54
+
- Apply `${cluster_name}/tidb-initializer.yaml` to the cluster.
55
+
56
56
## Set a host that has access to TiDB
57
57
58
58
To set a host that has access to TiDB, modify the `permitHost: ${mysql_client_host_name}` configuration item in `${cluster_name}/tidb-initializer.yaml`. If it is not set, all hosts have access to TiDB. For details, refer to [Mysql GRANT host name](https://dev.mysql.com/doc/refman/5.7/en/grant.html).
@@ -63,8 +63,6 @@ The cluster can also automatically execute the SQL statements in batch in `initS
63
63
64
64
For example, the following configuration automatically creates a database named `app` after the cluster creation, and grants the `developer` account full management privileges on `app`:
0 commit comments