Giter Site home page Giter Site logo

whisper2cyanite's Introduction

whisper2cyanite

GitHub license Build Status Dependencies Status

whisper2cyanite is a tool for migrating data from Whisper to Cyanite.

Table of Contents

Building

Dependencies

whisper2cyanite is a Clojure application and uses Leiningen as build tool. Building whisper2cyanite needs a working Leiningen installation, as well as JDK.

Building a Standalone JAR-file

lein uberjar

Built JAR-file will be placed in the target/uberjar directory. You can launch the tool by running ./whisper2cyanite command.

Building a Deb-package

Building whisper2cyanite deb-package needs installed dpkg-dev and fakeroot packages.

lein fatdeb

Built package will be placed in the target directory.

Usage

Quick Help

whisper2cyanite [options] migrate <directory | whisper_file | filelist_file> <tenant> <cassandra_host,...> <elasticsearch_url>
whisper2cyanite [options] validate <directory | whisper_file | filelist_file> <tenant> <cassandra_host,...> <elasticsearch_url>
whisper2cyanite [options] calc-size <directory | whisper_file | filelist_file> <tenant>
whisper2cyanite list-files <directory>
whisper2cyanite [options] list-paths <directory>
whisper2cyanite info <whisper_file>
whisper2cyanite [options] fetch <whisper_file> <rollup>
whisper2cyanite help

See commands, arguments and options for more details.

Commands

migrate

Migrate a Whisper database to a metric store, a path store or both.

whisper2cyanite migrate [options] <directory | whisper_file | filelist_file> tenant cassandra_host(s) elasticsearch_url

Available options: cassandra-batch-rate, cassandra-batch-size, cassandra-channel-size, cassandra-keyspace, cassandra-options, disable-log, disable-metric-store, disable-path-store, disable-progress, elasticsearch-channel-size, elasticsearch-index, errors-file, from, jobs, log-file, log-level, min-ttl, rollups, root-dir, run, to, stop-on-error.

See example of usage here.

validate

Validate a metric store, a path store or both, comparing points and paths from a Whisper database and Cyanite storages.

whisper2cyanite validate [options] <directory | whisper_file | filelist_file> tenant cassandra_host(s) elasticsearch_url

Available options: cassandra-keyspace, cassandra-options, disable-log, disable-metric-store, disable-path-store, disable-progress, elasticsearch-index, errors-file, from, jobs, log-file, log-level, min-ttl, rollups, root-dir, to, stop-on-error.

See example of usage here.

calc-size

Calculate Cassandra data size from a Whisper database.

whisper2cyanite calc-size [options] <directory | whisper_file | filelist_file> tenant

Available options: disable-progress, jobs, rollups, root-dir.

See example of usage here.

list-files

List Whisper database files taken from a source.

whisper2cyanite list-files <directory | whisper_file | filelist_file>

See example of usage here.

list-paths

List paths taken from a source. The root-dir option can be passed to have correct paths being computed from filenames.

whisper2cyanite list-paths [options] <directory | whisper_file | filelist_file>

Available options: root-dir.

See example of usage here.

info

whisper2cyanite info whisper_file

Show Whisper database file information.

See example of usage here.

fetch

Fetch timeseries from a Whisper database file.

whisper2cyanite fetch [options] whisper_file

Available options: from, to.

See example of usage here.

help

whisper2cyanite help

Show help.

Arguments

directory

A directory where Whisper database files are located.

whisper_file

A Whisper database file (.wsp).

filelist_file

A plain text file with a list of Whisper database files (.wsp). One file per line.

tenant

A tenant name.

cassandra_host(s)

A comma-separated list of Cassandra hosts.

Example: cass1.example.org,cass2.example.org

elasticsearch_url

An Elasticsearch REST service URL.

Example: http://es.example.org:9200

rollup

A rollup (seconds per data point).

Example: 60

Options

Options in alphabet order:

cassandra-batch-rate

--cassandra-batch-rate RATE

Set the Cassandra batch rate (batches per second, 1-100).

Throttling is not used by default.

cassandra-batch-size

--cassandra-batch-size SIZE

