Running Shell Commands in Zeppelin

This section shows you how to access files in your local filesystem and the MapR File System by using shell commands in your Apache Zeppelin notebook.

Prerequisites

To use POSIX shell commands to access the MapR File System, you must have a MapR File System mount point in your container. The FUSE-Based POSIX Client provides this functionality.

About this task

In the following example, your MapR File System mount point is in /mapr and your cluster name is my.cluster.com. You can find the name of your cluster in the file /opt/mapr/conf/mapr-clusters.conf on your MapR Data Platform cluster.

Procedure

  1. Create a file of test data in /tmp:
    %sh
    cat > /tmp/test.data << EOF
    John,Smith
    Brian,May
    Rodger,Taylor
    John,Deacon
    Max,Plank
    Freddie,Mercury
    Albert,Einstein
    Fedor,Dostoevsky
    Lev,Tolstoy
    Niccolo,Paganini
    EOF
  2. Copy the file to your home directory in the MapR File System (/user/mapruser1), and display the contents of the file:
    %sh
    cp /tmp/test.data /mapr/my.cluster.com/user/mapruser1
    cat /mapr/my.cluster.com/user/mapruser1/test.data
    %sh
    hadoop fs -put /tmp/test.data /user/mapruser1
    hadoop fs -cat /user/mapruser1/test.data