Public Repository

Last pushed: 4 months ago
Short Description
Retrieves data from Apache Cassandra database
Full Description

What is expcassandra?

It is an Alpine image with a Golang program using gocql
drivers which allows you to retrieved data from Apache Cassandra.

The keyspace's table which contains the data you want to retrieve must
have three colums: $UID_COLUMN (timeuuid), $KEY_COLUMN (timestamp or int) and $DATA_COLUMN (text);
PRIMARY KEY ($UID_COLUMN, $KEY_COLUMN).
$KEY_COLUMN's column type have to be timestamp if you have saved the data with
their timestamp, or int if you have saved them with a sequence (1,2,3,4...).

Features

  • Works with Apache Cassandra 2.1.x and latter versions.
  • It writes the retrieved data in stdout.
  • It prints state messages in stderr.
  • Auto reconnect.

How to use this image

example assuming the Cassandra IP is 172.16.56.183:

$ docker run --name some-expcassandra --env CLUSTER="172.16.56.183" --env KEYSPACE="example" --env TABLE="hello" -it puyi/expcassandra
> hello it,is,my_first,Example
> goodby friends

IMPORTANT: if you do not set up the required enviroment variables, this image will not work correctly.

Required Enviroment Variables

CLUSTER

This variable is for controlling which Cassandra IP address to connect to.

KEYSPACE

This variable is for controlling which Keyspace you want to use.

TABLE

This variable is for controlling which Keyspace's Table you want to use to retrieved
the data. It must have three colums: $UID_COLUMN (timeuuid),
$KEY_COLUMN (timestamp or int) and $DATA_COLUMN (text); PRIMARY KEY ($UID_COLUMN, $KEY_COLUMN).
$KEY_COLUMN's column type have to be timestamp if you have saved the data with
a timestamp, or int if you have saved them with a sequence (1,2,3,4...).

Optional Enviroment Variables

DATA_KEY

Timestamp or sequence from which data are retrieved from the database.
Default value: "00001-01-01 00:00:00.001-0000", which means that all the data will be retrieved.

LIMIT_ENTRIES

Max. number of table entries that are retrieved in a query. Page size in each query.
Default value: 100

SLEEPIME

Amount of milliseconds to wait between queries.
Default value: 100

With LIMIT and SLEEPTIME you can configure how fast expcassadra gives the results.
If LIMIT is very high, there will be timeout response problems, be careful.

UID_COLUMN

Column's table which contains the uid.
Default value: id

KEY_COLUMN

Column's table which contains the foreing key.
Default value: UTCtime

DATA_COLUMN

Column's table which contains the data to retrieve.
Default value: data

Date format

yyyy-mm-dd HH:mm:ss.sss-Z

Where Z is the 4-digit time zone, expressing the time zone's difference from UTC.
Verify the timestamp is correct.

Related work

puyi/impcassandra

Docker Pull Command
Owner
puyi

Comments (0)