Set the Cassandra batch size in points.

Default: 1000

cassandra-channel-size

--cassandra-channel-size SIZE

Set the Cassandra channel size in points.

Default: 500000

cassandra-keyspace

--cassandra-keyspace KEYSPACE

Set the Cassandra keyspace.

Default: metric

cassandra-options

-O, --cassandra-options OPTIONS

Set Cassandra options. See Alia documentation for more details.

Example: "{:compression :lz4}"

disable-metric-store

--disable-metric-store

Disable writing to the metric store.

disable-path-store

--disable-path-store

Disable writing to the path store.

disable-progress

-P, --disable-progress

Disable the progress bar.

elasticsearch-channel-size

--elasticsearch-channel-size SIZE

Set the Elasticsearch channel size.

Default: 10000

elasticsearch-index

--elasticsearch-index INDEX

Set the Elasticsearch index.

Default: cyanite_paths

errors-file

-e, --errors-file FILE

Dump a list of files during processing which the errors occurred.

from

-f, --from FROM

Set from time in the Unix (POSIX, epoch) time format.

Example: 1420070400

jobs

-j, --jobs JOBS

Set the number of jobs to run simultaneously.

log-file

-l, --log-file FILE

Set the log file.

Default: whisper2cyanite.log

log-level

-L, --log-level LEVEL

Set the Log level.

Available log levels: all, trace, debug, info, warn, error, fatal, off.

Default: info

min-ttl

-T, --min-ttl TTL

Set the minimal TTL. Points having calculated TTL values below the minimal TTL will not be migrated. It is useful to reduce the number of migrated points.

Default: 3600

rollups

-R, --rollups ROLLUPS

Define rollups.

Format: <seconds_per_point[:retention],...>

Example: 60,300:31536000

root-dir

-D, --root-dir DIRECTORY

Set the root directory.

run

-r, --run

Force a normal run. Dry run using on default.

to

-t, --to TO

Set until time in the Unix (POSIX, epoch) time format.

Example: 1421280000

stop-on-error

-S, --stop-on-error

Stop on the first non-fatal error.

Usage Scenarios

Inspecting

Before migrating data, you may want to inspect the Whisper database.

Listing Paths from a Whisper Database

Listing paths taken from the /var/lib/whisper/ directory in alphabet order:

whisper2cyanite list-paths /var/lib/whisper/

See command list-paths for more details.

Estimating Cassandra Data Size from a Whisper Database

Estimating Cassandra data size from a Whisper database located in the /var/lib/whisper/ directory:

whisper2cyanite calc-size --jobs 8 /var/lib/whisper/ my_tenant

Using 8 jobs to speed up the process. Tenant is named as my_tenant.

See command calc-size for more details.

Getting Information About a Whisper Database File

Getting information about the /var/lib/whisper/requests/nginx/access.wsp Whisper database file

whisper2cyanite info /var/lib/whisper/requests/nginx/access.wsp

Sample output:

Aggregation method: average
Max retention:      31536000
X files factor:     0.5
Archives:
  Archive 0:
    Seconds per point: 60
    Retention:         5356800
    Points:            89280
    Offset:            40
    Size:              1071360
  Archive 1:
    Seconds per point: 900
    Retention:         31536000
    Points:            35040
    Offset:            1071400
    Size:              420480

See command info for more details.

Fetching Timeseries from a Whisper Database File for a Predetermined Period

Fetch timeseries between 1428407040 (07 Apr 2015 11:44:00 GMT) and 1433757900 (08 Jun 2015 10:05:00 GMT) from rollup 60 of the /var/lib/whisper/requests/nginx/access.wsp Whisper database file:

whisper2cyanite --from 1428407040 --to 1433757900 fetch \
  /var/lib/whisper/requests/nginx/access.wsp 60

See command fetch for more details.

Migrating

Migrating a Whole Database

Typical command for migrating a whole Whisper database to Cyanite looks like this:

whisper2cyanite --run --jobs 8 --rollups 60:5356800,900:6220800 --min-ttl 18000 \
  --cassandra-options "{:compression :lz4}" --errors-file error-files.lst \
  migrate /var/lib/whisper/ my_tenant cass1.example.org,cass2.example.org \
  http://es.example.org:9200

