If your IoTDB is a cluster version, you can use the following code for session pool connection
()
| 127 | |
| 128 | // If your IoTDB is a cluster version, you can use the following code for session pool connection |
| 129 | func useNodeUrls() { |
| 130 | |
| 131 | config := &client.PoolConfig{ |
| 132 | UserName: user, |
| 133 | Password: password, |
| 134 | NodeUrls: strings.Split("127.0.0.1:6667,127.0.0.1:6668", ","), |
| 135 | } |
| 136 | sessionPool = client.NewSessionPool(config, 3, 60000, 60000, false) |
| 137 | defer sessionPool.Close() |
| 138 | session, err := sessionPool.GetSession() |
| 139 | defer sessionPool.PutBack(session) |
| 140 | if err != nil { |
| 141 | log.Print(err) |
| 142 | return |
| 143 | } |
| 144 | |
| 145 | } |
| 146 | |
| 147 | func setStorageGroup(sg string) { |
| 148 | session, err := sessionPool.GetSession() |
nothing calls this directly
no test coverage detected
searching dependent graphs…