use separate filer grpc port

This commit is contained in:
Chris Lu
2018-06-05 23:37:41 -07:00
parent 95fe745a0c
commit 299312c805
7 changed files with 86 additions and 41 deletions

View File

@@ -11,6 +11,8 @@ import (
"github.com/chrislusf/seaweedfs/weed/filesys"
"github.com/chrislusf/seaweedfs/weed/glog"
"github.com/chrislusf/seaweedfs/weed/util"
"strings"
"strconv"
)
func runMount(cmd *Command, args []string) bool {
@@ -51,8 +53,27 @@ func runMount(cmd *Command, args []string) bool {
c.Close()
})
hostnameAndPort := strings.Split(*mountOptions.filer, ":")
if len(hostnameAndPort) != 2 {
fmt.Printf("The filer should have hostname:port format: %v\n", hostnameAndPort)
return false
}
filerPort, parseErr := strconv.ParseUint(hostnameAndPort[1], 10, 64)
if parseErr != nil {
fmt.Printf("The filer filer port parse error: %v\n", parseErr)
return false
}
filerGrpcPort := filerPort + 10000
if *mountOptions.filerGrpcPort != 0 {
filerGrpcPort = uint64(*copy.filerGrpcPort)
}
filerAddress := fmt.Sprintf("%s:%d", hostnameAndPort[0], filerGrpcPort)
err = fs.Serve(c, filesys.NewSeaweedFileSystem(
*mountOptions.filer, *mountOptions.collection, *mountOptions.replication, *mountOptions.chunkSizeLimitMB))
filerAddress, *mountOptions.collection, *mountOptions.replication, *mountOptions.chunkSizeLimitMB))
if err != nil {
fuse.Unmount(*mountOptions.dir)
}