This command means:

  • Run in the normal mode, not in the dry mode which using on default
  • Use 8 jobs
  • Define two rollups: 1m rollup with 62d retention time and 15m rollup with 720d retention time
  • Set minimum TTL to 18000s (5h)
  • Set Cassandra options: use compression algorithm LZ4
  • Dump a list of files during processing which errors occurred to the error-files.lst
  • Migrate the Whisper database placed in the /var/lib/whisper/. Database root will be set to this directory automatically.
  • Set the tenant to my_tenant
  • Use two Cassandra nodes: cass1.example.org and cass2.example.org
  • Use the Elasticsearch node on http://es.example.org:9200

See command migrate for more details.

Retrying to Migrate After Non-fatal Errors Occurred

whisper2cyanite --run --jobs 8 --rollups 60:5356800,900:6220800 --min-ttl 18000 \
  --cassandra-options "{:compression :lz4}" --root-dir /var/lib/whisper/ \
  migrate error-files.lst my_tenant cass1.example.org,cass2.example.org \
  http://es.example.org:9200

This command means same as above but:

  • Set database root to the /var/lib/whisper/ directory
  • Read files to migrate from the errorfiles.lst file

See command migrate for more details.

Migrating Paths Taken from a Database Subtree

Dumping names of Whisper database files to the path-files.lst file:

whisper2cyanite list-files /var/lib/whisper/requests/nginx > path-files.lst

Reading the path-files.lst file and migrating paths taken from there. According to previous command, only paths from the /var/lib/whisper/requests/nginx directory (the requests.nginx.* path store subtree) will be migrated. Metric store operations are disabled.

whisper2cyanite --run --jobs 8 --disable-metric-store --root-dir \
  /var/lib/whisper/ migrate path-files.lst my_tenant cass1.example.org \
  http://es.example.org:9200

See commands list-files and migrate for more details.

Migrating Metrics for a Predetermined Period and a Single Rollup from a Database File

Migrating metrics from the /var/lib/whisper/requests/nginx/access.wsp file for period from 1420070400 (01 Jan 2015 00:00:00) until 1421280000 (15 Jan 2015 00:00:00). All rollups except 60 are ignored. Path store operations are disabled.

whisper2cyanite --run --rollups 60:5356800 --disable-path-store \
  --root-dir /var/lib/whisper/ --from 1420070400 --to 1421280000 migrate \
  /var/lib/whisper/requests/nginx/access.wsp my_tenant \
  cass1.example.org,cass2.example.org http://es.example.org:9200

See command migrate for more details.

Validating

Using the command validate is very similar to using the command migrate.

Validating a Whole Database

Typical command for validating a whole database:

whisper2cyanite --jobs 8 --cassandra-options "{:compression :lz4}" \
  --errors-file error-files.lst validate /var/lib/whisper/ my_tenant \
  cass1.example.org,cass2.example.org http://es.example.org:9200

See command validate for more details.

Validating Paths Taken from a Database Subtree

Validating paths from the /var/lib/whisper/requests/nginx directory (the requests.nginx.* path store subtree):

whisper2cyanite --jobs 8 --disable-metric-store --root-dir /var/lib/whisper/ \
  validate /var/lib/whisper/requests/nginx my_tenant cass1.example.org \
  http://es.example.org:9200

See command validate for more details.

Validating Metrics of a Single Path

Validating metrics from the /var/lib/whisper/requests/nginx/access.wsp file:

whisper2cyanite --disable-path-store --root-dir /var/lib/whisper/ validate \
  /var/lib/whisper/requests/nginx/access.wsp my_tenant \
  cass1.example.org,cass2.example.org http://es.example.org:9200

See command validate for more details.

License

whisper2cyanite is covered by MIT License

Thanks

Thanks to Pierre-Yves Ritschard aka @pyr for his work on Cyanite

whisper2cyanite's People

Contributors

kirillk77 avatar

Stargazers

Max Penet avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.