Compare commits
	
		
			34 Commits
		
	
	
		
			v3.3.7
			...
			release-0.
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 654eaba5a1 | |||
| 9fa3bea5a2 | |||
| 2fc8304300 | |||
| 087ba30a90 | |||
| e1df265dc5 | |||
| 8059598332 | |||
| e1e2daa205 | |||
| 399931cec9 | |||
| 49715173cb | |||
| ad4f231b40 | |||
| 55263bc6b5 | |||
| 262d769168 | |||
| 2f6ea0a0e5 | |||
| fc8020b7d6 | |||
| 03a99cf9b1 | |||
| eae1e18500 | |||
| 6666b20d91 | |||
| 2d4592e8c5 | |||
| 12fec1f936 | |||
| d6523fe463 | |||
| c25127a699 | |||
| 9f031e6218 | |||
| e55724e959 | |||
| 29af192e3d | |||
| 2fc79912c2 | |||
| ebb8d781b5 | |||
| 2e30b3c17f | |||
| 9a2d82854e | |||
| b077dcf6c4 | |||
| 2b572cb6e8 | |||
| f36d55f062 | |||
| 9f70568a02 | |||
| 1ca7d1e064 | |||
| 4f1f003d04 | 
@ -34,7 +34,7 @@ The full documentation is contained in the [API docs](https://github.com/coreos/
 | 
				
			|||||||
* `-discovery` - A URL to use for discovering the peer list. (i.e `"https://discovery.etcd.io/your-unique-key"`).
 | 
					* `-discovery` - A URL to use for discovering the peer list. (i.e `"https://discovery.etcd.io/your-unique-key"`).
 | 
				
			||||||
* `-http-read-timeout` - The number of seconds before an HTTP read operation is timed out.
 | 
					* `-http-read-timeout` - The number of seconds before an HTTP read operation is timed out.
 | 
				
			||||||
* `-http-write-timeout` - The number of seconds before an HTTP write operation is timed out.
 | 
					* `-http-write-timeout` - The number of seconds before an HTTP write operation is timed out.
 | 
				
			||||||
* `-bind-addr` - The listening hostname for client communication. Defaults to advertised IP.
 | 
					* `-bind-addr` - The listening hostname for client communication. Defaults to 0.0.0.0 and the advertised port.
 | 
				
			||||||
* `-peers` - A comma separated list of peers in the cluster (i.e `"203.0.113.101:7001,203.0.113.102:7001"`).
 | 
					* `-peers` - A comma separated list of peers in the cluster (i.e `"203.0.113.101:7001,203.0.113.102:7001"`).
 | 
				
			||||||
* `-peers-file` - The file path containing a comma separated list of peers in the cluster.
 | 
					* `-peers-file` - The file path containing a comma separated list of peers in the cluster.
 | 
				
			||||||
* `-ca-file` - The path of the client CAFile. Enables client cert authentication when present.
 | 
					* `-ca-file` - The path of the client CAFile. Enables client cert authentication when present.
 | 
				
			||||||
@ -47,7 +47,7 @@ The full documentation is contained in the [API docs](https://github.com/coreos/
 | 
				
			|||||||
* `-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`.
 | 
				
			||||||
* `-peer-bind-addr` - The listening hostname for server communication. Defaults to advertised IP.
 | 
					* `-peer-bind-addr` - The listening hostname for server communication. Defaults to 0.0.0.0 and the advertised peer port.
 | 
				
			||||||
* `-peer-ca-file` - The path of the CAFile. Enables client/peer cert authentication when present.
 | 
					* `-peer-ca-file` - The path of the CAFile. Enables client/peer cert authentication when present.
 | 
				
			||||||
* `-peer-cert-file` - The cert file of the server.
 | 
					* `-peer-cert-file` - The cert file of the server.
 | 
				
			||||||
* `-peer-key-file` - The key file of the server.
 | 
					* `-peer-key-file` - The key file of the server.
 | 
				
			||||||
 | 
				
			|||||||
@ -1,6 +1,6 @@
 | 
				
			|||||||
# etcd
 | 
					# etcd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
README version 0.4.6
 | 
					README version 0.4.8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A highly-available key value store for shared configuration and service discovery.
 | 
					A highly-available key value store for shared configuration and service discovery.
 | 
				
			||||||
etcd is inspired by [Apache ZooKeeper][zookeeper] and [doozer][doozer], with a focus on being:
 | 
					etcd is inspired by [Apache ZooKeeper][zookeeper] and [doozer][doozer], with a focus on being:
 | 
				
			||||||
 | 
				
			|||||||
@ -86,7 +86,7 @@ type Config struct {
 | 
				
			|||||||
		HeartbeatInterval int    `toml:"heartbeat_interval" env:"ETCD_PEER_HEARTBEAT_INTERVAL"`
 | 
							HeartbeatInterval int    `toml:"heartbeat_interval" env:"ETCD_PEER_HEARTBEAT_INTERVAL"`
 | 
				
			||||||
		ElectionTimeout   int    `toml:"election_timeout" env:"ETCD_PEER_ELECTION_TIMEOUT"`
 | 
							ElectionTimeout   int    `toml:"election_timeout" env:"ETCD_PEER_ELECTION_TIMEOUT"`
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	strTrace     string `toml:"trace" env:"ETCD_TRACE"`
 | 
						StrTrace     string `toml:"trace" env:"ETCD_TRACE"`
 | 
				
			||||||
	GraphiteHost string `toml:"graphite_host" env:"ETCD_GRAPHITE_HOST"`
 | 
						GraphiteHost string `toml:"graphite_host" env:"ETCD_GRAPHITE_HOST"`
 | 
				
			||||||
	Cluster      struct {
 | 
						Cluster      struct {
 | 
				
			||||||
		ActiveSize   int     `toml:"active_size" env:"ETCD_CLUSTER_ACTIVE_SIZE"`
 | 
							ActiveSize   int     `toml:"active_size" env:"ETCD_CLUSTER_ACTIVE_SIZE"`
 | 
				
			||||||
@ -275,7 +275,7 @@ func (c *Config) LoadFlags(arguments []string) error {
 | 
				
			|||||||
	f.IntVar(&c.SnapshotCount, "snapshot-count", c.SnapshotCount, "")
 | 
						f.IntVar(&c.SnapshotCount, "snapshot-count", c.SnapshotCount, "")
 | 
				
			||||||
	f.StringVar(&c.CPUProfileFile, "cpuprofile", "", "")
 | 
						f.StringVar(&c.CPUProfileFile, "cpuprofile", "", "")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	f.StringVar(&c.strTrace, "trace", "", "")
 | 
						f.StringVar(&c.StrTrace, "trace", "", "")
 | 
				
			||||||
	f.StringVar(&c.GraphiteHost, "graphite-host", "", "")
 | 
						f.StringVar(&c.GraphiteHost, "graphite-host", "", "")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	f.IntVar(&c.Cluster.ActiveSize, "cluster-active-size", c.Cluster.ActiveSize, "")
 | 
						f.IntVar(&c.Cluster.ActiveSize, "cluster-active-size", c.Cluster.ActiveSize, "")
 | 
				
			||||||
@ -441,7 +441,7 @@ func (c *Config) MetricsBucketName() string {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
// Trace determines if any trace-level information should be emitted
 | 
					// Trace determines if any trace-level information should be emitted
 | 
				
			||||||
func (c *Config) Trace() bool {
 | 
					func (c *Config) Trace() bool {
 | 
				
			||||||
	return c.strTrace == "*"
 | 
						return c.StrTrace == "*"
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (c *Config) ClusterConfig() *server.ClusterConfig {
 | 
					func (c *Config) ClusterConfig() *server.ClusterConfig {
 | 
				
			||||||
 | 
				
			|||||||
@ -46,6 +46,7 @@ func (c *JoinCommand) NodeName() string {
 | 
				
			|||||||
// applyJoin attempts to join a machine to the cluster.
 | 
					// applyJoin attempts to join a machine to the cluster.
 | 
				
			||||||
func applyJoin(c *JoinCommand, context raft.Context) (uint64, error) {
 | 
					func applyJoin(c *JoinCommand, context raft.Context) (uint64, error) {
 | 
				
			||||||
	ps, _ := context.Server().Context().(*PeerServer)
 | 
						ps, _ := context.Server().Context().(*PeerServer)
 | 
				
			||||||
 | 
						ps.raftServer.FlushCommitIndex()
 | 
				
			||||||
	commitIndex := context.CommitIndex()
 | 
						commitIndex := context.CommitIndex()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Make sure we're not getting a cached value from the registry.
 | 
						// Make sure we're not getting a cached value from the registry.
 | 
				
			||||||
 | 
				
			|||||||
@ -1,3 +1,3 @@
 | 
				
			|||||||
package server
 | 
					package server
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const ReleaseVersion = "0.4.6"
 | 
					const ReleaseVersion = "0.4.9+git"
 | 
				
			||||||
 | 
				
			|||||||
@ -3,8 +3,10 @@ package server
 | 
				
			|||||||
import (
 | 
					import (
 | 
				
			||||||
	"encoding/json"
 | 
						"encoding/json"
 | 
				
			||||||
	"fmt"
 | 
						"fmt"
 | 
				
			||||||
 | 
						"io/ioutil"
 | 
				
			||||||
	"net/http"
 | 
						"net/http"
 | 
				
			||||||
	"net/http/pprof"
 | 
						"net/http/pprof"
 | 
				
			||||||
 | 
						"path"
 | 
				
			||||||
	"strings"
 | 
						"strings"
 | 
				
			||||||
	"time"
 | 
						"time"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -135,6 +137,7 @@ func (s *Server) installV2(r *mux.Router) {
 | 
				
			|||||||
	s.handleFunc(r2, "/v2/stats/leader", s.GetLeaderStatsHandler).Methods("GET", "HEAD")
 | 
						s.handleFunc(r2, "/v2/stats/leader", s.GetLeaderStatsHandler).Methods("GET", "HEAD")
 | 
				
			||||||
	s.handleFunc(r2, "/v2/stats/store", s.GetStoreStatsHandler).Methods("GET", "HEAD")
 | 
						s.handleFunc(r2, "/v2/stats/store", s.GetStoreStatsHandler).Methods("GET", "HEAD")
 | 
				
			||||||
	s.handleFunc(r2, "/v2/speedTest", s.SpeedTestHandler).Methods("GET", "HEAD")
 | 
						s.handleFunc(r2, "/v2/speedTest", s.SpeedTestHandler).Methods("GET", "HEAD")
 | 
				
			||||||
 | 
						s.handleFunc(r2, "/v2/migration/snapshot", s.SnapshotHandler).Methods("GET")
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (s *Server) installMod(r *mux.Router) {
 | 
					func (s *Server) installMod(r *mux.Router) {
 | 
				
			||||||
@ -324,12 +327,8 @@ func (s *Server) GetLeaderStatsHandler(w http.ResponseWriter, req *http.Request)
 | 
				
			|||||||
		return nil
 | 
							return nil
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	leader := s.peerServer.RaftServer().Leader()
 | 
						w.WriteHeader(http.StatusForbidden)
 | 
				
			||||||
	if leader == "" {
 | 
						w.Write([]byte("not current leader"))
 | 
				
			||||||
		return etcdErr.NewError(300, "", s.Store().Index())
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
	hostname, _ := s.registry.ClientURL(leader)
 | 
					 | 
				
			||||||
	uhttp.Redirect(hostname, w, req)
 | 
					 | 
				
			||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -363,6 +362,41 @@ func (s *Server) SpeedTestHandler(w http.ResponseWriter, req *http.Request) erro
 | 
				
			|||||||
	return nil
 | 
						return nil
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// SnapshotHandler forces etcd store to do a snapshot. If the disk parameter is set, the snapshot
 | 
				
			||||||
 | 
					// will be written to disk at data-dir/index-migrate.snap. Or the snapshot will be returned as
 | 
				
			||||||
 | 
					// http body.
 | 
				
			||||||
 | 
					func (s *Server) SnapshotHandler(w http.ResponseWriter, req *http.Request) error {
 | 
				
			||||||
 | 
						data, err := s.Store().Save()
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							http.Error(w, "failed to create snapshot: "+err.Error(), http.StatusInternalServerError)
 | 
				
			||||||
 | 
							log.Warn("Failed to create snapshot:" + err.Error())
 | 
				
			||||||
 | 
							return nil
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						disk := req.FormValue("disk")
 | 
				
			||||||
 | 
						if disk == "true" {
 | 
				
			||||||
 | 
							name := fmt.Sprintf("%d-migrate.snap", s.peerServer.RaftServer().CommitIndex())
 | 
				
			||||||
 | 
							err = ioutil.WriteFile(path.Join(s.peerServer.RaftServer().Path(), name), data, 0600)
 | 
				
			||||||
 | 
							if err != nil {
 | 
				
			||||||
 | 
								http.Error(w, "failed to save snapshot: "+err.Error(), http.StatusInternalServerError)
 | 
				
			||||||
 | 
								log.Warn("server: failed to save snapshot: " + err.Error())
 | 
				
			||||||
 | 
								return nil
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
							log.Infof("server: saved snapshot file %s successfully", name)
 | 
				
			||||||
 | 
							return nil
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if disk != "" && disk != "false" {
 | 
				
			||||||
 | 
							http.Error(w, "invalid parameter: disk="+disk, http.StatusBadRequest)
 | 
				
			||||||
 | 
							return nil
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						_, err = w.Write(data)
 | 
				
			||||||
 | 
						if err != nil {
 | 
				
			||||||
 | 
							log.Warnf("server: failed to write snapshot to %s: %v", req.RemoteAddr, err.Error())
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						return nil
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// Retrieves metrics from bucket
 | 
					// Retrieves metrics from bucket
 | 
				
			||||||
func (s *Server) GetMetricsHandler(w http.ResponseWriter, req *http.Request) error {
 | 
					func (s *Server) GetMetricsHandler(w http.ResponseWriter, req *http.Request) error {
 | 
				
			||||||
	(*s.metrics).Dump(w)
 | 
						(*s.metrics).Dump(w)
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user