Internal:Hbase

From Brown University Robotics

(Difference between revisions)
Jump to: navigation, search
Line 40: Line 40:
Otherwise you will get the following error when running the Hbase ros node: "ImportError: No module named thrift"
Otherwise you will get the following error when running the Hbase ros node: "ImportError: No module named thrift"
-
Logging ROS messages in HBase is very easy. Check out the hbase ros node currently in the experimental section of brown-ros-pkg. In the bin directory is a script called record which takes two or more arguments. The first id is a session-id which is simply a string used to retrieve your session later. The subsequent arguments are the names of the topics you wish to record. It searches for the exact topic, so be careful with capitalization and remember all topic names start with  /. When you're finished recording simply hit Ctrl-C, and your data is logged in the repository. Currently there can be issues with data loss if the server is shut down improperly, so be careful.
+
Logging ROS messages in HBase is very easy. Check out the hbase ros node currently in the experimental section of brown-ros-pkg. In the bin directory is a script called record which takes two or more arguments. The first id is a session-id which is simply a string used to retrieve your session later. The session-id must be unique, if not you will be prompted to enter a new session-id. The subsequent arguments are the names of the topics you wish to record. It searches for the exact topic, so be careful with capitalization and remember all topic names start with  /. When you're finished recording simply hit Ctrl-C, and your data is logged in the repository. Currently there can be issues with data loss if the server is shut down improperly, so be careful.
==Example==
==Example==
The following command logs the four topics /headF /cmd_Larm /cmd_Rarm /blobs under the session-id 3simplex1
The following command logs the four topics /headF /cmd_Larm /cmd_Rarm /blobs under the session-id 3simplex1

Revision as of 20:20, 5 May 2010

Contents

The HBase Server

To Start Hbase on maria

If you need to restart Hbase on maria, follow these instructions. Currently Hbase is installed in bkorel's home directory. The start scripts are have global read and execute permissions, so anyone should be able to restart Hbase.

 cd /home/bkorel/HBase/src/hbase-0.20.3

Start the Hbase server with the below command. You will be prompted twice for your password to localhost.

 bin/start-hbase.sh

Start the thrift server:

 bin/hbase-daemon.sh start thrift --port=9091

If you do not specify the port via the command line, the thrift server will use the default port of 9090. However if you get the error "Could not create ServerSocket on address /192.168.0.1:9090" when starting the thrift server, you need to specify a different port number as in the above command. Note: if the thrift server is started using a different port, 9091 is currently hard coded in the Hbase ros node (bin/record) and should be changed.

To start the Hbase shell:

 bin/bhase shell

Example Hbase shell usage:

 hbase> # Type "help" to see shell help screen
 hbase> help
 hbase> # To create a table named "mylittletable" with a column family of "mylittlecolumnfamily", type
 hbase> create "mylittletable", "mylittlecolumnfamily"
 hbase> # To see the schema for you just created "mylittletable" table and its single "mylittlecolumnfamily", type
 hbase> describe "mylittletable"
 hbase> # To add a row whose id is "myrow", to the column "mylittlecolumnfamily:x" with a value of 'v', do
 hbase> put "mylittletable", "myrow", "mylittlecolumnfamily:x", "v"
 hbase> # To get the cell just added, do
 hbase> get "mylittletable", "myrow"

To Stop Hbase

Hbase needs to be properly shut down; currently there are problems accessing previously stored data otherwise. Run the following two commands to stop the thrift and Hbase servers:

 bin/hbase-daemon.sh stop thrift
 bin/stop-hbase.sh

Instructions to Install Hbase on maria

Note: root permissions are required.


Logging in HBase

If logging data for the first time, add the following line to your .bashrc file:

 export PYTHONPATH="/usr/lib/python2.6/site-packages"

Otherwise you will get the following error when running the Hbase ros node: "ImportError: No module named thrift"

Logging ROS messages in HBase is very easy. Check out the hbase ros node currently in the experimental section of brown-ros-pkg. In the bin directory is a script called record which takes two or more arguments. The first id is a session-id which is simply a string used to retrieve your session later. The session-id must be unique, if not you will be prompted to enter a new session-id. The subsequent arguments are the names of the topics you wish to record. It searches for the exact topic, so be careful with capitalization and remember all topic names start with /. When you're finished recording simply hit Ctrl-C, and your data is logged in the repository. Currently there can be issues with data loss if the server is shut down improperly, so be careful.

Example

The following command logs the four topics /headF /cmd_Larm /cmd_Rarm /blobs under the session-id 3simplex1

 ./record 3simplex1 /headF /cmd_Larm /cmd_Rarm /blobs

Retrieving Data from HBase

Browsing the Table

Retrieving and Filtering Data