Cleaning Your Database

Cleaning your database essentially wipes out any user-defined tables, indexes, and related items.

   Learn more

This is a destructive process and should only be used by an administrator. Following the steps in this topic destroys your database data. And if you have non-SpliceMachine data stored in HBase, you must exercise additional caution to not destroy that data. Please follow the steps for your platform carefully.

You need to follow different steps, depending on which version of Splice Machine you are using:

Cleaning Your Splice Machine Database on a Cloudera-Managed Cluster

Follow these steps to clean your database if you’re using the Cloudera-managed cluster version of Splice Machine:

This is a destructive process and should only be used by an administrator!

  1. Shut down HBase and HDFS

    Navigate to the Services->All Services screen in Cloudera Manager, and select these actions to stop HBase and HDFS:

    hbase -> Actions -> Stop
    hdfs1 -> Actions -> Stop
    zookeeper1 -> Actions -> Stop
    
  2. Use the Zookeeper client to clean things:

    Restart ZooKeeper in the Services->All Services screen:

    zookeeper1 -> Actions -> Start
    

    Log in to the machine running Zookeeper on your cluster and start up a command-line (terminal) window.

    Run the zookeeper-client command. At the prompt, run the following commands:

    rmr /splice
    rmr /hbase
    quit
    
  3. Start HDFS

    Navigate to the Services->All Services screen in Cloudera Manager, and restart HDFS:

    hdfs1 -> Actions -> Start
    
  4. Clean up HBase

    Use the following shell command to delete the existing /hbase directory. You can run this command on any Data Node:

    sudo -su hdfs hadoop fs -rm -r /hbase
    

    If you are logged in as root, use this command instead:

    sudo -u hdfs hadoop fs -rm -r /hbase
    

    If the machine running Cloudera Manager is not part of the cluster, do not run the command on that machine

  5. Create a new HBase directory:

    Navigate to the HBase screen in Cloudera Manager, and create a new /hbase directory by selecting:

    Actions -> Create Root Directory
    
  6. Restart HBase

    Now restart HBase from the same Home->Services->hbase1 screen in Cloudera Manager, using this action:

    Actions -> Start
    

Cleaning Your Splice Machine Database on a Hortonworks HDP-Managed Cluster

Follow these steps to clean (or flatten) your database if you’re using Splice Machine on an Ambari-managed Hortonworks Cluster:

This is a destructive process and should only be used by an administrator!

  1. Shut down HBase and HDFS

    Log in to the Ambari Dashboard by pointing your browser to the publicly visible <hostName> for your master node that is hosting Ambari Server:

    http://<hostName>:8080/
    

    Select these actions to stop HBase and HDFS: :

    Services->HBase->Service Actions->Stop
    Services->HDFS->Service Actions->Stop
    
  2. Use the Zookeeper client to clean things

    Log in to the node running Zookeeper on your cluster and start up a command-line (terminal) window.

    Run the zookeeper-client command. At the prompt, run the following commands:

    rmr /splice
    rmr /hbase
    quit
    
  3. Restart HDFS

    Use the Ambari Dashboard to restart HDFS:

    Services->HDFS->Service Actions->Start
    
  4. Re-create the required directory structure

    You need to SSH into a node that is running the HDFS Client and re-create the directory structure that Splice Machine expects by issuing these commands:

    Run the zookeeper-client command. At the prompt, run the following commands:

    sudo -su hdfs hadoop fs -rm -r /apps/hbase
    sudo -su hdfs hadoop fs -mkdir /apps/hbase
    sudo -su hdfs hadoop fs -mkdir /apps/hbase/data
    sudo -su hdfs hadoop fs -chown hbase:hdfs /apps/hbase
    sudo -su hdfs hadoop fs -chown hbase:hdfs /apps/hbase/data
    
  5. Restart HBase

    Use the Ambari Dashboard to restart HBase:

    Services->HBase->Service Actions->Start
    

Cleaning Your Splice Machine Database on a MapR-Managed Cluster

Follow the steps below to clean (flatten) your database on your MapR cluster. You must be logged in as the cluster administrator (typically clusteradmin or ec2-user) to run each step. Unless otherwise specified, run each of these steps on your cluster control node; some steps, as indicated, must be run on each node in your cluster.

This is a destructive process and should only be used by an administrator!

  1. Stop the HBase RegionServers and Master:

    Use the following command on your control node to stop HBase on your cluster:

    ~/splice-installer-mapr4.0/stop-hbase.sh
    
  2. Remove old data from HDFS:

    Ignore any error messages you may see when you run this command:

    sudo -iu mapr hadoop fs -rm -r -f 'maprfs:///hbase/*'
    
  3. Stop MapR warden services:

    Run the following command on each node in your cluster:

    sudo service mapr-warden stop
    
  4. Launch the ZooKeeper command line shell:

    Note that the exact path may vary with different MapR versions

    /opt/mapr/zookeeper/zookeeper-3.4.5/bin/zkCli.sh
    
  5. Connect to the local ZooKeeper instance:

    When the ZooKeeper command shell prompts you, enter the connect command shown here:

    Connecting to localhost:2181
    Welcome to ZooKeeper!
    JLine support is enabled
    [zk: localhost:2181(CONNECTING) 0] connect localhost:5181
    
  6. Complete the connection:

    Press Enter again to display the connected prompt

    [zk: localhost:5181(CONNECTED) 1]
    
  7. Clear old ZooKeeper data:

    Enter the following commands to clear ZooKeeper data and then exit the command shell:

    rmr /splice
    rmr /hbase
    quit
    
  8. Restart MapR warden services on all nodes:

    Run the following command on each node in your cluster:

    sudo service mapr-warden start
    

    Once you do so, your cluster will re-create the Splice Machine schema, and the command line interface will once again be available after a minute or so.

  9. Restart HBase

    Run this command to restart hbase:

    ~/splice-installer-mapr4.0/start-hbase.sh
    

Cleaning Your Database in the Standalone Version

Follow these steps to clean your database if you’re using the Standalone version of Splice Machine:

  1. Make sure that you have quit the splice> command line interpreter:

    splice> quit;
    
  2. Change directory to your install directory:

    cd splicemachine
    
  3. Run the following scripts:

    $ ./bin/stop-splice.sh
    $ ./bin/clean.sh
    $ ./bin/start-splice.sh