Connecting Clients to the MapR Container for Developers

You can access the MapR cluster running in the MapR Container for Developers from your laptop. Simply issue client commands from your laptop.

Setting up New Users

The MapR Container for Developers is set up with only users mapr and root. If you want to connect clients as some other user, you must add your user name and group to the container.

For example, if running the id command on your laptop returns the following:

uid=5001(mapruser) gid=5000(maprgroup)

Then, run the following commands to add your user name and group to the container:

ssh root@localhost -p 2222
groupadd -g 5000 maprgroup
useradd -m -u 5001 -gmaprgroup mapruser

Accessing the File System

The following command lists the files in the MapR file system on the cluster:
/opt/mapr/bin/hadoop fs -ls /

Accessing MapR Database

To access the MapR Database, use MapR Database shell:
/opt/mapr/bin/mapr dbshell
In the MapR Database shell, you can create a table, insert into the table, and read from the table:
create /tmp/t1
insert /tmp/t1 --v '{"a":"ABC"}' --id "ID1"
find /tmp/t1

Accessing Drill

The MapR client that you downloaded in the Prerequisites to Running the MapR Container for Developers topic includes a minimum set of clients. To run other clients, you must first copy the client software to your laptop.

The following example shows how to do this for Apache Drill 1.14.01.20.2:

  1. Determine your Docker <container-id> by examining the output of the docker ps command
  2. Copy Drill from your container to your laptop specifying the <container-id>:
    docker cp <container-id>:/opt/mapr/drill /opt/mapr/drill
  3. Connect to Drill as user mapr through JDBC by running sqlline:
    /opt/mapr/drill/drill-1.14.0/bin/sqlline -u "jdbc:drill:drillbit=localhost" -n mapr
    NOTE If you are using a different version of Drill, replace the version string with your version.
  4. Run a SQL query in sqlline:
    select * from cp.'employee.json' limit 10;

Demo Applications

Sample applications are available at https://github.com/mapr-demos/mapr-db-60-getting-started . The applications show you how to access a MapR Database JSON table using the following programming interfaces:

See the README file in the GitHub repository for detailed steps on how to create the data used in the applications and how to run the applications.