distributed-XL: Support to run one minio process per export even on the same machine. (#2999)

fixes #2983
This commit is contained in:
Krishna Srinivas
2016-10-19 01:19:24 +05:30
committed by Harshavardhana
parent 41f9ab1c69
commit 32c3a558e9
29 changed files with 688 additions and 416 deletions
+10 -18
View File
@@ -20,10 +20,8 @@ import (
"fmt"
"net/rpc"
"path"
"strings"
router "github.com/gorilla/mux"
"github.com/minio/minio-go/pkg/set"
)
// Routes paths for "minio control" commands.
@@ -36,32 +34,26 @@ func initRemoteControlClients(srvCmdConfig serverCmdConfig) []*AuthRPCClient {
if !srvCmdConfig.isDistXL {
return nil
}
var newExports []string
// Initialize auth rpc clients.
exports := srvCmdConfig.disks
remoteHosts := set.NewStringSet()
var remoteControlClnts []*AuthRPCClient
for _, export := range exports {
localMap := make(map[storageEndPoint]int)
for _, ep := range srvCmdConfig.endPoints {
// Set path to "" so that it is not used for filtering the
// unique entries.
ep.path = ""
// Validates if remote disk is local.
if isLocalStorage(export) {
if isLocalStorage(ep) {
continue
}
newExports = append(newExports, export)
}
for _, export := range newExports {
var host string
if idx := strings.LastIndex(export, ":"); idx != -1 {
host = export[:idx]
if localMap[ep] == 1 {
continue
}
remoteHosts.Add(fmt.Sprintf("%s:%d", host, globalMinioPort))
}
for host := range remoteHosts {
localMap[ep]++
remoteControlClnts = append(remoteControlClnts, newAuthClient(&authConfig{
accessKey: serverConfig.GetCredential().AccessKeyID,
secretKey: serverConfig.GetCredential().SecretAccessKey,
secureConn: isSSL(),
address: host,
address: fmt.Sprintf("%s:%d", ep.host, ep.port),
path: path.Join(reservedBucket, controlPath),
loginMethod: "Control.LoginHandler",
}))