Skip to content

Commit

Permalink
Merge branch 'master' into fix_port_conflict_comp_name
Browse files Browse the repository at this point in the history
  • Loading branch information
lucklove authored Dec 8, 2020
2 parents 9fd504c + 3bf3ba8 commit 5319936
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
11 changes: 11 additions & 0 deletions components/playground/instance/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package instance
import (
"context"
"fmt"
"net"

pkgver "github.com/pingcap/tiup/pkg/repository/version"
)
Expand Down Expand Up @@ -74,6 +75,16 @@ func CompVersion(comp string, version pkgver.Version) string {

func advertiseHost(listen string) string {
if listen == "0.0.0.0" {
addrs, err := net.InterfaceAddrs()
if err != nil || len(addrs) == 0 {
return "localhost"
}

for _, addr := range addrs {
if ip, ok := addr.(*net.IPNet); ok && !ip.IP.IsLoopback() && ip.IP.To4() != nil {
return ip.IP.To4().String()
}
}
return "localhost"
}

Expand Down
7 changes: 5 additions & 2 deletions pkg/cluster/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -1869,8 +1869,11 @@ func (m *Manager) confirmTopology(clusterName, version string, topo spec.Topolog

if spec, ok := topo.(*spec.Specification); ok {
if len(spec.TiSparkMasters) > 0 || len(spec.TiSparkWorkers) > 0 {
log.Warnf("There are TiSpark nodes defined in the topology, please note that you'll need to manually install Java Runtime Environment (JRE) 8 on the host, other wise the TiSpark nodes will fail to start.")
log.Warnf("You may read the OpenJDK doc for a reference: https://openjdk.java.net/install/")
cyan := color.New(color.FgCyan, color.Bold)
msg := cyan.Sprint(`There are TiSpark nodes defined in the topology, please note that you'll need to manually install Java Runtime Environment (JRE) 8 on the host, otherwise the TiSpark nodes will fail to start.
You may read the OpenJDK doc for a reference: https://openjdk.java.net/install/
`)
log.Warnf(msg)
}
}

Expand Down

0 comments on commit 5319936

Please sign in to comment.