[ 
https://issues.apache.org/jira/browse/SCB-941?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16633316#comment-16633316
 ] 

ASF GitHub Bot commented on SCB-941:
------------------------------------

little-cui closed pull request #453: SCB-941 New admin/clusters API and cluster 
command
URL: https://github.com/apache/incubator-servicecomb-service-center/pull/453
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pkg/client/sc/apis.go b/pkg/client/sc/apis.go
index 99e0c811..9fff2505 100644
--- a/pkg/client/sc/apis.go
+++ b/pkg/client/sc/apis.go
@@ -23,16 +23,18 @@ import (
        "github.com/apache/incubator-servicecomb-service-center/server/core"
        pb 
"github.com/apache/incubator-servicecomb-service-center/server/core/proto"
        scerr 
"github.com/apache/incubator-servicecomb-service-center/server/error"
+       
"github.com/apache/incubator-servicecomb-service-center/server/plugin/pkg/registry"
        "github.com/apache/incubator-servicecomb-service-center/version"
        "io/ioutil"
        "net/http"
 )
 
 const (
-       apiVersionURL = "/version"
-       apiDumpURL    = "/v4/default/admin/dump"
-       apiSchemasURL = "/v4/%s/registry/microservices/%s/schemas"
-       apiSchemaURL  = "/v4/%s/registry/microservices/%s/schemas/%s"
+       apiVersionURL  = "/version"
+       apiDumpURL     = "/v4/default/admin/dump"
+       apiClustersURL = "/v4/default/admin/clusters"
+       apiSchemasURL  = "/v4/%s/registry/microservices/%s/schemas"
+       apiSchemaURL   = "/v4/%s/registry/microservices/%s/schemas/%s"
 )
 
 func (c *SCClient) toError(body []byte) *scerr.Error {
@@ -172,3 +174,32 @@ func (c *SCClient) GetSchemaBySchemaId(domainProject, 
serviceId, schemaId string
                Summary:  schema.SchemaSummary,
        }, nil
 }
+
+func (c *SCClient) GetClusters() (registry.Clusters, *scerr.Error) {
+       headers := c.commonHeaders()
+       // only default domain has admin permission
+       headers.Set("X-Domain-Name", "default")
+       resp, err := c.URLClient.HttpDo(http.MethodGet, 
c.Config.Addr+apiClustersURL, headers, nil)
+       if err != nil {
+               return nil, scerr.NewError(scerr.ErrInternal, err.Error())
+       }
+       defer resp.Body.Close()
+
+       body, err := ioutil.ReadAll(resp.Body)
+       if err != nil {
+               return nil, scerr.NewError(scerr.ErrInternal, err.Error())
+       }
+
+       if resp.StatusCode != http.StatusOK {
+               return nil, c.toError(body)
+       }
+
+       clusters := &model.ClustersResponse{}
+       err = json.Unmarshal(body, clusters)
+       if err != nil {
+               fmt.Println(string(body))
+               return nil, scerr.NewError(scerr.ErrInternal, err.Error())
+       }
+
+       return clusters.Clusters, nil
+}
diff --git a/scctl/bootstrap/bootstrap.go b/scctl/bootstrap/bootstrap.go
index b1ff4815..cb0c88b0 100644
--- a/scctl/bootstrap/bootstrap.go
+++ b/scctl/bootstrap/bootstrap.go
@@ -20,3 +20,4 @@ import _ 
"github.com/apache/incubator-servicecomb-service-center/scctl/pkg/plugi
 import _ 
"github.com/apache/incubator-servicecomb-service-center/scctl/pkg/plugin/get/service"
 import _ 
"github.com/apache/incubator-servicecomb-service-center/scctl/pkg/plugin/get/instance"
 import _ 
