mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
feat(etcd): create unique directory on no-flag case
Tell etcd to store the log and configuration into directory in the pattern of `${machineName}.etcd` if no directory is specified.
This commit is contained in:
parent
5abbaf59e3
commit
eecd9f7e35
16
etcd.go
16
etcd.go
@ -47,11 +47,6 @@ func main() {
|
|||||||
log.Verbose = true
|
log.Verbose = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create data directory if it doesn't already exist.
|
|
||||||
if err := os.MkdirAll(config.DataDir, 0744); err != nil {
|
|
||||||
log.Fatalf("Unable to create path: %s", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load info object.
|
// Load info object.
|
||||||
info, err := config.Info()
|
info, err := config.Info()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -66,6 +61,17 @@ func main() {
|
|||||||
info.Name = host
|
info.Name = host
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Setup a default directory based on the machine name
|
||||||
|
if config.DataDir == "" {
|
||||||
|
config.DataDir = info.Name + ".etcd"
|
||||||
|
log.Warnf("Using the directory %s as the etcd configuration directory because a directory was not specified. ", config.DataDir)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create data directory if it doesn't already exist.
|
||||||
|
if err := os.MkdirAll(config.DataDir, 0744); err != nil {
|
||||||
|
log.Fatalf("Unable to create path: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Retrieve TLS configuration.
|
// Retrieve TLS configuration.
|
||||||
tlsConfig, err := info.EtcdTLS.Config()
|
tlsConfig, err := info.EtcdTLS.Config()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -57,7 +57,6 @@ func NewConfig() *Config {
|
|||||||
c.SystemPath = DefaultSystemConfigPath
|
c.SystemPath = DefaultSystemConfigPath
|
||||||
c.AdvertisedUrl = "127.0.0.1:4001"
|
c.AdvertisedUrl = "127.0.0.1:4001"
|
||||||
c.AdvertisedUrl = "127.0.0.1:4001"
|
c.AdvertisedUrl = "127.0.0.1:4001"
|
||||||
c.DataDir = "."
|
|
||||||
c.MaxClusterSize = 9
|
c.MaxClusterSize = 9
|
||||||
c.MaxResultBuffer = 1024
|
c.MaxResultBuffer = 1024
|
||||||
c.MaxRetryAttempts = 3
|
c.MaxRetryAttempts = 3
|
||||||
|
Loading…
x
Reference in New Issue
Block a user