MapR 5.0 Documentation : Creating MapR-DB Tables

You can create MapR-DB tables using the MapR Control System (MCS), the maprcli command line interface, or the HBase shell. You can also create them at runtime with applications using the supported C APIs or HBase Java APIs. For more about these APIs, see Creating MapR-DB Applications.

When creating a MapR-DB table in MCS or by using the mapcli, specify a location in the MapR file system in addition to the name of the table. You can create a MapR-DB table anywhere on the cluster that you have write access.

  • Because MapR-DB tables, like files, are created by users, MapR tracks table activity in a user's home directory on the cluster. After mounting a cluster on NFS, use the standard Linux mkdir command to create a home directory at /user/<username> on your cluster for each user that will access MapR-DB tables. If a user does not have a corresponding directory under /user on the cluster, querying MapR for a list of tables that belong to that user generates an error reporting the missing directory.
  • Place in a dedicated volume any large tables that will be accessed by high-performing, mission-critical applications. If a volume contains only table data, the CLDB allocates that data across containers in a way that is favorable to performance.

To create MapR-DB tables in MCS:

  1. After logging into MCS, select MapR Tables in the MapR-FS section of the navigation tree on the left side of the screen. A section with the title MapR Tables opens to the right of the navigation tree.
  2. Click New Table.

To create MapR-DB tables with the maprcli:

Use the maprcli table create command at a command line.

As explained in the documentation for this command:

  • 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

For a list and description of all of the parameters in this command, see maprcli table create.

The following example demonstrates creation of a table table02 in cluster location /user/analysis/tables/. The cluster is mounted at /mnt/mapr/.

$ maprcli table create -path /user/analysis/tables/table02
$ ls -l /mnt/mapr/
lrwxr-xr-x 1 mapr mapr 2 Oct 24 16:14 table01 -> mapr::table::2056.62.17034
lrwxr-xr-x 1 mapr mapr 2 Oct 24 16:13 table02 -> mapr::table::2056.56.17022
$ maprcli table listrecent

To use the HBase shell to create a MapR-DB table, see the MapR tutorial "Getting Started with HBase Shell".