Skip to content

How to use it in command line

jsevellec edited this page Jan 23, 2012 · 4 revisions

CassandraUnit provide a command line tools to load Data Set in your cassandra cluster.

Installation

  1. Get the latest CassandraUnit distribution (cassandra-unit-{last-version}-bin.tar.gz) :
  • from the github download section here
  • from the central maven repository here
  1. extract the distribution into the directory of your choice

  2. add the bin directory of the distribution to your path (to allow the use of the command everywhere)

  3. execute : "cu-loader" (it's the name of the command)

If the usage is printed, everything is ok :

Missing required options: f, h, p
usage: CassandraUnitLoader is a tool to load CassandraUnit data Set into cassandra cluster
 -f,--file <arg>                dataset to load
 -h,--host <arg>                target host (required)
 -o,--onlySchema                only load schema (optional)
 -p,--port <arg>                target port (required)
 -r,--replicationFactor <arg>   override the replication factor set in the dataset (optional)
 -s,--strategy <arg>            override the strategy set in the dataset (optional)

Use

The command is available for :

  • linux and Macosx platform : cu-loader
  • windows platform : cu-loader.bat

Here is the argument options list you can use :

  • -f (or --file) : dataset to load (required)

  • -h (or --host) : target cassandra node host (required)

  • -p (or --port) : target cassandra node port (required)

  • -o (or --onlySchema) : only load schema (optional)

  • -r (or --replicationFactor) : override the replication factor set in the dataset (optional)

  • -s (or --strategy) : override the strategy set in the dataset (optional)

Example of use

A simple example :

cu-loader -f datasetDefaultValue.xml -h localhost -p 9160

A more complex example :

cu-loader -f datasetDefaultValue.xml -h 10.10.10.01 -p 9160 -o -r 3 -s org.apache.cassandra.locator.NetworkTopologyStrategy