mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Revert "etcd: add -internal-dir flag"
This reverts commit 03a99cf9b1b569f31f336aaf3d04266569c55aa9.
This commit is contained in:
parent
262d769168
commit
55263bc6b5
@ -44,7 +44,6 @@ The full documentation is contained in the [API docs](https://github.com/coreos/
|
|||||||
* `-cors` - A comma separated white list of origins for cross-origin resource sharing.
|
* `-cors` - A comma separated white list of origins for cross-origin resource sharing.
|
||||||
* `-cpuprofile` - The path to a file to output CPU profile data. Enables CPU profiling when present.
|
* `-cpuprofile` - The path to a file to output CPU profile data. Enables CPU profiling when present.
|
||||||
* `-data-dir` - The directory to store log and snapshot. Defaults to the current working directory.
|
* `-data-dir` - The directory to store log and snapshot. Defaults to the current working directory.
|
||||||
* `-internal-binary-dir` - The path to the etcd internal binary directory. Defaults to `/usr/libexec/etcd/internal_versions/`.
|
|
||||||
* `-max-result-buffer` - The max size of result buffer. Defaults to `1024`.
|
* `-max-result-buffer` - The max size of result buffer. Defaults to `1024`.
|
||||||
* `-max-retry-attempts` - The max retry attempts when trying to join a cluster. Defaults to `3`.
|
* `-max-retry-attempts` - The max retry attempts when trying to join a cluster. Defaults to `3`.
|
||||||
* `-peer-addr` - The advertised public hostname:port for server communication. Defaults to `127.0.0.1:7001`.
|
* `-peer-addr` - The advertised public hostname:port for server communication. Defaults to `127.0.0.1:7001`.
|
||||||
@ -116,7 +115,6 @@ sync_interval = 5.0
|
|||||||
* `ETCD_CLUSTER_HTTP_READ_TIMEOUT`
|
* `ETCD_CLUSTER_HTTP_READ_TIMEOUT`
|
||||||
* `ETCD_CLUSTER_HTTP_WRITE_TIMEOUT`
|
* `ETCD_CLUSTER_HTTP_WRITE_TIMEOUT`
|
||||||
* `ETCD_KEY_FILE`
|
* `ETCD_KEY_FILE`
|
||||||
* `ETCD_INTERNAL_BINARY_DIR`
|
|
||||||
* `ETCD_PEERS`
|
* `ETCD_PEERS`
|
||||||
* `ETCD_PEERS_FILE`
|
* `ETCD_PEERS_FILE`
|
||||||
* `ETCD_MAX_CLUSTER_SIZE`
|
* `ETCD_MAX_CLUSTER_SIZE`
|
||||||
|
@ -24,9 +24,6 @@ import (
|
|||||||
// The default location for the etcd configuration file.
|
// The default location for the etcd configuration file.
|
||||||
const DefaultSystemConfigPath = "/etc/etcd/etcd.conf"
|
const DefaultSystemConfigPath = "/etc/etcd/etcd.conf"
|
||||||
|
|
||||||
// The default location of the etcd internal binary directory.
|
|
||||||
const DefaultInternalBinaryDir = "/usr/libexec/etcd/internal_versions/"
|
|
||||||
|
|
||||||
// A lookup of deprecated flags to their new flag name.
|
// A lookup of deprecated flags to their new flag name.
|
||||||
var newFlagNameLookup = map[string]string{
|
var newFlagNameLookup = map[string]string{
|
||||||
"C": "peers",
|
"C": "peers",
|
||||||
@ -67,7 +64,6 @@ type Config struct {
|
|||||||
KeyFile string `toml:"key_file" env:"ETCD_KEY_FILE"`
|
KeyFile string `toml:"key_file" env:"ETCD_KEY_FILE"`
|
||||||
HTTPReadTimeout float64 `toml:"http_read_timeout" env:"ETCD_HTTP_READ_TIMEOUT"`
|
HTTPReadTimeout float64 `toml:"http_read_timeout" env:"ETCD_HTTP_READ_TIMEOUT"`
|
||||||
HTTPWriteTimeout float64 `toml:"http_write_timeout" env:"ETCD_HTTP_WRITE_TIMEOUT"`
|
HTTPWriteTimeout float64 `toml:"http_write_timeout" env:"ETCD_HTTP_WRITE_TIMEOUT"`
|
||||||
InternalBinaryDir string `toml:"internal_binary_dir" env:"ETCD_INTERNAL_BINARY_DIR"`
|
|
||||||
Peers []string `toml:"peers" env:"ETCD_PEERS"`
|
Peers []string `toml:"peers" env:"ETCD_PEERS"`
|
||||||
PeersFile string `toml:"peers_file" env:"ETCD_PEERS_FILE"`
|
PeersFile string `toml:"peers_file" env:"ETCD_PEERS_FILE"`
|
||||||
MaxResultBuffer int `toml:"max_result_buffer" env:"ETCD_MAX_RESULT_BUFFER"`
|
MaxResultBuffer int `toml:"max_result_buffer" env:"ETCD_MAX_RESULT_BUFFER"`
|
||||||
@ -120,7 +116,6 @@ func New() *Config {
|
|||||||
c.Cluster.ActiveSize = server.DefaultActiveSize
|
c.Cluster.ActiveSize = server.DefaultActiveSize
|
||||||
c.Cluster.RemoveDelay = server.DefaultRemoveDelay
|
c.Cluster.RemoveDelay = server.DefaultRemoveDelay
|
||||||
c.Cluster.SyncInterval = server.DefaultSyncInterval
|
c.Cluster.SyncInterval = server.DefaultSyncInterval
|
||||||
c.InternalBinaryDir = DefaultInternalBinaryDir
|
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -268,7 +263,6 @@ func (c *Config) LoadFlags(arguments []string) error {
|
|||||||
f.Float64Var(&c.HTTPWriteTimeout, "http-write-timeout", c.HTTPReadTimeout, "")
|
f.Float64Var(&c.HTTPWriteTimeout, "http-write-timeout", c.HTTPReadTimeout, "")
|
||||||
|
|
||||||
f.StringVar(&c.DataDir, "data-dir", c.DataDir, "")
|
f.StringVar(&c.DataDir, "data-dir", c.DataDir, "")
|
||||||
f.StringVar(&c.InternalBinaryDir, "internal-binary-dir", c.InternalBinaryDir, "")
|
|
||||||
f.IntVar(&c.MaxResultBuffer, "max-result-buffer", c.MaxResultBuffer, "")
|
f.IntVar(&c.MaxResultBuffer, "max-result-buffer", c.MaxResultBuffer, "")
|
||||||
f.IntVar(&c.MaxRetryAttempts, "max-retry-attempts", c.MaxRetryAttempts, "")
|
f.IntVar(&c.MaxRetryAttempts, "max-retry-attempts", c.MaxRetryAttempts, "")
|
||||||
f.Float64Var(&c.RetryInterval, "retry-interval", c.RetryInterval, "")
|
f.Float64Var(&c.RetryInterval, "retry-interval", c.RetryInterval, "")
|
||||||
|
@ -19,7 +19,6 @@ func TestConfigTOML(t *testing.T) {
|
|||||||
cpu_profile_file = "XXX"
|
cpu_profile_file = "XXX"
|
||||||
data_dir = "/tmp/data"
|
data_dir = "/tmp/data"
|
||||||
discovery = "http://example.com/foobar"
|
discovery = "http://example.com/foobar"
|
||||||
internal_binary_dir = "/tmp/etcd/internal_versions"
|
|
||||||
key_file = "/tmp/file.key"
|
key_file = "/tmp/file.key"
|
||||||
bind_addr = "127.0.0.1:4003"
|
bind_addr = "127.0.0.1:4003"
|
||||||
peers = ["coreos.com:4001", "coreos.com:4002"]
|
peers = ["coreos.com:4001", "coreos.com:4002"]
|
||||||
@ -55,7 +54,6 @@ func TestConfigTOML(t *testing.T) {
|
|||||||
assert.Equal(t, c.CorsOrigins, []string{"*"}, "")
|
assert.Equal(t, c.CorsOrigins, []string{"*"}, "")
|
||||||
assert.Equal(t, c.DataDir, "/tmp/data", "")
|
assert.Equal(t, c.DataDir, "/tmp/data", "")
|
||||||
assert.Equal(t, c.Discovery, "http://example.com/foobar", "")
|
assert.Equal(t, c.Discovery, "http://example.com/foobar", "")
|
||||||
assert.Equal(t, c.InternalBinaryDir, "/tmp/etcd/internal_versions", "")
|
|
||||||
assert.Equal(t, c.HTTPReadTimeout, 2.34, "")
|
assert.Equal(t, c.HTTPReadTimeout, 2.34, "")
|
||||||
assert.Equal(t, c.HTTPWriteTimeout, 1.23, "")
|
assert.Equal(t, c.HTTPWriteTimeout, 1.23, "")
|
||||||
assert.Equal(t, c.KeyFile, "/tmp/file.key", "")
|
assert.Equal(t, c.KeyFile, "/tmp/file.key", "")
|
||||||
@ -88,7 +86,6 @@ func TestConfigEnv(t *testing.T) {
|
|||||||
os.Setenv("ETCD_DISCOVERY", "http://example.com/foobar")
|
os.Setenv("ETCD_DISCOVERY", "http://example.com/foobar")
|
||||||
os.Setenv("ETCD_HTTP_READ_TIMEOUT", "2.34")
|
os.Setenv("ETCD_HTTP_READ_TIMEOUT", "2.34")
|
||||||
os.Setenv("ETCD_HTTP_WRITE_TIMEOUT", "1.23")
|
os.Setenv("ETCD_HTTP_WRITE_TIMEOUT", "1.23")
|
||||||
os.Setenv("ETCD_INTERNAL_BINARY_DIR", "/tmp/etcd/internal_versions")
|
|
||||||
os.Setenv("ETCD_KEY_FILE", "/tmp/file.key")
|
os.Setenv("ETCD_KEY_FILE", "/tmp/file.key")
|
||||||
os.Setenv("ETCD_BIND_ADDR", "127.0.0.1:4003")
|
os.Setenv("ETCD_BIND_ADDR", "127.0.0.1:4003")
|
||||||
os.Setenv("ETCD_PEERS", "coreos.com:4001,coreos.com:4002")
|
os.Setenv("ETCD_PEERS", "coreos.com:4001,coreos.com:4002")
|
||||||
@ -118,7 +115,6 @@ func TestConfigEnv(t *testing.T) {
|
|||||||
assert.Equal(t, c.Discovery, "http://example.com/foobar", "")
|
assert.Equal(t, c.Discovery, "http://example.com/foobar", "")
|
||||||
assert.Equal(t, c.HTTPReadTimeout, 2.34, "")
|
assert.Equal(t, c.HTTPReadTimeout, 2.34, "")
|
||||||
assert.Equal(t, c.HTTPWriteTimeout, 1.23, "")
|
assert.Equal(t, c.HTTPWriteTimeout, 1.23, "")
|
||||||
assert.Equal(t, c.InternalBinaryDir, "/tmp/etcd/internal_versions", "")
|
|
||||||
assert.Equal(t, c.KeyFile, "/tmp/file.key", "")
|
assert.Equal(t, c.KeyFile, "/tmp/file.key", "")
|
||||||
assert.Equal(t, c.BindAddr, "127.0.0.1:4003", "")
|
assert.Equal(t, c.BindAddr, "127.0.0.1:4003", "")
|
||||||
assert.Equal(t, c.Peers, []string{"coreos.com:4001", "coreos.com:4002"}, "")
|
assert.Equal(t, c.Peers, []string{"coreos.com:4001", "coreos.com:4002"}, "")
|
||||||
|
@ -309,7 +309,7 @@ func (e *Etcd) runServer() {
|
|||||||
for {
|
for {
|
||||||
if e.mode == PeerMode {
|
if e.mode == PeerMode {
|
||||||
log.Infof("%v starting in peer mode", e.Config.Name)
|
log.Infof("%v starting in peer mode", e.Config.Name)
|
||||||
go registerAvailableInternalVersions(e.Config.InternalBinaryDir, e.Config.Name, e.Config.Addr, e.Config.EtcdTLSInfo())
|
go registerAvailableInternalVersions(e.Config.Name, e.Config.Addr, e.Config.EtcdTLSInfo())
|
||||||
// Starting peer server should be followed close by listening on its port
|
// Starting peer server should be followed close by listening on its port
|
||||||
// If not, it may leave many requests unaccepted, or cannot receive heartbeat from the cluster.
|
// If not, it may leave many requests unaccepted, or cannot receive heartbeat from the cluster.
|
||||||
// One severe problem caused if failing receiving heartbeats is when the second node joins one-node cluster,
|
// One severe problem caused if failing receiving heartbeats is when the second node joins one-node cluster,
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package etcd
|
package etcd
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/coreos/etcd/log"
|
"github.com/coreos/etcd/log"
|
||||||
@ -9,7 +11,9 @@ import (
|
|||||||
"github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
|
"github.com/coreos/etcd/third_party/github.com/coreos/go-etcd/etcd"
|
||||||
)
|
)
|
||||||
|
|
||||||
func registerAvailableInternalVersions(internalBinaryDir, name, addr string, tls *server.TLSInfo) {
|
var defaultEtcdBinaryDir = "/usr/libexec/etcd/internal_versions/"
|
||||||
|
|
||||||
|
func registerAvailableInternalVersions(name string, addr string, tls *server.TLSInfo) {
|
||||||
var c *etcd.Client
|
var c *etcd.Client
|
||||||
if tls.Scheme() == "http" {
|
if tls.Scheme() == "http" {
|
||||||
c = etcd.NewClient([]string{addr})
|
c = etcd.NewClient([]string{addr})
|
||||||
@ -21,7 +25,7 @@ func registerAvailableInternalVersions(internalBinaryDir, name, addr string, tls
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vers, err := getInternalVersions(internalBinaryDir)
|
vers, err := getInternalVersions()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Infof("failed to get local etcd versions: %v", err)
|
log.Infof("failed to get local etcd versions: %v", err)
|
||||||
return
|
return
|
||||||
@ -38,8 +42,15 @@ func registerAvailableInternalVersions(internalBinaryDir, name, addr string, tls
|
|||||||
log.Infof("%s: available_internal_versions %s is registered into key space successfully.", name, vers)
|
log.Infof("%s: available_internal_versions %s is registered into key space successfully.", name, vers)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getInternalVersions(internalBinaryDir string) ([]string, error) {
|
func getInternalVersions() ([]string, error) {
|
||||||
dir, err := os.Open(internalBinaryDir)
|
if runtime.GOOS != "linux" {
|
||||||
|
return nil, fmt.Errorf("unmatched os version %v", runtime.GOOS)
|
||||||
|
}
|
||||||
|
etcdBinaryDir := os.Getenv("ETCD_BINARY_DIR")
|
||||||
|
if etcdBinaryDir == "" {
|
||||||
|
etcdBinaryDir = defaultEtcdBinaryDir
|
||||||
|
}
|
||||||
|
dir, err := os.Open(etcdBinaryDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,6 @@ Options:
|
|||||||
-config=<path> Path to configuration file.
|
-config=<path> Path to configuration file.
|
||||||
-name=<name> Name of this node in the etcd cluster.
|
-name=<name> Name of this node in the etcd cluster.
|
||||||
-data-dir=<path> Path to the data directory.
|
-data-dir=<path> Path to the data directory.
|
||||||
-internal-binary-dir=<path> Path to the etcd internal binary directory.
|
|
||||||
-cors=<origins> Comma-separated list of CORS origins.
|
-cors=<origins> Comma-separated list of CORS origins.
|
||||||
-v Enabled verbose logging.
|
-v Enabled verbose logging.
|
||||||
-vv Enabled very verbose logging.
|
-vv Enabled very verbose logging.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user