You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ne...@apache.org on 2022/06/22 04:32:30 UTC

[iotdb-client-go] 04/04: add cluster example

This is an automated email from the ASF dual-hosted git repository.

neuyilan pushed a commit to branch fix_session_id
in repository https://gitbox.apache.org/repos/asf/iotdb-client-go.git

commit eb673b2d65909c815eac0236737f04bd4338e056
Author: HouliangQi <ne...@163.com>
AuthorDate: Wed Jun 22 12:31:53 2022 +0800

    add cluster example
---
 client/session.go          | 1 -
 example/session_example.go | 6 +++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/client/session.go b/client/session.go
index 8fe248d..20901db 100644
--- a/client/session.go
+++ b/client/session.go
@@ -909,7 +909,6 @@ func reconnect() bool {
 			err = initClusterConn(e.Value.(endPoint))
 			if err == nil {
 				connectedSuccess = true
-				fmt.Println("qihouliang host", e.Value.(endPoint).Host)
 				break
 			} else {
 				log.Println("Connection refused:", e.Value.(endPoint))
diff --git a/example/session_example.go b/example/session_example.go
index c8ad1f4..a6d7075 100644
--- a/example/session_example.go
+++ b/example/session_example.go
@@ -40,8 +40,8 @@ var (
 var session client.Session
 
 func InitSingleSession() client.Session {
-	flag.StringVar(&host, "host", "172.16.48.4", "--host=192.168.1.100")
-	flag.StringVar(&port, "port", "8685", "--port=6667")
+	flag.StringVar(&host, "host", "127.0.0.1", "--host=192.168.1.100")
+	flag.StringVar(&port, "port", "6667", "--port=6667")
 	flag.StringVar(&user, "user", "root", "--user=root")
 	flag.StringVar(&password, "password", "root", "--password=root")
 	flag.Parse()
@@ -59,7 +59,7 @@ func InitSingleSession() client.Session {
 }
 
 func InitClusterSession() client.Session {
-	nodeUrls := []string{"172.16.48.4:8685", "172.16.48.5:8685", "172.16.48.7:8685"}
+	nodeUrls := []string{"127.0.0.1:6667", "127.0.0.1:6668", "127.0.0.1:6669"}
 	clusterConfig := &client.ClusterConfig{
 		NodeUrls: nodeUrls,
 		UserName: "root",