Cr8 - A collection of utility scripts for working with clusters

Author
Chris Ward
Filed under
Date
February 3, 2016

Introducing Jordi

Mathias Fußenegger, aka 'Jordi'

Meet Mathias Fußenegger, aka 'Jordi', one of Crate's core engineers and a massive Linux fan.

At Snow Sprint, amongst other things, Jordi decided to add a random data generator to his Crate dev tools project.

Introducing Cr8 - Crate Dev Tools

Install Cr8

You will need at least Python 3.4, Install with pip.

pip install cr8

Usage

Cr8 has five tools available, which can be found by typing cr8 -h or cr8 <subcommand> -h. These are summarized below.

SQL Statement Runtime

Measure the runtime of a specific SQL statement on a cluster:

cr8 timeit "select * from tweets limit 100" SERVER_IP:4200

Generate an Insert Statement from JSON

To generate an insert statement from a supplied JSON string, ready for use on a Crate cluster:

echo '{"name": "Arthur", "lastname": "Dent"}' | cr8 json2insert mytable

Which will generate:

insert into mytable (lastname, name) values (?, ?)
['Dent', 'Arthur']

Upload a File into a BLOB table

To upload a file from your local file system to a Crate cluster BLOB table:

cr8 upload SERVER_IP:4200 blobtable /tmp/screenshot.png

Fill a Table with Random Data

To fill a table with randomly generated data from faker:

cr8 fill-table SERVER_IP:4200 mytable 100000

In this example, the 100000 is the amount of records you wish to fill. The script will read the table schema and map these to providers from faker.

For more details on Cr8 - Crate Dev Tools and to keep up to date with the project visit the GitHub repository.

Back to topAll posts