Support starting PD with separated IP when using playground
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 466
- Forks
- 338
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 8
Description
Feature Request
Is your feature request related to a problem? Please describe:
Describe the feature you'd like:
Support the following command or something similar:
tiup playground nightly --kv=1 --pd=1 --pd.Host 172.16.4.1 --db=0 --host 172.16.4.2
--pd.Host specifies where PD is located, and --host specifies where TiKV and other binary are located.
Right now, I find we have already had this flag when executing tiup playground --help
tiup is checking updates for component playground ...
A new version of playground is available:
The latest version: v1.11.0
Local installed version: v1.5.6
Update current component: tiup update playground
Update all components: tiup update --all
Starting component `playground`: /data2/ryan/.tiup/components/playground/v1.5.6/tiup-playground --help
Bootstrap a TiDB cluster in your local host, the latest release version will be chosen
if you don't specified a version.
Examples:
$ tiup playground nightly # Start a TiDB nightly version local cluster
$ tiup playground v5.0.1 --db 3 --pd 3 --kv 3 # Start a local cluster with 10 nodes
$ tiup playground nightly --monitor=false # Start a local cluster and disable monitor system
$ tiup playground --pd.config ~/config/pd.toml # Start a local cluster with specified configuration file
$ tiup playground --db.binpath /xx/tidb-server # Start a local cluster with component binary path
$ tiup playground --mode tikv-slim # Start a local tikv only cluster (No TiDB or TiFlash Available)
$ tiup playground --mode tikv-slim --kv 3 --pd 3 # Start a local tikv only cluster with 6 nodes
Usage:
tiup playground [version] [flags]
tiup [command]
Available Commands:
display
help Help about any command
scale-in
scale-out
Flags:
--db int TiDB instance number
--db.Host host Playground TiDB host. If not provided, TiDB will still use host flag as its host
--db.Port int Playground TiDB port. If not provided, TiDB will use 4000 as its port
--db.binpath string TiDB instance binary path
--db.config string TiDB instance configuration file
--db.timeout int TiDB max wait time in seconds for starting, 0 means no limit
--drainer int Drainer instance number
--drainer.binpath string Drainer instance binary path
--drainer.config string Drainer instance configuration file
-h, --help help for tiup
--host string Playground cluster host
--kv int TiKV instance number
--kv.binpath string TiKV instance binary path
--kv.config string TiKV instance configuration file
--mode string TiUP playground mode: 'tidb', 'tikv-slim' (default "tidb")
--monitor Start prometheus and grafana component
--pd int PD instance number
--pd.Host host Playground PD host. If not provided, PD will still use host flag as its host
--pd.binpath string PD instance binary path
--pd.config string PD instance configuration file
--pump int Pump instance number
--pump.binpath string Pump instance binary path
--pump.config string Pump instance configuration file
--ticdc int TiCDC instance number
--ticdc.binpath string TiCDC instance binary path
--ticdc.config string TiCDC instance configuration file
--tiflash int TiFlash instance number
--tiflash.binpath string TiFlash instance binary path
--tiflash.config string TiFlash instance configuration file
--tiflash.timeout int TiFlash max wait time in seconds for starting, 0 means no limit
-v, --version version for tiup
Use "tiup [command] --help" for more information about a command.
From the help message, it could be misleading since it says "Playground PD host". But I did try it, and the following error happens:
panic: can't get a free port
goroutine 1 [running]:
github.com/pingcap/tiup/pkg/utils.MustGetFreePort(...)
github.com/pingcap/tiup/pkg/utils/freeport.go:42
github.com/pingcap/tiup/components/playground/instance.NewPDInstance(0x0, 0x0, 0xc0005cef00, 0x23, 0x7ffedb70f104, 0xb, 0x0, 0x0, 0x0, 0xc000226f98)
github.com/pingcap/tiup/components/playground/instance/pd.go:42 +0x1e5
main.(*Playground).addInstance(0xc000350f00, 0x556dac99e1e6, 0x2, 0x0, 0x0, 0x0, 0x0, 0x1, 0x7ffedb70f104, 0xb, ...)
github.com/pingcap/tiup/components/playground/playground.go:617 +0x3f7
main.(*Playground).bootCluster(0xc000350f00, 0x556dad1c3908, 0xc0004c6940, 0xc000230890, 0x556dad7ead00, 0x0, 0xc000230890)
github.com/pingcap/tiup/components/playground/playground.go:723 +0x86b
main.execute.func2(0xc0004d2a00, 0xc0000fe0c0, 0x1, 0xc, 0x0, 0x0)
github.com/pingcap/tiup/components/playground/main.go:238 +0x4a5
github.com/spf13/cobra.(*Command).execute(0xc0004d2a00, 0xc0001229d0, 0xc, 0xc, 0xc0004d2a00, 0xc0001229d0)
github.com/spf13/cobra@v1.1.3/command.go:852 +0x472
github.com/spf13/cobra.(*Command).ExecuteC(0xc0004d2a00, 0xc000219c70, 0x1, 0x1)
github.com/spf13/cobra@v1.1.3/command.go:960 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
github.com/spf13/cobra@v1.1.3/command.go:897
main.execute(0xc0d2faf54cd85c9d, 0xf6dfe7)
github.com/pingcap/tiup/components/playground/main.go:300 +0x1445
main.main()
github.com/pingcap/tiup/components/playground/main.go:569 +0x58
Why the featue is needed:
It could be very useful when we doing tests and we have already supported integrating some testing tools with the playground. See
https://github.com/tikv/pd/pull/5289
https://github.com/tikv/pd/pull/5688
Describe alternatives you've considered:
Teachability, Documentation, Adoption, Migration Strategy:
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the documented playground command and trace the failure through components/playground/main.go, components/playground/playground.go, and components/playground/instance/pd.go, with free-port handling in pkg/utils/freeport.go. Check how --pd.Host and --host are passed when creating instances. Done means the separated-address command starts without the reported panic and the help text matches the supported behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100