Created
October 4, 2018 11:56
-
-
Save R-omk/163950ced360dd3321ef5acc9a0053ed to your computer and use it in GitHub Desktop.
docker swarm tarantool test cluster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- other options setup in tarantool-entrypoint.lua see: https://github.com/tarantool/docker | |
box.cfg { | |
log_level = tonumber(os.getenv("TARANTOOL_LOG_LEVEL")); | |
replicaset_uuid = os.getenv("TARANTOOL_REPLICASET_UUID"); | |
instance_uuid = os.getenv("TARANTOOL_INSTANCE_UUID"); | |
memtx_max_tuple_size = 1048576 + 200; | |
force_recovery = true; | |
checkpoint_interval = 30; | |
checkpoint_count = 3; | |
} | |
local log = require("log") | |
local fiber = require("fiber") | |
log.info("Info version %s", box.info.version) | |
log.info("box.info.id %s", box.info.id) | |
box.once( | |
"schema", | |
function() | |
box.schema.space.create("test") | |
box.space.test:create_index("primary", {unique = true, parts = {1, "integer"}}) | |
end | |
) | |
local testspace = box.space.test | |
fiber_test_sleep = 0 | |
fiber_test = | |
fiber.create( | |
function() | |
while true do | |
local status, call_res = | |
pcall( | |
function() | |
local t = fiber.time64(); | |
testspace:upsert({box.info.id, t}, {{"=", 2, t}}) | |
end | |
) | |
if not status then | |
log.warn("call_res err %s", call_res) | |
end | |
fiber.testcancel() | |
fiber.sleep(fiber_test_sleep) | |
-- fiber.yield() | |
end | |
end | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.7' | |
x-tarantool-env: &tarantool-env | |
TARANTOOL_REPLICATION_SOURCE: master@tarantool1:3301,master@tarantool2:3301,master@tarantool3:3301 | |
TARANTOOL_MEMTX_MEMORY: 1073741824 | |
TARANTOOL_USER_NAME: master | |
x-tarantool: &tarantool | |
image: tarantool/tarantool:1.9.2 | |
environment: | |
<<: *tarantool-env | |
deploy: | |
replicas: 1 | |
endpoint_mode: dnsrr | |
restart_policy: | |
condition: on-failure | |
healthcheck: | |
disable: true | |
command: [ "tarantool" , "/opt/tarantool/app.lua"] | |
networks: | |
- tnt_cluster | |
services: | |
tarantool1: | |
<<: *tarantool | |
volumes: | |
- ./app.lua:/opt/tarantool/app.lua | |
- tarantool1_cfg:/etc/tarantool/ | |
- tarantool1_data:/var/lib/tarantool | |
tarantool2: | |
<<: *tarantool | |
volumes: | |
- ./app.lua:/opt/tarantool/app.lua | |
- tarantool2_cfg:/etc/tarantool/ | |
- tarantool2_data:/var/lib/tarantool | |
tarantool3: | |
<<: *tarantool | |
volumes: | |
- ./app.lua:/opt/tarantool/app.lua | |
- tarantool3_cfg:/etc/tarantool/ | |
- tarantool3_data:/var/lib/tarantool | |
networks: | |
tnt_cluster: | |
volumes: | |
tarantool1_cfg: | |
tarantool1_data: | |
tarantool2_cfg: | |
tarantool2_data: | |
tarantool3_cfg: | |
tarantool3_data: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
after some time
box.info can show something like
where message can be
and logs like
--