1

我开始分片时出错

tarantool 和操作系统版本: main/101/tarantoolctl C> version 1.6.8-654-ge91080f开启ubuntu-16.04 LTS

在配置文件 roman@zotac-pc:~$ egrep -v "^[[:space:]]*--|^$" /etc/tarantool/instances.enabled/test.lua

box.cfg {
    listen = 3301;
    slab_alloc_arena = 0.5;
    slab_alloc_minimal = 16;
    slab_alloc_maximal = 1048576;
    slab_alloc_factor = 1.06;
    snapshot_period = 0;
    snapshot_count = 6;
    panic_on_snap_error = true;
    panic_on_wal_error = true;
    rows_per_wal = 5000000;
    snap_io_rate_limit = nil;
    wal_mode = "none";
    wal_dir_rescan_delay = 2.0;
    io_collect_interval = nil;
    readahead = 16320;
    log_level = 5;
    logger_nonblock = true;
    too_long_threshold = 0.5;
}
local function bootstrap()
    local space = box.schema.create_space('test')
    space:create_index('primary')
    box.schema.user.grant('guest', 'read,write,execute', 'universe')
    box.schema.user.create('test', { password = 'test' })
    box.schema.user.grant('test', 'replication')
    box.schema.user.grant('test', 'read,write,execute', 'universe')
end
box.once('test-1.0', bootstrap)
local shard = require('shard')
local shards = {
    servers = {
        { uri = [[127.0.0.1:3301]]; zone = [[0]]; };
        { uri = [[127.0.0.1:3302]]; zone = [[1]]; };
    };
    login = 'test';
    password = 'test';
    redundancy = 1;
    binary = '127.0.0.1:3301';
    monitor = false;
}
shard.init(cfg)

roman@zotac-pc:~$ 日志文件中的示例错误:

main/101/test I> Sharding initialization started...
main/101/test tarantoolctl:422 E> Start failed: /usr/share/tarantool/connpool.lua:316: attempt to index field 'configuration' (a nil value)
main C> entering the event loop
4

1 回答 1

2

在 /etc/tarantool/../example.lua 中来自 ubuntu 包函数 shard.init(cfg) 需要替换 shard.init(shards) 下面的代码工作正常:

local shard = require('shard')
local shards = {
    servers = {
        { uri = [[127.0.0.1:3301]]; zone = [[0]]; };
        { uri = [[127.0.0.1:3302]]; zone = [[1]]; };
    };
    login = 'test';
    password = 'test';
    redundancy = 1;
    binary = '127.0.0.1:3301';
    monitor = false;
}
shard.init(shards)
于 2016-05-03T19:50:01.703 回答