|
|
@ -5,10 +5,13 @@ import ( |
|
|
|
"flag" |
|
|
|
"fmt" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/cluster" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/filer" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/pb" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/filer_pb" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/volume_server_pb" |
|
|
|
"github.com/seaweedfs/seaweedfs/weed/util" |
|
|
|
"io" |
|
|
|
"time" |
|
|
|
|
|
|
|
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb" |
|
|
|
) |
|
|
@ -92,6 +95,7 @@ func (c *commandClusterPs) Do(args []string, commandEnv *CommandEnv, writer io.W |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
filerSignatures := make(map[*master_pb.ListClusterNodesResponse_ClusterNode]int32) |
|
|
|
fmt.Fprintf(writer, "* filers %d\n", len(filerNodes)) |
|
|
|
for _, node := range filerNodes { |
|
|
|
fmt.Fprintf(writer, " * %s (%v)\n", node.Address, node.Version) |
|
|
@ -108,12 +112,29 @@ func (c *commandClusterPs) Do(args []string, commandEnv *CommandEnv, writer io.W |
|
|
|
fmt.Fprintf(writer, " filer group: %s\n", resp.FilerGroup) |
|
|
|
} |
|
|
|
fmt.Fprintf(writer, " signature: %d\n", resp.Signature) |
|
|
|
filerSignatures[node] = resp.Signature |
|
|
|
} else { |
|
|
|
fmt.Fprintf(writer, " failed to connect: %v\n", err) |
|
|
|
} |
|
|
|
return err |
|
|
|
}) |
|
|
|
} |
|
|
|
for _, node := range filerNodes { |
|
|
|
pb.WithFilerClient(false, pb.ServerAddress(node.Address), commandEnv.option.GrpcDialOption, func(client filer_pb.SeaweedFilerClient) error { |
|
|
|
fmt.Fprintf(writer, "* filer %s metadata sync time\n", node.Address) |
|
|
|
selfSignature := filerSignatures[node] |
|
|
|
for peer, peerSignature := range filerSignatures { |
|
|
|
if selfSignature == peerSignature { |
|
|
|
continue |
|
|
|
} |
|
|
|
if resp, err := client.KvGet(context.Background(), &filer_pb.KvGetRequest{Key: filer.GetPeerMetaOffsetKey(peerSignature)}); err == nil && len(resp.Value) == 8 { |
|
|
|
lastTsNs := int64(util.BytesToUint64(resp.Value)) |
|
|
|
fmt.Fprintf(writer, " %s: %v\n", peer.Address, time.Unix(0, lastTsNs).UTC()) |
|
|
|
} |
|
|
|
} |
|
|
|
return nil |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
// collect volume servers
|
|
|
|
var volumeServers []pb.ServerAddress |
|
|
|