gohbase
gohbase copied to clipboard
Can't connect to the remote hbase with gohbase however works smoothly with happybase(Python Client)
Hi, we tried to connect the remote hbase server from a Ubuntu Server with the following gohbase code.
package main
import (
"context"
"fmt"
"github.com/tsuna/gohbase"
"github.com/tsuna/gohbase/hrpc"
)
func main() {
host := "OUR_HOST_DNS"
HBase := gohbase.NewClient(host, gohbase.FlushInterval(0))
family := map[string][]string{"intermediate_list": {"intermediate_content"}}
request, err1 := hrpc.NewGetStr(
context.Background(),
"intermediates",
"ee1560527322",
hrpc.Families(family))
if err1 != nil {
fmt.Println("Getting Intermediate Creating Request Error:", err1)
}
fmt.Println("GetStr Done")
_, err2 := HBase.Get(request)
fmt.Println("Get Done")
if err2 != nil {
fmt.Println("Getting Intermediate Scanning Error:", err2)
}
}
But it failed. If we put the above gohbase code on the remote master node, then it can run without the following errors.
ERRO[0040] failed looking up region backoff=16ms err="context deadline exceeded" key="\"ee1560527322\"" table="\"intermediates\""
ERRO[0070] failed looking up region backoff=32ms err="context deadline exceeded" key="\"ee1560527322\"" table="\"intermediates\""
ERRO[0100] failed looking up region backoff=64ms err="context deadline exceeded" key="\"ee1560527322\"" table="\"intermediates\""
However, we can connect to the remote hbase server from the Ubuntu Server through happybase with Python using the following code. We get exactly what we want.
import happybase
connection = happybase.Connection("OUR_HOST_DNS")
table = connection.table("intermediates")
row = table.row(b'ee1560527322')
print(row)
Because we can run it with Python and barely opened 0-65536 ports for any IP address, I think the reason can't be the network or hbase configuration. So I am wondering if there is anything we have missed in our gohbase client... Any words can help. Thanks in advance!
I have same problem with you, just now, i solve it. I solve it with following methods. """you can turn on the logrus.debuglevel to see the problem."""
Add the hbase cluster ip and host info to /etc/hosts. Then you can use correctly!
eg. My hbase cluster has 2 masters and 3 slaves , add belows to /etc/hosts 196.1.1.1 master1 196.1.1.2 master2 196.1.2.1 core1 196.1.2.2 core2 196.1.2.3 core3