Skip to content

Commit b89d270

Browse files
authored
tiproxy: improve deployment instructions for deploying TiProxy (pingcap#19904)
1 parent f5e538d commit b89d270

5 files changed

+54
-11
lines changed

config-templates/simple-tiproxy.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ global:
88
component_versions:
99
tiproxy: "v1.2.0"
1010
server_configs:
11+
tidb:
12+
graceful-wait-before-shutdown: 15
1113
tiproxy:
1214
ha.virtual-ip: "10.0.1.10/24"
1315
ha.interface: "eth0"
16+
graceful-wait-before-shutdown: 15
1417

1518
pd_servers:
1619
- host: 10.0.1.1
@@ -29,7 +32,19 @@ tikv_servers:
2932

3033
tiproxy_servers:
3134
- host: 10.0.1.11
35+
deploy_dir: "/tiproxy-deploy"
36+
data_dir: "/tiproxy-data"
37+
port: 6000
38+
status_port: 3080
39+
config:
40+
labels: { zone: "east" }
3241
- host: 10.0.1.12
42+
deploy_dir: "/tiproxy-deploy"
43+
data_dir: "/tiproxy-data"
44+
port: 6000
45+
status_port: 3080
46+
config:
47+
labels: { zone: "west" }
3348

3449
monitoring_servers:
3550
- host: 10.0.1.13

tiproxy/tiproxy-configuration.md

+14-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ summary: Learn how to configure TiProxy.
55

66
# TiProxy Configuration File
77

8-
This document introduces the configuration parameters related to the deployment and use of TiProxy. The following is an example configuration:
8+
This document introduces the configuration parameters related to the deployment and use of TiProxy. For the configurations of TiUP deployment topology, see [tiproxy-servers configurations](/tiup/tiup-cluster-topology-reference.md#tiproxy_servers).
9+
10+
The following is an example configuration:
911

1012
```toml
1113
[proxy]
@@ -43,13 +45,13 @@ Configuration for SQL port.
4345

4446
+ Default value: `0.0.0.0:6000`
4547
+ Support hot-reload: no
46-
+ SQL gateway address. The format is `<ip>:<port>`.
48+
+ The listening address of the SQL service. The format is `<ip>:<port>`. This configuration item is automatically set when you deploy TiProxy using TiUP or TiDB Operator.
4749

4850
#### `advertise-addr`
4951

5052
+ Default value: `""`
5153
+ Support hot-reload: no
52-
+ Specifies the address that clients use to connect to this TiProxy instance. This configuration item is automatically set when you deploy TiProxy using TiUP or TiDB Operator. If not set, the external IP address of the TiProxy instance is used.
54+
+ Specifies the address that other components use to connect to this TiProxy instance. This address only contains the host name, not the port. This address might be different from the host name in [`addr`](#addr). For example, if the `Subject Alternative Name` in TiProxy's TLS certificate contains only the domain name, other components will fail to connect to TiProxy via IP. This configuration item is automatically set when you deploy TiProxy using TiUP or TiDB Operator. If not set, the external IP address of the TiProxy instance is used.
5355

5456
#### `graceful-wait-before-shutdown`
5557

@@ -136,6 +138,15 @@ High availability configurations for TiProxy.
136138
+ Support hot-reload: no
137139
+ Specifies the virtual IP address in the CIDR format, such as `"10.0.1.10/24"`. In a cluster with multiple TiProxy instances, only one instance binds to the virtual IP. If this instance goes offline, another TiProxy instance will automatically bind to the IP, ensuring clients can always connect to an available TiProxy through the virtual IP.
138140

141+
The following is an example configuration:
142+
143+
```yaml
144+
server_configs:
145+
tiproxy:
146+
ha.virtual-ip: "10.0.1.10/24"
147+
ha.interface: "eth0"
148+
```
149+
139150
> **Note:**
140151
>
141152
> - Virtual IP is only supported on Linux operating systems.

tiproxy/tiproxy-deployment-topology.md

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ summary: Learn the deployment topology of TiProxy based on the minimal TiDB topo
77

88
This document describes the deployment topology of [TiProxy](/tiproxy/tiproxy-overview.md) based on the minimal TiDB topology.
99

10+
For other deployment methods, refer to the following documents:
11+
12+
- To deploy TiProxy using TiDB Operator, see the [TiDB Operator](https://docs.pingcap.com/zh/tidb-in-kubernetes/stable/deploy-tiproxy) documentation.
13+
- To quickly deploy TiProxy locally using TiUP, see [Deploy TiProxy](/tiup/tiup-playground.md#deploy-tiproxy).
14+
- To deploy TiProxy using TiUP, see [Installation and usage](/tiproxy/tiproxy-overview.md#installation-and-usage).
15+
1016
TiProxy is a L7 proxy server for TiDB, which can balance connections and migrate sessions when possible.
1117

1218
## Topology information

tiproxy/tiproxy-overview.md

+7-8
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ It is recommended that you use TiProxy for the scenarios that TiProxy is suitabl
6161

6262
## Installation and usage
6363

64-
This section describes how to deploy and change TiProxy using TiUP. For how to deploy TiProxy using TiDB Operator in Kubernetes, see [TiDB Operator documentation](https://docs.pingcap.com/tidb-in-kubernetes/stable/deploy-tiproxy).
64+
This section describes how to deploy and change TiProxy using TiUP.
65+
66+
For other deployment methods, refer to the following documents:
67+
68+
- To deploy TiProxy using TiDB Operator, see the [TiDB Operator](https://docs.pingcap.com/zh/tidb-in-kubernetes/stable/deploy-tiproxy) documentation.
69+
- To quickly deploy TiProxy locally using TiUP, see [Deploy TiProxy](/tiup/tiup-playground.md#deploy-tiproxy).
6570

6671
### Deploy TiProxy
6772

@@ -83,9 +88,6 @@ This section describes how to deploy and change TiProxy using TiUP. For how to d
8388
tidb:
8489
security.session-token-signing-cert: "/var/sess/cert.pem"
8590
security.session-token-signing-key: "/var/sess/key.pem"
86-
security.ssl-ca: "/var/ssl/ca.pem"
87-
security.ssl-cert: "/var/ssl/cert.pem"
88-
security.ssl-key: "/var/ssl/key.pem"
8991
graceful-wait-before-shutdown: 15
9092
```
9193
@@ -100,7 +102,7 @@ This section describes how to deploy and change TiProxy using TiUP. For how to d
100102

101103
It is recommended to specify the version number of TiProxy in the topology configuration so that TiProxy will not be upgraded when you upgrade the TiDB cluster through [`tiup cluster upgrade`](/tiup/tiup-component-cluster-upgrade.md). Otherwise, the client connection might be disconnected during TiProxy upgrade.
102104

103-
To configure TiProxy configuration items, see [TiProxy configuration](/tiproxy/tiproxy-configuration.md).
105+
To configure TiProxy configuration items, see [TiProxy configuration](/tiproxy/tiproxy-configuration.md). For more configurations of TiUP deployment topology, see [tiproxy-servers configurations](/tiup/tiup-cluster-topology-reference.md#tiproxy_servers).
104106

105107
A configuration example is as follows:
106108

@@ -109,9 +111,6 @@ This section describes how to deploy and change TiProxy using TiUP. For how to d
109111
tiproxy: "v1.2.0"
110112
server_configs:
111113
tiproxy:
112-
security.server-tls.ca: "/var/ssl/ca.pem"
113-
security.server-tls.cert: "/var/ssl/cert.pem"
114-
security.server-tls.key: "/var/ssl/key.pem"
115114
ha.virtual-ip: "10.0.1.10/24"
116115
ha.interface: "eth0"
117116
```

tiup/tiup-cluster-topology-reference.md

+12
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,8 @@ tiflash_servers:
435435

436436
- `port`: The listening port of the TiProxy SQL services. The default value is `6000`.
437437

438+
- `status_port`: The listening port of the TiProxy status service. It is used to view the status of the TiProxy services from the external via HTTP requests. The default value is `3080`.
439+
438440
- `deploy_dir`: Specifies the deployment directory. If it is not specified or specified as a relative directory, the directory is generated based on the `deploy_dir` directory configured in `global`.
439441

440442
- `data_dir`: Specifies the data directory. If it is not specified or specified as a relative directory, the directory is generated based on the `data_dir` directory configured in `global`.
@@ -461,9 +463,19 @@ A `tiproxy_servers` configuration example is as follows:
461463
```yaml
462464
tiproxy_servers:
463465
- host: 10.0.1.21
466+
port: 6000
467+
status_port: 3080
468+
config:
469+
labels: { zone: "zone1" }
464470
- host: 10.0.1.22
471+
port: 6000
472+
status_port: 3080
473+
config:
474+
labels: { zone: "zone2" }
465475
```
466476

477+
For more configuration examples, see [TiProxy Deployment Topology](/tiproxy/tiproxy-deployment-topology.md).
478+
467479
### `kvcdc_servers`
468480

469481
`kvcdc_servers` specifies the machines to which the [TiKV-CDC](https://tikv.org/docs/7.1/concepts/explore-tikv-features/cdc/cdc/) services are deployed. It also specifies the service configuration on each machine. `kvcdc_servers` is an array. Each array element contains the following fields:

0 commit comments

Comments
 (0)