How to use tarantool command <cartridge replicasets join> in docker with multi container?

117 Views Asked by At

I have a test stand with Cartridge cluster. Stand start with docker-compose (use tarantool 2.10.3 docker-image with cartridge-cli inside).

container-1:

  • instance-1-1
  • instance-1-2

container-2:

  • instance-2-1
  • instance-2-2

After starting all instances on the container-1, the BASH script execute commands:

sh# cartridge replicasets join --replicaset group-1 instance-1-1
sh# cartridge replicasets join --replicaset group-2 instance-1-2

All OK

But after starting container-2 and calling the same commands, an error occurs:

sh# cartridge replicasets join --replicaset group-1 instance-2-1
   • Join instance(s) instance-2-1 to replica set group-1
   ⨯ Failed to connect to Tarantool instance: Failed to dial: dial unix /opt/tarantool/tmp/run/test.instance-1-1.control: connect: no such file or directory

In WEB all OK, but I want use CLI for it or something like this (for automatization)

2

There are 2 best solutions below

0
On

The problem seems to be that the cartridge-cli only works with the local instances.yml file. If after starting all containers, I am in the container-1 change instance.yml (adding instances from container-2) then everything works fine. But this is a strange decision.

0
On

As correctly noted, cartridge-cli works locally (on the host where it was running). There are plans to fix this in tt cli, which is currently under development (release scheduled for 2023 Q1) to replace cartridge-cli and tarantoolctl by combining and extending their functionality. See: https://github.com/tarantool/tt#working-with-tt-daemon-experimental