mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
change Config.Nodes to Config.Hosts
This commit is contained in:
parent
b4a69be751
commit
4c8e46e17f
4 changed files with 14 additions and 11 deletions
|
|
@ -76,8 +76,8 @@ on the configured port.`,
|
|||
flags.StringVarP(&Server.Config.DataDir, "data-dir", "d", "~/.pilosa", "Directory to store pilosa data files.")
|
||||
flags.StringVarP(&Server.Config.Host, "bind", "b", ":10101", "Default URI on which pilosa should listen.")
|
||||
flags.IntVarP(&Server.Config.Cluster.ReplicaN, "cluster.replicas", "", 1, "Number of hosts each piece of data should be stored on.")
|
||||
flags.StringSliceVarP(&Server.Config.Cluster.Nodes, "cluster.hosts", "", []string{}, "Comma separated list of hosts in cluster.")
|
||||
flags.StringSliceVarP(&Server.Config.Cluster.InternalNodes, "cluster.internal-hosts", "", []string{}, "Comma separated list of hosts in cluster used for internal communication.")
|
||||
flags.StringSliceVarP(&Server.Config.Cluster.Hosts, "cluster.hosts", "", []string{}, "Comma separated list of hosts in cluster.")
|
||||
flags.StringSliceVarP(&Server.Config.Cluster.InternalHosts, "cluster.internal-hosts", "", []string{}, "Comma separated list of hosts in cluster used for internal communication.")
|
||||
flags.DurationVarP((*time.Duration)(&Server.Config.Cluster.PollingInterval), "cluster.poll-interval", "", time.Minute, "Polling interval for cluster.") // TODO what actually is this?
|
||||
flags.StringVarP(&Server.Config.Plugins.Path, "plugins.path", "", "", "Path to plugin directory.")
|
||||
flags.StringVar(&Server.Config.LogPath, "log-path", "", "Log path")
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ bind = "localhost:0"
|
|||
v.Check(cmd.Server.Config.DataDir, actualDataDir)
|
||||
v.Check(cmd.Server.Config.Host, "localhost:0")
|
||||
v.Check(cmd.Server.Config.Cluster.ReplicaN, 2)
|
||||
v.Check(cmd.Server.Config.Cluster.Nodes, []string{"example.com:10101", "example.com:10110"})
|
||||
v.Check(cmd.Server.Config.Cluster.Hosts, []string{"example.com:10101", "example.com:10110"})
|
||||
v.Check(cmd.Server.Config.Cluster.PollingInterval, pilosa.Duration(time.Second*182))
|
||||
return v.Error()
|
||||
},
|
||||
|
|
@ -68,7 +68,7 @@ data-dir = "` + actualDataDir + `"
|
|||
`,
|
||||
validation: func() error {
|
||||
v := validator{}
|
||||
v.Check(cmd.Server.Config.Cluster.Nodes, []string{"example.com:1110", "example.com:1111"})
|
||||
v.Check(cmd.Server.Config.Cluster.Hosts, []string{"example.com:1110", "example.com:1111"})
|
||||
v.Check(cmd.Server.Config.Plugins.Path, "/var/sloth")
|
||||
v.Check(cmd.Server.Config.AntiEntropy.Interval, pilosa.Duration(time.Minute*9))
|
||||
return v.Error()
|
||||
|
|
@ -94,7 +94,7 @@ data-dir = "` + actualDataDir + `"
|
|||
`,
|
||||
validation: func() error {
|
||||
v := validator{}
|
||||
v.Check(cmd.Server.Config.Cluster.Nodes, []string{"localhost:19444"})
|
||||
v.Check(cmd.Server.Config.Cluster.Hosts, []string{"localhost:19444"})
|
||||
v.Check(cmd.Server.Config.Cluster.PollingInterval, pilosa.Duration(time.Minute*2))
|
||||
v.Check(cmd.Server.Config.AntiEntropy.Interval, pilosa.Duration(time.Minute*11))
|
||||
v.Check(cmd.Server.CPUProfile, profFile.Name())
|
||||
|
|
|
|||
|
|
@ -18,8 +18,8 @@ type Config struct {
|
|||
Cluster struct {
|
||||
ReplicaN int `toml:"replicas"`
|
||||
Type string `toml:"type"`
|
||||
Nodes []string `toml:"hosts"`
|
||||
InternalNodes []string `toml:"internal-hosts"`
|
||||
Hosts []string `toml:"hosts"`
|
||||
InternalHosts []string `toml:"internal-hosts"`
|
||||
PollingInterval Duration `toml:"polling-interval"`
|
||||
InternalPort string `toml:"internal-port"`
|
||||
GossipSeed string `toml:"gossip-seed"`
|
||||
|
|
@ -44,8 +44,8 @@ func NewConfig() *Config {
|
|||
c.Cluster.ReplicaN = DefaultReplicaN
|
||||
c.Cluster.Type = DefaultClusterType
|
||||
c.Cluster.PollingInterval = Duration(DefaultPollingInterval)
|
||||
c.Cluster.Nodes = []string{}
|
||||
c.Cluster.InternalNodes = []string{}
|
||||
c.Cluster.Hosts = []string{}
|
||||
c.Cluster.InternalHosts = []string{}
|
||||
c.AntiEntropy.Interval = Duration(DefaultAntiEntropyInterval)
|
||||
return c
|
||||
}
|
||||
|
|
|
|||
|
|
@ -93,10 +93,13 @@ func (m *Command) SetupServer() error {
|
|||
cluster := pilosa.NewCluster()
|
||||
cluster.ReplicaN = m.Config.Cluster.ReplicaN
|
||||
|
||||
for _, hostport := range m.Config.Cluster.Nodes {
|
||||
for _, hostport := range m.Config.Cluster.Hosts {
|
||||
cluster.Nodes = append(cluster.Nodes, &pilosa.Node{Host: hostport})
|
||||
}
|
||||
for i, internalhostport := range m.Config.Cluster.InternalNodes {
|
||||
// TODO: if InternalHosts is not provided then pilosa.Node.InternalHost is empty.
|
||||
// This will throw an error when trying to Broadcast messages over HTTP.
|
||||
// One option may be to fall back to using host from hostport + config.InternalPort.
|
||||
for i, internalhostport := range m.Config.Cluster.InternalHosts {
|
||||
cluster.Nodes[i].InternalHost = internalhostport
|
||||
}
|
||||
m.Server.Cluster = cluster
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue