Backend store
Тarantool Cluster Manager uses an underlying data store (backend store) for its entities: users, roles, cluster connections, settings, and other objects that you manipulate in TCM. The backend store can be either an etcd or a Tarantool cluster.
For better reliability and scalability, the backend store works independently from TCM. For example, it can be the same ectd or Tarantool cluster that you use as a centralized configuration storage. This makes TCM stateless: all objects created or modified in its web UI are saved to the backend store, and nothing is stored inside the TCM instances themselves. Any number of instances can duplicate each other when connected to the same backend store. If you stop all instances, the store still contains their objects. You can continue working with them right after starting a new instance.
In addition to using an external backend store, you can run TCM with an embedded etcd or Tarantool instance to use as the backend store.
On this page, you will learn to connect TCM to backend stores of both types, or start TCM with an embedded backend store.
The TCM backend store requires the same configuration as Tarantool centralized configuration storage. Follow the instructions in centralized_configuration_storage_set_up to set up a backend store.
The TCM's connection to its backend store is configured using the
storage.* configuration options.
The storage.provider
option selects the store type. It can be either etcd or tarantool.
To use an etcd cluster as a TCM backend store, set the
storage.provider option to etcd and specify connection parameters in
storage.etcd.* options. A minimal etcd configuration includes the
storage endpoints:
storage:provider: etcdetcd:endpoints:- http://127.0.0.1:2379
If authentication is enabled in etcd, specify storage.etcd.username
and storage.etcd.password:
storage:provider: etcdetcd:endpoints:- http://127.0.0.1:2379username: etcduserpassword: secret
The TCM data is stored in etcd under the prefix specified in
storage.etcd.prefix. By default, the prefix is /tcm. If you want to
change it or store data of different TCM instances separately in one
etcd cluster, set the prefix explicitly:
storage:provider: etcdetcd:endpoints:- http://127.0.0.1:2379prefix: /tcm2
Other storage.etcd.* options configure various aspects of the etcd
store connection, such as network timeouts and limits or TLS parameters.
For the full list of the etcd TCM backend store options, see the
TCM configuration reference.
To use a Tarantool cluster as a TCM backend store, set the
storage.provider option to tarantool and specify connection
parameters in storage.tarantool.* options. A minimal configuration
includes the one or more addresses of the backend store instances:
storage:provider: tarantooltarantool:addr: http://127.0.0.1:3301
Or:
storage:provider: tarantooltarantool:addrs:- http://127.0.0.1:3301- http://127.0.0.1:3302- http://127.0.0.1:3303
If authentication is enabled in the backend store, specify
storage.tarantool.username and storage.tarantool.password:
storage:provider: tarantooltarantool:addr: http://127.0.0.1:3301username: tarantooluserpassword: secret
The TCM data is stored in the Tarantool-based backend store under the
prefix specified in storage.tarantool.prefix. By default, the prefix
is /tcm. If you want to change it or store data of different TCM
instances separately in one Tarantool cluster, set the prefix
explicitly:
storage:provider: tarantooltarantool:addr: http://127.0.0.1:3301username: tarantooluserpassword: secretprefix: /tcm2
Other storage.tarantool.* options configure various aspects of TCM
connection to the Tarantool-based backend store, such as network
timeouts and limits or TLS parameters. For the full list of the
Tarantool-based TCM backend store options, see the
TCM configuration reference.
For development purposes, you can start TCM with an embedded backend store. This is useful for local runs when you don't have or don't need an external backend store.
An embedded TCM backend store is a single instance of etcd or Tarantool that is started automatically on the same host during the TCM startup. It runs in the background until TCM is stopped. The embedded backend store is persistent: if you start TCM again with the same backend store configuration, it restores the TCM data from the previous runs.
The embedded backend store parameters are configured using the
storage.etcd.embed.* options for etcd or storage.tarantool.embed.*
options for a Tarantool-based store.
To start TCM with an embedded etcd with default settings, set
storage.etcd.embed.enabled to true and leave other storage.*
options default:
storage.etcd.embed.enabled: true
You can use the following call to get TCM running with embedded etcd without a configuration file:
$ tcm --storage.etcd.embed.enabled
To start TCM with an embedded Tarantool storage with default settings:
- set
storage.providertotarantool - set
storage.tarantool.embed.enabledtotrue
storage:provider: tarantooltarantool.embed.enabled: true
With command-line arguments:
$ tcm --storage.provider=tarantool --storage.tarantool.embed.enabled
You can tune the embedded backend store, for example, enable and
configure TLS on it or change its working directories or startup
arguments. To set specific parameters, specify the corresponding
storage.etcd.embed.* or storage.tarantool.embed.* options. For the
full list of configuration options of embedded backend stores, see the
TCM configuration reference.
To simulate the production environment, you can form a distributed multi-instance cluster from embedded stores of multiple TCM instances. To do this, configure each TCM instance's embedded store to join each other.
For etcd, provide the embedded store clustering parameters
storage.etcd.embed.* and specify the endpoints in
storage.etcd.endpoints. The options that configure embedded etcd
mostly match the etcd configuration options. For more information about
these options, see the etcd
documentation.
Below are example configurations of three TCM instances that start with embedded etcd instances and form an etcd cluster from them:
-
First instance:
http:port: 8080storage:provider: etcdetcd:endpoints:- http://127.0.0.1:2379- http://127.0.0.1:22379- http://127.0.0.1:32379embed:enabled: truename: infra1endpoints:- http://127.0.0.1:2379advertises:- http://127.0.0.1:2379initial-cluster-state: newinitial-cluster: "infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380"initial-cluster-token: etcd-cluster-1peer-endpoints:- http://127.0.0.1:12380peer-advertises:- http://127.0.0.1:12380workdir: node1.etcd -
Second instance:
http:port: 8081storage:provider: etcdetcd:endpoints:- http://127.0.0.1:2379- http://127.0.0.1:22379- http://127.0.0.1:32379embed:enabled: truename: infra2endpoints:- http://127.0.0.1:22379advertises:- http://127.0.0.1:22379initial-cluster-state: newinitial-cluster: "infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380"initial-cluster-token: etcd-cluster-1peer-endpoints:- http://127.0.0.1:22380peer-advertises:- http://127.0.0.1:22380workdir: node2.etcd -
Third instance:
http:port: 8082storage:provider: etcdetcd:endpoints:- http://127.0.0.1:2379- http://127.0.0.1:22379- http://127.0.0.1:32379embed:enabled: truename: infra3endpoints:- http://127.0.0.1:32379advertises:- http://127.0.0.1:32379initial-cluster-state: newinitial-cluster: "infra1=http://127.0.0.1:12380,infra2=http://127.0.0.1:22380,infra3=http://127.0.0.1:32380"initial-cluster-token: etcd-cluster-1peer-endpoints:- http://127.0.0.1:32380peer-advertises:- http://127.0.0.1:32380workdir: node3.etcd
To set up a cluster from embedded Tarantool-based backend stores:
- Specify the Tarantool cluster configuration in
storage.tarantool.embed.config(as a plain text) orstorage.tarantool.embed.config-file(as a YAML file). - Assign an instance name from this configuration to each instance
using
storage.tarantool.embed.argsto each embedded store.
Below are example configurations of three TCM instances that start with embedded Tarantool-based backend stores and form a cluster from them:
-
First instance:
http:port: 8080storage:provider: tarantooltarantool:addrs:- http://127.0.0.1:3301- http://127.0.0.1:3302- http://127.0.0.1:3303embed:enabled: trueexecutable: /path/to/execfile/tarantool-enterprise/tarantoolconfig-filename: config.ymlworkdir: node1.tarantoolargs:- --name- instance-001- --config- config.yml -
Second instance:
http:port: 8081storage:provider: tarantooltarantool:addrs:- http://127.0.0.1:3301- http://127.0.0.1:3302- http://127.0.0.1:3303embed:enabled: trueexecutable: /path/to/execfile/tarantool-enterprise/tarantoolconfig-filename: config.ymlworkdir: node2.tarantoolargs:- --name- instance-002- --config- config.yml -
Third instance:
http:port: 8082storage:provider: tarantooltarantool:addrs:- http://127.0.0.1:3301- http://127.0.0.1:3302- http://127.0.0.1:3303embed:enabled: trueexecutable: /path/to/execfile/tarantool-enterprise/tarantoolconfig-filename: config.ymlworkdir: node3.tarantoolargs:- --name- instance-003- --config- config.yml