Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
namhq1989 | 8a44d79ff0 | |
namhq1989 | dfdd151282 |
5
go.mod
5
go.mod
|
@ -2,7 +2,4 @@ module git.selly.red/Selly-Modules/zookeeper
|
|||
|
||||
go 1.16
|
||||
|
||||
require (
|
||||
github.com/logrusorgru/aurora v2.0.3+incompatible
|
||||
github.com/samuel/go-zookeeper v0.0.0-20201211165307-7117e9ea2414
|
||||
)
|
||||
require github.com/samuel/go-zookeeper v0.0.0-20201211165307-7117e9ea2414
|
||||
|
|
2
go.sum
2
go.sum
|
@ -1,4 +1,2 @@
|
|||
github.com/logrusorgru/aurora v2.0.3+incompatible h1:tOpm7WcpBTn4fjmVfgpQq0EfczGlG91VSDkswnjF5A8=
|
||||
github.com/logrusorgru/aurora v2.0.3+incompatible/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
|
||||
github.com/samuel/go-zookeeper v0.0.0-20201211165307-7117e9ea2414 h1:AJNDS0kP60X8wwWFvbLPwDuojxubj9pbfK7pjHw0vKg=
|
||||
github.com/samuel/go-zookeeper v0.0.0-20201211165307-7117e9ea2414/go.mod h1:gi+0XIa01GRL2eRQVjQkKGqKF3SF9vZR/HnPullcV2E=
|
||||
|
|
|
@ -4,7 +4,6 @@ import (
|
|||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/logrusorgru/aurora"
|
||||
"github.com/samuel/go-zookeeper/zk"
|
||||
)
|
||||
|
||||
|
@ -12,20 +11,16 @@ var zkClient *zk.Conn
|
|||
|
||||
// Connect ...
|
||||
func Connect(uri string) error {
|
||||
c, _, err := zk.Connect([]string{uri}, time.Second*30)
|
||||
c, _, err := zk.Connect([]string{uri}, time.Second*30, zk.WithLogInfo(false))
|
||||
if err != nil {
|
||||
fmt.Println("Error when connect to Zookeeper", uri, err)
|
||||
return err
|
||||
}
|
||||
|
||||
fmt.Println(aurora.Green("*** CONNECTED TO ZOOKEEPER: " + uri))
|
||||
fmt.Printf("⚡️[zookeeper]: connected to %s \n", uri)
|
||||
|
||||
// Set client
|
||||
zkClient = c
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue