mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
docs and cluster ID change based on name
This commit is contained in:
parent
ad0b7b7dbb
commit
1347e3952f
@ -167,3 +167,9 @@ Etcd can also do internal server-to-server communication using SSL client certs.
|
||||
To do this just change the `-*-file` flags to `-peer-*-file`.
|
||||
|
||||
If you are using SSL for server-to-server communication, you must use it on all instances of etcd.
|
||||
|
||||
### Bootstrapping a new cluster by name
|
||||
|
||||
An etcd server is uniquely defined by the peer addresses it listens to. Suppose, however, that you wish to start over, while maintaining the data from the previous cluster -- that is, to pretend that this machine has never joined a cluster before.
|
||||
|
||||
You can use `--initial-cluster-name` to generate a new unique ID for each node, as a shared token that every node understands. Nodes also take this into account for bootstrapping the new cluster ID, so it also provides a way for a machine to listen on the same interfaces, disconnect from one cluster, and join a different cluster.
|
||||
|
@ -106,7 +106,11 @@ func (c *Cluster) GenID(salt []byte) {
|
||||
for i, id := range mIDs {
|
||||
binary.BigEndian.PutUint64(b[8*i:], id)
|
||||
}
|
||||
hash := sha1.Sum(append(b, salt...))
|
||||
if len(c.name) > 0 {
|
||||
b = append(b, []byte(c.name)...)
|
||||
}
|
||||
b = append(b, salt...)
|
||||
hash := sha1.Sum(b)
|
||||
c.id = binary.BigEndian.Uint64(hash[:8])
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user