https://github.com/chenjunpc2008/go-hbase
hbase thrift2 golang client pool
https://github.com/chenjunpc2008/go-hbase
big-data connection-pool go golang hbase hbase-client thrift2
Last synced: about 1 year ago
JSON representation
hbase thrift2 golang client pool
- Host: GitHub
- URL: https://github.com/chenjunpc2008/go-hbase
- Owner: chenjunpc2008
- License: mit
- Created: 2022-12-19T07:04:16.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-12-18T06:10:52.000Z (over 2 years ago)
- Last Synced: 2025-02-13T23:44:37.751Z (over 1 year ago)
- Topics: big-data, connection-pool, go, golang, hbase, hbase-client, thrift2
- Language: Go
- Homepage:
- Size: 87.9 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# go-tcp
Go Hbase library:
# Usage
## hbasePool
---
for example: ```example/pool-test```
1. Use config parameters to create a new pool.
2. Get() a conn object from pool handle, and don't forget to put it back(use Put()) after you done, otherwise the pool will run out of connections.
```go
cnf := hbasepool.Config{Host: "hb-909", Port: 9090,
MaxIdle: 2,
MaxActive: 1000,
IdleTimeout: 30 * time.Minute,
MaxConnLifetime: 8 * time.Hour,
}
hbPool := hbasepool.NewPool(cnf)
// get hbase conn
c, err := hbPool.Get()
assert.Equal(t, nil, err)
// return
defer func() {
hbPool.Put(c)
}()
// do some work below
// ...
```
3. Don't forget to Close() the pool handle before close your application.
```go
hbPool.Close()
```