Browse Source
1. volume server auto detect clustered master nodes
1. volume server auto detect clustered master nodes
2. remove operation package dependency on storagepull/2/head
Chris Lu
11 years ago
10 changed files with 127 additions and 23 deletions
-
27go/operation/list_masters.go
-
14go/operation/lookup_volume_id.go
-
2go/replication/allocate_volume.go
-
2go/replication/store_replicate.go
-
3go/replication/volume_growth.go
-
56go/storage/store.go
-
15go/util/http_util.go
-
21go/weed/master.go
-
8go/weed/weed_server/volume_server.go
-
2go/weed/weed_server/volume_server_handlers.go
@ -0,0 +1,27 @@ |
|||
package operation |
|||
|
|||
import ( |
|||
"code.google.com/p/weed-fs/go/glog" |
|||
"code.google.com/p/weed-fs/go/util" |
|||
"encoding/json" |
|||
) |
|||
|
|||
type ClusterStatusResult struct { |
|||
IsLeader bool |
|||
Leader string |
|||
Peers []string |
|||
} |
|||
|
|||
func ListMasters(server string) ([]string, error) { |
|||
jsonBlob, err := util.Get("http://" + server + "/cluster/status") |
|||
glog.V(2).Info("list masters result :", string(jsonBlob)) |
|||
if err != nil { |
|||
return nil, err |
|||
} |
|||
var ret ClusterStatusResult |
|||
err = json.Unmarshal(jsonBlob, &ret) |
|||
if err != nil { |
|||
return nil, err |
|||
} |
|||
return ret.Peers, nil |
|||
} |
@ -1,4 +1,4 @@ |
|||
package operation |
|||
package replication |
|||
|
|||
import ( |
|||
"code.google.com/p/weed-fs/go/storage" |
Write
Preview
Loading…
Cancel
Save
Reference in new issue