NAME

tntcompat - tarantool 1.5 to 1.6 stream database converter

SYNOPSIS

tntcompat myconfig.conf

DESCRIPTION

Binds server that listen connections from tarantool 1.6. Send them tarantool 1.5 database from local disk.

Use the utility at the host with tarantool 1.5 database.

CONFIG file

The config is a Perl hash that contains several fields. Example:

$ cat myconfig.conf
# vim: set ft=perl :
{
    host        => '127.0.0.1',
    port        => 3456,

    user        => 'username',
    password    => 'password',

    snap_dir    => '/srv/mytarantool1.5/snap_dir/',
    wal_dir     => '/srv/mytarantool1.5/wal_dir/',
    server_uuid => '80c88296-f1db-4aab-ad9c-b4e3f8511d16',
    bootstrap   => 'tntcompat/bootsrap.snap',

    schema => {
        0   => {
            name            => 'users',
            default_field_type    => 'STR',
            fields  => [
                'id',
                'name'
            ],

            indexes => [
                {
                    name => 'pk',
                    fields => 'id'
                },
            ]
        },
        1   => {
            name            => 'roles',
            default_field_type    => 'STR',
            fields  => [
                {
                    name    => 'id',
                    type    => 'STR',
                },
                'name',
                {
                    name    => 'options',
                    type    => 'JSON',
                }
            ],

            indexes => [
                {
                    name    => 'pk',
                    fields  => 'id'
                },
                {
                    name    => 'name',
                    fields  => [ 'name' ],
                    unique  => 1
                }
            ]
        },
        # here can be the other spaces
    }
}

Config options

host, port, user, password

Server's bind and auth options.

snap_dir, wal_dir

Paths to tarantool 1.5 files.

skip_spaces

Array with space numbers that should not be sent to 1.6.

schema

A hash that describes 1.5 database structure (and how to convert it to 1.6). Each 1.5 space must be defined in this hash (exclude spaces in skip_spaces).

Example:

schema => {
    0   => {
        name            => 'services',
        default_field_type    => 'STR',
        fields  => [
            {
                name    => 'sid',
                type    => 'STR',
            },
            {
                name    => 'title',
                type    => 'STR',
            },
            {
                name    => 'balance',
                type    => 'NUM', # 'MONEY'
            },
            {
                name    => 'locked_balance',
                type    => 'NUM', # 'MONEY',
            },
            {
                name    => 'cfg',
                type    => 'JSON',
            },
            {
                name    => 'disabled_flags',
                type    => 'NUM',
            }
        ],

        indexes => [
            {
                name => 'sid',
                fields => 'sid'
            },
            {
                name => 'title',
                fields => [ 'title', 'name' ]
                unique => 1
            },
            {
                name => 'disabled_flags',
                fields => 'disabled_flags'
            }
        ]
    },
    # here can be the other spaces
}

Each hash of space can contain the fields:

name

Name of the space. If the field is absent, tntcompat will use pattern "space_$spaceno".

default_field_type

Type of fields that are not described by the hash.

fields

Field's definitions. Each item of the list can be:

scalar

Name of the field.

hash

Full definition of the field. The hash can contain field name - name of the field (if the field is absent, tntcompat will use pattern "field_$fieldno") and type - type of field.

Now tntcompat provides the following types:

NUM

32-bit unsigned.

NUM64

64-bit unsigned.

STR

String

JSON

JSON string. The string will be decoded to object and placed as object in 1.6.

indexes

Array of index definitions. The first index always forced as unique=1.

Each index can contain the following fields:

name

Name of the index.

fields

Name or name of indexed fields (see fields definition).

unique

True if the index is unique.

DEBUG

tntcompat prints its log to STDERR. By default the feature is disabled. Set environment variable DEBUG to value 1 to enable logging.

Also the utility is not a daemon. If You want to start it from Your init, You can use special wrappers like start-stop-daemon, runit, etc.

COPYRIGHT

Copyright (C) 2014, Dmitry E. Oboukhov mailto:unera@debian.org

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available.