Creating Tables

There are several methods that you can use to create MapR-DB tables including the maprcli, and hbase shell, mapr dbshell commands and through the MCS.

Methods Common to Both Table Types

There are two methods that you can use to create both binary tables and JSON tables:
  • maprcli command
  • MCS

maprcli command

The basic command to create a binary table is:
maprcli table create -path <path>
To create a JSON table, include the -tabletype parameter and set it to json:
maprcli table create -path <path> -tabletype json
The -tabletype parameter is set to binary by default.

The format of the value of the -path parameter depends on whether you are creating a table on a local cluster or a remote cluster:

  • For a path on the local cluster, start the path at the volume mount point. For example, for a table named test under a volume with a mount point at /volume1, specify the following path: /volume1/test
  • For a path on a remote cluster, you must also specify the cluster name in the path. For example, for a table named customer under volume1 in the sanfrancisco cluster, specify the following path:/mapr/sanfrancisco/volume1/customer

When you create a table with this command, you can set a number of properties.

For full reference for this command, see table create.

MCS

In the Navigation pane, select MapR Tables under MapR-FS. Then, click the New Table button.

Figure: The New Tables button on the MapR Tables page

Method for Binary Tables Only

The HBase shell command is used on binary tables only. To run this command, execute the following:

hbase shell

After starting the HBase shell, run the create command. Type help to see a list of commands and their syntax. See HBase Shell for MapR-DB.

Method for JSON Tables Only

The MapR DB shell command is used on JSON tables only. To run this command, execute the following:

mapr dbshell

After starting the shell, run the create command. See mapr dbshell.