Inserting data into HBase
In this recipe, we will insert data into HBase and see how it is stored. The syntax for import data is not similar to SQL, as there are no select or insert statements. To insert data, we use put and scan for select.
Getting ready
Before going through the recipe in this section, make sure you have completed the previous recipe, Setting up multi-node HBase cluster.
How to do it...
- Connect to the
master1.cyrus.com
master node in the cluster and switch to the userhadoop
. - Connect to the HBase shell using the
hbase shell
command. You can connect to the shell in interactive mode or script it. - Create a table as shown in the following screenshot:
- Insert data using the commands shown in the following screenshot:
- You can list the tables and scan a table, as shown in the following screenshot:
- Commands can be passed in non-interactive mode, as shown in the following screenshot:
$ echo "scan 'test'" | hbase shell $ echo "put 'test', 'r3',...