Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

playground: fix cannot bind 0.0.0.0 #1811

Merged
merged 2 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/playground/instance/tiflash.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ type replicateEnablePlacementRulesConfig struct {

// Addr return the address of tiflash
func (inst *TiFlashInstance) Addr() string {
return fmt.Sprintf("%s:%d", inst.Host, inst.ServicePort)
return fmt.Sprintf("%s:%d", AdvertiseHost(inst.Host), inst.ServicePort)
}

// StatusAddrs implements Instance interface.
Expand Down
3 changes: 2 additions & 1 deletion components/playground/instance/tiflash_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,12 @@ quota = "default"
ip = "::/0"
`

func writeTiFlashConfig(w io.Writer, version utils.Version, tcpPort, httpPort, servicePort, metricsPort int, ip, deployDir, clusterManagerPath string, tidbStatusAddrs, endpoints []string) error {
func writeTiFlashConfig(w io.Writer, version utils.Version, tcpPort, httpPort, servicePort, metricsPort int, host, deployDir, clusterManagerPath string, tidbStatusAddrs, endpoints []string) error {
pdAddrs := strings.Join(endpoints, ",")
dataDir := fmt.Sprintf("%s/data", deployDir)
tmpDir := fmt.Sprintf("%s/tmp", deployDir)
logDir := fmt.Sprintf("%s/log", deployDir)
ip := AdvertiseHost(host)
var conf string
if semver.Compare(version.String(), "v5.4.0") >= 0 || version.IsNightly() {
conf = fmt.Sprintf(tiflashConfig, pdAddrs, httpPort, tcpPort,
Expand Down
3 changes: 2 additions & 1 deletion components/playground/instance/tiflash_proxy_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ data-dir = "%[6]s"
max-open-files = 256
`

func writeTiFlashProxyConfig(w io.Writer, version utils.Version, ip, deployDir string, servicePort, proxyPort, proxyStatusPort int) error {
func writeTiFlashProxyConfig(w io.Writer, version utils.Version, host, deployDir string, servicePort, proxyPort, proxyStatusPort int) error {
// TODO: support multi-dir
dataDir := fmt.Sprintf("%s/flash", deployDir)
logDir := fmt.Sprintf("%s/log", deployDir)
ip := AdvertiseHost(host)
var statusAddr string
if semver.Compare(version.String(), "v4.0.5") >= 0 || version.IsNightly() {
statusAddr = fmt.Sprintf(`status-addr = "0.0.0.0:%[2]d"
Expand Down
3 changes: 0 additions & 3 deletions components/playground/playground.go
Original file line number Diff line number Diff line change
Expand Up @@ -636,9 +636,6 @@ func (p *Playground) addInstance(componentID string, cfg instance.Config) (ins i
host = cfg.Host
}

// use the advertised host instead of 0.0.0.0
host = instance.AdvertiseHost(host)

switch componentID {
case spec.ComponentPD:
inst := instance.NewPDInstance(cfg.BinPath, dir, host, cfg.ConfigPath, id)
Expand Down