aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruitao.liu <ruitao.liu@cloudminds.com>2020-09-10 16:24:09 +0800
committerruitao.liu <ruitao.liu@cloudminds.com>2020-09-10 16:24:09 +0800
commit719dc43af14142ca1fb199882366b46aa4189e1f (patch)
tree63f017d0ccd058577ac8219ef36077479f08758d
parent72f9d7f047573ce2bd785b0ba48b8ad13e4b87da (diff)
downloadseaweedfs-719dc43af14142ca1fb199882366b46aa4189e1f.tar.xz
seaweedfs-719dc43af14142ca1fb199882366b46aa4189e1f.zip
modify elastic urls from string to array.
-rw-r--r--weed/command/scaffold.go6
-rw-r--r--weed/filer/elastic/v7/elastic_store.go9
2 files changed, 7 insertions, 8 deletions
diff --git a/weed/command/scaffold.go b/weed/command/scaffold.go
index 7ced118ca..800bc6029 100644
--- a/weed/command/scaffold.go
+++ b/weed/command/scaffold.go
@@ -176,7 +176,11 @@ database = "seaweedfs"
[elastic7]
enabled = false
-servers = "http://localhost1:9200,http://localhost2:9200,http://localhost3:9200"
+servers = [
+ "http://localhost1:9200",
+ "http://localhost2:9200",
+ "http://localhost3:9200",
+]
username = ""
password = ""
sniff_enabled = false
diff --git a/weed/filer/elastic/v7/elastic_store.go b/weed/filer/elastic/v7/elastic_store.go
index 7696d6b1f..5750b2fb8 100644
--- a/weed/filer/elastic/v7/elastic_store.go
+++ b/weed/filer/elastic/v7/elastic_store.go
@@ -68,13 +68,8 @@ func (store *ElasticStore) Initialize(configuration weed_util.Configuration, pre
}
func (store *ElasticStore) initialize(configuration weed_util.Configuration, prefix string) (options []elastic.ClientOptionFunc) {
- configuration.SetDefault(prefix+"servers", "http://localhost:9200")
- servers := configuration.GetString(prefix + "servers")
- url := make([]string, 0)
- for _, v := range strings.Split(servers, ",") {
- url = append(url, v)
- }
- options = append(options, elastic.SetURL(url...))
+ servers := configuration.GetStringSlice(prefix + "servers")
+ options = append(options, elastic.SetURL(servers...))
username := configuration.GetString(prefix + "username")
password := configuration.GetString(prefix + "password")
if username != "" && password != "" {