Skip to content

Commit

Permalink
tiproxy: improve deployment instructions for deploying TiProxy (#19904)…
Browse files Browse the repository at this point in the history
… (#19910)
  • Loading branch information
ti-chi-bot authored Jan 7, 2025
1 parent e7c5fe0 commit 68fb8f7
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 11 deletions.
15 changes: 15 additions & 0 deletions config-templates/simple-tiproxy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@ global:
component_versions:
tiproxy: "v1.2.0"
server_configs:
tidb:
graceful-wait-before-shutdown: 15
tiproxy:
ha.virtual-ip: "10.0.1.10/24"
ha.interface: "eth0"
graceful-wait-before-shutdown: 15

pd_servers:
- host: 10.0.1.1
Expand All @@ -29,7 +32,19 @@ tikv_servers:

tiproxy_servers:
- host: 10.0.1.11
deploy_dir: "/tiproxy-deploy"
data_dir: "/tiproxy-data"
port: 6000
status_port: 3080
config:
labels: { zone: "east" }
- host: 10.0.1.12
deploy_dir: "/tiproxy-deploy"
data_dir: "/tiproxy-data"
port: 6000
status_port: 3080
config:
labels: { zone: "west" }

monitoring_servers:
- host: 10.0.1.13
Expand Down
17 changes: 14 additions & 3 deletions tiproxy/tiproxy-configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ summary: Learn how to configure TiProxy.

# TiProxy Configuration File

This document introduces the configuration parameters related to the deployment and use of TiProxy. The following is an example configuration:
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).

The following is an example configuration:

```toml
[proxy]
Expand Down Expand Up @@ -43,13 +45,13 @@ Configuration for SQL port.

+ Default value: `0.0.0.0:6000`
+ Support hot-reload: no
+ SQL gateway address. The format is `<ip>:<port>`.
+ 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.

#### `advertise-addr`

+ Default value: `""`
+ Support hot-reload: no
+ 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.
+ 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.

#### `graceful-wait-before-shutdown`

Expand Down Expand Up @@ -136,6 +138,15 @@ High availability configurations for TiProxy.
+ Support hot-reload: no
+ 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.

The following is an example configuration:

```yaml
server_configs:
tiproxy:
ha.virtual-ip: "10.0.1.10/24"
ha.interface: "eth0"
```
> **Note:**
>
> - Virtual IP is only supported on Linux operating systems.
Expand Down
6 changes: 6 additions & 0 deletions tiproxy/tiproxy-deployment-topology.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ summary: Learn the deployment topology of TiProxy based on the minimal TiDB topo

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

For other deployment methods, refer to the following documents:

- To deploy TiProxy using TiDB Operator, see the [TiDB Operator](https://docs.pingcap.com/zh/tidb-in-kubernetes/stable/deploy-tiproxy) documentation.
- To quickly deploy TiProxy locally using TiUP, see [Deploy TiProxy](/tiup/tiup-playground.md#deploy-tiproxy).
- To deploy TiProxy using TiUP, see [Installation and usage](/tiproxy/tiproxy-overview.md#installation-and-usage).

TiProxy is a L7 proxy server for TiDB, which can balance connections and migrate sessions when possible.

## Topology information
Expand Down
15 changes: 7 additions & 8 deletions tiproxy/tiproxy-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ It is recommended that you use TiProxy for the scenarios that TiProxy is suitabl

## Installation and usage

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).
This section describes how to deploy and change TiProxy using TiUP.

For other deployment methods, refer to the following documents:

- To deploy TiProxy using TiDB Operator, see the [TiDB Operator](https://docs.pingcap.com/zh/tidb-in-kubernetes/stable/deploy-tiproxy) documentation.
- To quickly deploy TiProxy locally using TiUP, see [Deploy TiProxy](/tiup/tiup-playground.md#deploy-tiproxy).

### Deploy TiProxy

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

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.

To configure TiProxy configuration items, see [TiProxy configuration](/tiproxy/tiproxy-configuration.md).
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).

A configuration example is as follows:

Expand All @@ -109,9 +111,6 @@ This section describes how to deploy and change TiProxy using TiUP. For how to d
tiproxy: "v1.2.0"
server_configs:
tiproxy:
security.server-tls.ca: "/var/ssl/ca.pem"
security.server-tls.cert: "/var/ssl/cert.pem"
security.server-tls.key: "/var/ssl/key.pem"
ha.virtual-ip: "10.0.1.10/24"
ha.interface: "eth0"
```
Expand Down
12 changes: 12 additions & 0 deletions tiup/tiup-cluster-topology-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,8 @@ tiflash_servers:

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

- `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`.

- `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`.

- `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`.
Expand All @@ -461,9 +463,19 @@ A `tiproxy_servers` configuration example is as follows:
```yaml
tiproxy_servers:
- host: 10.0.1.21
port: 6000
status_port: 3080
config:
labels: { zone: "zone1" }
- host: 10.0.1.22
port: 6000
status_port: 3080
config:
labels: { zone: "zone2" }
```

For more configuration examples, see [TiProxy Deployment Topology](/tiproxy/tiproxy-deployment-topology.md).

### `kvcdc_servers`

`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:
Expand Down

0 comments on commit 68fb8f7

Please sign in to comment.