mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-19 22:37:56 +08:00
randomize initial filer
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
|||||||
"github.com/chrislusf/seaweedfs/weed/storage/types"
|
"github.com/chrislusf/seaweedfs/weed/storage/types"
|
||||||
"github.com/chrislusf/seaweedfs/weed/wdclient"
|
"github.com/chrislusf/seaweedfs/weed/wdclient"
|
||||||
"math"
|
"math"
|
||||||
|
"math/rand"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"sync"
|
"sync"
|
||||||
@@ -96,6 +97,7 @@ func NewSeaweedFileSystem(option *Option) *WFS {
|
|||||||
},
|
},
|
||||||
signature: util.RandomInt32(),
|
signature: util.RandomInt32(),
|
||||||
}
|
}
|
||||||
|
wfs.option.filerIndex = rand.Intn(len(option.FilerAddresses))
|
||||||
cacheUniqueId := util.Md5String([]byte(option.MountDirectory + option.FilerGrpcAddresses[0] + option.FilerMountRootPath + util.Version()))[0:8]
|
cacheUniqueId := util.Md5String([]byte(option.MountDirectory + option.FilerGrpcAddresses[0] + option.FilerMountRootPath + util.Version()))[0:8]
|
||||||
cacheDir := path.Join(option.CacheDir, cacheUniqueId)
|
cacheDir := path.Join(option.CacheDir, cacheUniqueId)
|
||||||
if option.CacheSizeMB > 0 {
|
if option.CacheSizeMB > 0 {
|
||||||
|
Reference in New Issue
Block a user