0

I had code working and reading from Hbase yesterday, streaming large quantities of data. I have not touched the code and yet, somehow, when I came back to it today it doesn't want to print out the data. The only thing I did on the server was set up a REST framework for writing to the database. Here's part of the code that works (so it seems like it's getting a connection)-

import happybase

connection = happybase.Connection('<ip-address>', '9090')

table = connection.table('rawdataingestion')

Then, when it gets to this part, it just stops working.

n = 0
li = []
for key, data in table.scan(row_start=None):
    data = json.loads(data['cf:rawmsg'])
    li.append(data)
    n += 1
    if n == 1000:
        break

Like I said, the only thing that changed on the server is that I set up the REST port (8000). Is that the problem? All I need is to pull data from the database.

Community
  • 1
  • 1
Ravaal
  • 3,233
  • 6
  • 39
  • 66

1 Answers1

0

Correct me if I'm wrong but it appears that REST and THRIFT do not work on the same server simultaneously. So it appears that I can either pull data from Hbase using THRIFT or push data to Hbase using REST. If one program works at pulling data, the other program that pushes data will fail and vice versa.

I solved the problem by typing in jps (you can also use ps -a) to find the number corresponding to the THRIFT process. I then killed the process with kill 12345. After that I restarted THRIFT in the background by typing ./hbase-daemon.sh start thrift. After I did that my program could successfully pull data from the database, but my other program that inserts data stopped working.

There's nothing wrong with the code, the problem is that REST and THRIFT do not work on the same server simultaneously.

Ravaal
  • 3,233
  • 6
  • 39
  • 66
  • For me only setting up the thrift server worked. I was able to read/write using the same – void Jan 23 '17 at 12:02