Browse Source

main: use node name as default dir
We use nodeID as the default dir previously. It works fine before we do dynamic nodeID
generation (introducing time). After the change the dynamic nodeID will change every
time we restart the etcd process. If the user does not provide the data dir, the default
dir will change every time. It is not the desired behavior.

In this commit, we change the default data dir to node name. If the user changes the node
name and does provide the data dir, etcd still cannot recover from previous state. But it
is much better than using nodeID. And it is actually a doucmentation issue.

Conflicts:
main.go

Xiang Li 11 years ago
parent
commit
efba919a93
1 changed files with 1 additions and 1 deletions
  1. 1 1
      main.go

+ 1 - 1
main.go

@@ -134,7 +134,7 @@ func startEtcd() {
 	}
 
 	if *dir == "" {
-		*dir = fmt.Sprintf("%v_etcd_data", self.ID)
+		*dir = fmt.Sprintf("%v_etcd_data", self.Name)
 		log.Printf("etcd: no data-dir provided, using default data-dir ./%s", *dir)
 	}
 	if err := os.MkdirAll(*dir, privateDirMode); err != nil {