"github.com/apache/incubator-servicecomb-service-center/scctl/pkg/plugin/get/schema"
+import _ 
"github.com/apache/incubator-servicecomb-service-center/scctl/pkg/plugin/get/cluster"
diff --git a/scctl/pkg/plugin/README.md b/scctl/pkg/plugin/README.md
index c265e2e4..979cdeaa 100644
--- a/scctl/pkg/plugin/README.md
+++ b/scctl/pkg/plugin/README.md
@@ -134,6 +134,19 @@ ls -l schemas/springmvc/provider.v0.0.1
 #             type: "string"
 ```
 
+### cluster [options]
+
+Get the registry clusters managed by ServiceCenter.
+
+#### Examples
+```bash
+./scctl get cluster
+#   CLUSTER |        ENDPOINTS         
+# +---------+-------------------------+
+#   sc-1    | http://172.0.1.32:30100  
+#   sc-0    | http://172.0.1.29:30100
+```
+
 ## Diagnose commands
 
 The diagnostic command can output the ServiceCenter health report. 
diff --git a/scctl/pkg/plugin/get/cluster/cluster_cmd.go 
b/scctl/pkg/plugin/get/cluster/cluster_cmd.go
new file mode 100644
index 00000000..1a469a54
--- /dev/null
+++ b/scctl/pkg/plugin/get/cluster/cluster_cmd.go
@@ -0,0 +1,59 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package cluster
+
+import (
+       "github.com/apache/incubator-servicecomb-service-center/pkg/client/sc"
+       "github.com/apache/incubator-servicecomb-service-center/scctl/pkg/cmd"
+       
"github.com/apache/incubator-servicecomb-service-center/scctl/pkg/plugin/get"
+       
"github.com/apache/incubator-servicecomb-service-center/scctl/pkg/writer"
+       "github.com/spf13/cobra"
+)
+
+func init() {
+       NewClusterCommand(get.RootCmd)
+}
+
+func NewClusterCommand(parent *cobra.Command) *cobra.Command {
+       cmd := &cobra.Command{
+               Use:   "cluster [options]",
+               Short: "Output the registry clusters managed by service center",
+               Run:   ClusterCommandFunc,
+       }
+
+       parent.AddCommand(cmd)
+       return cmd
+}
+
+func ClusterCommandFunc(_ *cobra.Command, args []string) {
+       scClient, err := sc.NewSCClient(cmd.ScClientConfig)
+       if err != nil {
+               cmd.StopAndExit(cmd.ExitError, err)
+       }
+       clusters, scErr := scClient.GetClusters()
+       if scErr != nil {
+               cmd.StopAndExit(cmd.ExitError, scErr)
+       }
+       records := make(map[string]*ClusterRecord)
+       for name, endpoints := range clusters {
+               records[name] = &ClusterRecord{
+                       Name: name, Endpoints: endpoints,
+               }
+       }
+       sp := &ClustersPrinter{Records: records}
+       sp.SetOutputFormat(get.Output, get.AllDomains)
+       writer.PrintTable(sp)
+}
diff --git a/scctl/pkg/plugin/get/cluster/printer.go 
b/scctl/pkg/plugin/get/cluster/printer.go
new file mode 100644
index 00000000..5ab1d820
--- /dev/null
+++ b/scctl/pkg/plugin/get/cluster/printer.go
@@ -0,0 +1,69 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package cluster
+
+import (
+       "github.com/apache/incubator-servicecomb-service-center/pkg/util"
+       
"github.com/apache/incubator-servicecomb-service-center/scctl/pkg/writer"
+)
+
+var (
+       clusterTableHeader = []string{"CLUSTER", "ENDPOINTS"}
+)
+
+type ClusterRecord struct {
+       Name      string
+       Endpoints []string
+}
+
+func (s *ClusterRecord) EndpointsString() string {
+       return util.StringJoin(s.Endpoints, "\n")
+}
+
+func (s *ClusterRecord) PrintBody(fmt string) []string {
+       return []string{s.Name, s.EndpointsString()}
+}
+
+type ClustersPrinter struct {
+       Records map[string]*ClusterRecord
+       flags   []interface{}
+}
+
+func (sp *ClustersPrinter) SetOutputFormat(f string, all bool) {
+       sp.Flags(f, all)
+}
+
+func (sp *ClustersPrinter) Flags(flags ...interface{}) []interface{} {
+       if len(flags) > 0 {
+               sp.flags = flags
+       }
+       return sp.flags
+}
+
+func (sp *ClustersPrinter) PrintBody() (slice [][]string) {
+       for _, s := range sp.Records {
+               slice = append(slice, s.PrintBody(sp.flags[0].(string)))
+       }
+       return
+}
+
+func (sp *ClustersPrinter) PrintTitle() []string {
+       return clusterTableHeader
+}
+
+func (sp *ClustersPrinter) Sorter() *writer.RecordsSorter {
+       return nil
+}
diff --git a/scctl/pkg/plugin/get/instance/types.go 
b/scctl/pkg/plugin/get/instance/printer.go
similarity index 97%
rename from scctl/pkg/plugin/get/instance/types.go
rename to scctl/pkg/plugin/get/instance/printer.go
index 180ca85c..110b1a2d 100644
--- a/scctl/pkg/plugin/get/instance/types.go
+++ b/scctl/pkg/plugin/get/instance/printer.go
@@ -112,3 +112,7 @@ func (sp *InstancePrinter) PrintTitle() []string {
                return shortInstanceTableHeader
        }
 }
+
+func (sp *InstancePrinter) Sorter() *writer.RecordsSorter {
+       return nil
+}
diff --git a/scctl/pkg/plugin/get/schema/schema_cmd.go 
b/scctl/pkg/plugin/get/schema/schema_cmd.go
index 31e58cf3..31ded098 100644
--- a/scctl/pkg/plugin/get/schema/schema_cmd.go
+++ b/scctl/pkg/plugin/get/schema/schema_cmd.go
@@ -32,10 +32,6 @@ import (
        "strings"
 )
 
-const (
-       defaultBufferSize = 64 * 1024
-)
-
 var (
        AppId       string
        ServiceName string
diff --git a/scctl/pkg/plugin/get/schema/types.go 
b/scctl/pkg/plugin/get/schema/writer.go
similarity index 100%
rename from scctl/pkg/plugin/get/schema/types.go
rename to scctl/pkg/plugin/get/schema/writer.go
diff --git a/scctl/pkg/plugin/get/service/types.go 
b/scctl/pkg/plugin/get/service/printer.go
similarity index 97%
rename from scctl/pkg/plugin/get/service/types.go
rename to scctl/pkg/plugin/get/service/printer.go
index d00f6d8d..c75f2a0f 100644
--- a/scctl/pkg/plugin/get/service/types.go
+++ b/scctl/pkg/plugin/get/service/printer.go
@@ -106,3 +106,7 @@ func (sp *ServicePrinter) PrintTitle() []string {
                return shortServiceTableHeader
        }
 }
+
+func (sp *ServicePrinter) Sorter() *writer.RecordsSorter {
+       return nil
+}
diff --git a/scctl/pkg/writer/sorter.go b/scctl/pkg/writer/sorter.go
new file mode 100644
index 00000000..9e506223
--- /dev/null
+++ b/scctl/pkg/writer/sorter.go
@@ -0,0 +1,46 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package writer
+
+func firstColumnCmpFunc(row1, row2 []string) bool {
+       return row1[0] < row2[0]
+}
+
+type RecordsSorter struct {
+       Records     [][]string
+       CompareFunc func(row1, row2 []string) bool
+}
+
+func (s *RecordsSorter) Len() int {
+       return len(s.Records)
+}
+
+func (s *RecordsSorter) Swap(i, j int) {
+       s.Records[i], s.Records[j] = s.Records[j], s.Records[i]
+}
+
+func (s *RecordsSorter) Less(i, j int) bool {
+       return s.CompareFunc(s.Records[i], s.Records[j])
+}
+
+func NewRecordsSorter(cmp func([]string, []string) bool) *RecordsSorter {
+       if cmp == nil {
+               cmp = firstColumnCmpFunc
+       }
+       return &RecordsSorter{
+               CompareFunc: cmp,
+       }
+}
diff --git a/scctl/pkg/writer/writer.go b/scctl/pkg/writer/writer.go
index 744637e9..310ba57a 100644
--- a/scctl/pkg/writer/writer.go
+++ b/scctl/pkg/writer/writer.go
@@ -18,6 +18,7 @@ package writer
 import (
        "github.com/olekukonko/tablewriter"
        "os"
+       "sort"
        "strconv"
        "time"
 )
@@ -28,6 +29,7 @@ type Printer interface {
        Flags(flags ...interface{}) []interface{}
        PrintBody() [][]string
        PrintTitle() []string
+       Sorter() *RecordsSorter
 }
 
 func TimeFormat(delta time.Duration) string {
@@ -63,5 +65,12 @@ func MakeTable(tableName []string, tableContent [][]string) {
 }
 
 func PrintTable(p Printer) {
-       MakeTable(p.PrintTitle(), p.PrintBody())
+       body := p.PrintBody()
+       sorter := p.Sorter()
+       if sorter == nil {
+               sorter = NewRecordsSorter(nil)
+       }
+       sorter.Records = body
+       sort.Sort(sorter)
+       MakeTable(p.PrintTitle(), body)
 }
diff --git a/server/admin/controller_v4.go b/server/admin/controller_v4.go
index 5fd786a1..077042a5 100644
--- a/server/admin/controller_v4.go
+++ b/server/admin/controller_v4.go
@@ -32,6 +32,7 @@ type AdminServiceControllerV4 struct {
 func (ctrl *AdminServiceControllerV4) URLPatterns() []rest.Route {
        return []rest.Route{
                {rest.HTTP_METHOD_GET, "/v4/:project/admin/dump", ctrl.Dump},
+               {rest.HTTP_METHOD_GET, "/v4/:project/admin/clusters", 
ctrl.Clusters},
        }
 }
 
@@ -44,3 +45,13 @@ func (ctrl *AdminServiceControllerV4) Dump(w 
http.ResponseWriter, r *http.Reques
        resp.Response = nil
        controller.WriteResponse(w, respInternal, resp)
 }
+
+func (ctrl *AdminServiceControllerV4) Clusters(w http.ResponseWriter, r 
*http.Request) {
+       request := &model.ClustersRequest{}
+       ctx := r.Context()
+       resp, _ := AdminServiceAPI.Clusters(ctx, request)
+
+       respInternal := resp.Response
+       resp.Response = nil
+       controller.WriteResponse(w, respInternal, resp)
+}
diff --git a/server/admin/model/cluster.go b/server/admin/model/cluster.go
new file mode 100644
index 00000000..5e768f20
--- /dev/null
+++ b/server/admin/model/cluster.go
@@ -0,0 +1,29 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package model
+
+import (
+       pb 
"github.com/apache/incubator-servicecomb-service-center/server/core/proto"
+       
"github.com/apache/incubator-servicecomb-service-center/server/plugin/pkg/registry"
+)
+
+type ClustersRequest struct {
+}
+
+type ClustersResponse struct {
+       Response *pb.Response      `json:"response,omitempty"`
+       Clusters registry.Clusters `json:"clusters,omitempty"`
+}
diff --git a/server/admin/service.go b/server/admin/service.go
index d178a650..2a86d80f 100644
--- a/server/admin/service.go
+++ b/server/admin/service.go
@@ -25,6 +25,7 @@ import (
        pb 
"github.com/apache/incubator-servicecomb-service-center/server/core/proto"
        scerr 
"github.com/apache/incubator-servicecomb-service-center/server/error"
        
"github.com/apache/incubator-servicecomb-service-center/server/plugin/pkg/discovery"
+       
"github.com/apache/incubator-servicecomb-service-center/server/plugin/pkg/registry"
        "github.com/apache/incubator-servicecomb-service-center/version"
        "github.com/astaxie/beego"
        "golang.org/x/net/context"
@@ -39,10 +40,13 @@ var (
 )
 
 func init() {
+       // cache envs
        for _, kv := range os.Environ() {
                arr := strings.Split(kv, "=")
                environments[arr[0]] = arr[1]
        }
+
+       // cache configs
        configs, _ = beego.AppConfig.GetSection("default")
        if section, err := beego.AppConfig.GetSection(beego.BConfig.RunMode); 
err == nil {
                for k, v := range section {
@@ -96,3 +100,9 @@ func setValue(e discovery.Adaptor, setter model.Setter) {
                return true
        })
 }
+
+func (service *AdminService) Clusters(ctx context.Context, in 
*model.ClustersRequest) (*model.ClustersResponse, error) {
+       return &model.ClustersResponse{
+               Clusters: registry.Configuration().Clusters,
+       }, nil
+}
diff --git a/server/core/swagger/v4.yaml b/server/core/swagger/v4.yaml
index 07fe446e..75ff962d 100644
--- a/server/core/swagger/v4.yaml
+++ b/server/core/swagger/v4.yaml
@@ -1636,6 +1636,7 @@ paths:
           required: true
         - name: project
           in: path
+          default: default
           description: default项目
           required: true
           type: string
@@ -1650,6 +1651,31 @@ paths:
           description: Forbidden
           schema:
             type: string
+  /v4/{project}/admin/clusters:
+    get:
+      description: |
+        Return the registry clusters managed by Service Center
+      operationId: clusters
+      parameters:
+        - name: x-domain-name
+          in: header
+          type: string
+          default: default
+          description: default租户
+          required: true
+        - name: project
+          in: path
+          default: default
+          description: default项目
+          required: true
+          type: string
+      tags:
+        - admin
+      responses:
+        200:
+          description: clusters information
+          schema:
+            $ref: '#/definitions/ClustersResponse'
 definitions:
   Version:
     type: object
@@ -2408,3 +2434,15 @@ definitions:
         $ref: '#/definitions/Properties'
       cache:
         $ref: "#/definitions/Cache"
+  Clusters:
+    type: object
+    description: Clusters information
+    additionalProperties:
+      type: array
+      items:
+        type: string
+  ClustersResponse:
+    type: object
+    properties:
+      clusters:
+        $ref: '#/definitions/Clusters'
diff --git a/server/plugin/pkg/discovery/sc/aggregate.go 
b/server/plugin/pkg/discovery/sc/aggregate.go
index 77dce38b..d16430ce 100644
--- a/server/plugin/pkg/discovery/sc/aggregate.go
+++ b/server/plugin/pkg/discovery/sc/aggregate.go
@@ -78,12 +78,13 @@ func (c *SCClientAggregate) 
GetSchemaBySchemaId(domainProject, serviceId, schema
 
 func NewSCClientAggregate() *SCClientAggregate {
        c := &SCClientAggregate{}
-       clusters := registry.Configuration().Clusters()
+       clusters := registry.Configuration().Clusters
        for name, addr := range clusters {
                if len(name) == 0 || name == 
registry.Configuration().ClusterName {
                        continue
                }
-               client, err := sc.NewSCClient(sc.Config{Addr: addr})
+               // TODO support endpoints LB
+               client, err := sc.NewSCClient(sc.Config{Addr: addr[0]})
                if err != nil {
                        log.Errorf(err, "new service center[%s][%s] client 
failed", name, addr)
                        continue
diff --git a/server/plugin/pkg/registry/config.go 
b/server/plugin/pkg/registry/config.go
index 5f404cfb..0e7a61a4 100644
--- a/server/plugin/pkg/registry/config.go
+++ b/server/plugin/pkg/registry/config.go
@@ -34,38 +34,38 @@ type Config struct {
        EmbedMode        string
        ManagerAddress   string
        ClusterName      string
-       ClusterAddresses string
+       ClusterAddresses string   // the raw string of cluster configuration
+       Clusters         Clusters // parsed from ClusterAddresses
        DialTimeout      time.Duration
        RequestTimeOut   time.Duration
        AutoSyncInterval time.Duration
 }
 
-func (c *Config) Clusters() map[string]string {
-       clusters := make(map[string]string)
+func (c *Config) InitClusters() {
+       c.Clusters = make(Clusters)
        kvs := strings.Split(c.ClusterAddresses, ",")
        for _, cluster := range kvs {
-               // sc-0=http(s)://host:port
+               // sc-0=http(s)://host1:port1|http(s)://host2:port2
                names := strings.Split(cluster, "=")
                if len(names) != 2 {
                        continue
                }
-               clusters[names[0]] = names[1]
+               c.Clusters[names[0]] = strings.Split(names[1], "|")
        }
-       if len(clusters) == 0 {
-               clusters[c.ClusterName] = c.ClusterAddresses
+       if len(c.Clusters) == 0 {
+               c.Clusters[c.ClusterName] = []string{c.ClusterAddresses}
        }
-       return clusters
 }
 
+// ClusterAddress return the address of current SC's registry backend
 func (c *Config) ClusterAddress() string {
-       return c.Clusters()[c.ClusterName]
+       return c.Clusters[c.ClusterName][0]
 }
 
 func Configuration() *Config {
        configOnce.Do(func() {
                var err error
-
-               defaultRegistryConfig.ClusterName = 
beego.AppConfig.String("manager_name")
+               defaultRegistryConfig.ClusterName = 
beego.AppConfig.DefaultString("manager_name", "default")
                defaultRegistryConfig.ManagerAddress = 
beego.AppConfig.String("manager_addr")
                defaultRegistryConfig.ClusterAddresses = 
beego.AppConfig.DefaultString("manager_cluster", "http://127.0.0.1:2379";)
                defaultRegistryConfig.DialTimeout, err = 
time.ParseDuration(beego.AppConfig.DefaultString("registry_timeout", "30s"))
@@ -84,6 +84,7 @@ func Configuration() *Config {
                if err != nil {
                        log.Errorf(err, "auto_sync_interval is invalid")
                }
+               defaultRegistryConfig.InitClusters()
        })
        return &defaultRegistryConfig
 }
diff --git a/server/plugin/pkg/registry/etcd/etcd_test.go 
b/server/plugin/pkg/registry/etcd/etcd_test.go
index 7f1a50b4..5fc3fa67 100644
--- a/server/plugin/pkg/registry/etcd/etcd_test.go
+++ b/server/plugin/pkg/registry/etcd/etcd_test.go
@@ -67,6 +67,7 @@ func TestEtcdClient(t *testing.T) {
        old1 := registry.Configuration().ClusterAddresses
        old2 := registry.Configuration().DialTimeout
        registry.Configuration().ClusterAddresses = "x"
+       registry.Configuration().InitClusters()
        registry.Configuration().DialTimeout = dialTimeout
        inst = NewRegistry()
        if inst == nil {
@@ -78,6 +79,7 @@ func TestEtcdClient(t *testing.T) {
                t.Fatalf("TestEtcdClient failed, %#v", err)
        }
        registry.Configuration().ClusterAddresses = old1
+       registry.Configuration().InitClusters()
        registry.Configuration().DialTimeout = old2
 
        // case: etcd do
diff --git a/server/plugin/pkg/registry/types.go 
b/server/plugin/pkg/registry/types.go
index 986e95d8..ed5c9825 100644
--- a/server/plugin/pkg/registry/types.go
+++ b/server/plugin/pkg/registry/types.go
@@ -121,3 +121,5 @@ func (pr *PluginResponse) String() string {
        return fmt.Sprintf("{action: %s, count: %d/%d, rev: %d, succeed: %v}",
                pr.Action, len(pr.Kvs), pr.Count, pr.Revision, pr.Succeeded)
 }
+
+type Clusters map[string][]string


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Support multiple datacenter deployment
> --------------------------------------
>
>                 Key: SCB-941
>                 URL: https://issues.apache.org/jira/browse/SCB-941
>             Project: Apache ServiceComb
>          Issue Type: New Feature
>          Components: Service-Center
>            Reporter: little-cui
>            Assignee: little-cui
>            Priority: Major
>             Fix For: service-center-1.1.0
>
>




--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to