Backend store | Tarantool
Документация на русском языке
поддерживается сообществом

Backend store

Enterprise Edition

Tarantool Cluster Manager is a part of the Enterprise Edition.

Tarantool 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 Setting up a configuration storage to set up a backend store.

Примечание

If you already have the centralized configuration store for your Tarantool clusters, you can use it as a TCM backend store as well.

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: etcd
  etcd:
    endpoints:
      - http://127.0.0.1:2379

If authentication is enabled in etcd, specify storage.etcd.username and storage.etcd.password:

storage:
  provider: etcd
  etcd:
    endpoints:
      - http://127.0.0.1:2379
    username: etcduser
    password: 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: etcd
  etcd:
    endpoints:
      - http://127.0.0.1:2379
    prefix: /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: tarantool
  tarantool:
    addr: http://127.0.0.1:3301

Or:

storage:
  provider: tarantool
  tarantool:
    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: tarantool
  tarantool:
    addr: http://127.0.0.1:3301
    username: tarantooluser
    password: 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: tarantool
  tarantool:
    addr: http://127.0.0.1:3301
    username: tarantooluser
    password: secret
    prefix: /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.

Примечание

To start a clean instance of TCM, remove the working directory of the embedded backend store specified in the storage.etcd.embed.workdir or storage.tarantool.embed.workdir option.

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.provider to tarantool
  • set storage.tarantool.embed.enabled to true
storage:
  provider: tarantool
  tarantool.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: 8080
    storage:
      provider: etcd
      etcd:
        endpoints:
          - http://127.0.0.1:2379
          - http://127.0.0.1:22379
          - http://127.0.0.1:32379
        embed:
          enabled: true
          name: infra1
          endpoints: http://127.0.0.1:2379
          advertises: http://127.0.0.1:2379
          initial-cluster-state: new
          initial-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-1
          peer-endpoints: http://127.0.0.1:12380
          peer-advertises: http://127.0.0.1:12380
          workdir: node1.etcd
    
  • Second instance:

    http.port: 8081
    storage:
      provider: etcd
      etcd:
        endpoints:
          - http://127.0.0.1:2379
          - http://127.0.0.1:22379
          - http://127.0.0.1:32379
        embed:
          enabled: true
          name: infra2
          endpoints: http://127.0.0.1:22379
          advertises: http://127.0.0.1:22379
          initial-cluster-state: new
          initial-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-1
          peer-endpoints: http://127.0.0.1:22380
          peer-advertises: http://127.0.0.1:22380
          workdir: node2.etcd
    
  • Third instance:

    http.port: 8082
    storage:
      provider: etcd
      etcd:
        endpoints:
          - http://127.0.0.1:2379
          - http://127.0.0.1:22379
          - http://127.0.0.1:32379
        embed:
          enabled: true
          name: infra3
          endpoints: http://127.0.0.1:32379
          advertises: http://127.0.0.1:32379
          initial-cluster-state: new
          initial-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-1
          peer-endpoints: http://127.0.0.1:32380
          peer-advertises: http://127.0.0.1:32380
          workdir: node3.etcd
    

To set up a cluster from embedded Tarantool-based backend stores:

  1. Specify the Tarantool cluster configuration in storage.tarantool.embed.config (as a plain text) or storage.tarantool.embed.config-file (as a YAML file).
  2. Assign an instance name from this configuration to each instance using storage.tarantool.embed.args to 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: 8080
    storage:
      provider: tarantool
      tarantool:
        addrs:
          - http://127.0.0.1:3301
          - http://127.0.0.1:3302
          - http://127.0.0.1:3303
        embed:
          enabled: true
          config-filename: config.yml
          workdir: node1.tarantool
          args:
            - --name
            - instance-001
            - --config
            - config.yml
    
  • Second instance:

    http.port: 8081
    storage:
      provider: tarantool
      tarantool:
        addrs:
          - http://127.0.0.1:3301
          - http://127.0.0.1:3302
          - http://127.0.0.1:3303
        embed:
          enabled: true
          config-filename: config.yml
          workdir: node2.tarantool
          args:
            - --name
            - instance-002
            - --config
            - config.yml
    
  • Third instance:

    http.port: 8082
    storage:
      provider: tarantool
      tarantool:
        addrs:
          - http://127.0.0.1:3301
          - http://127.0.0.1:3302
          - http://127.0.0.1:3303
        embed:
          enabled: true
          config-filename: config.yml
          workdir: node3.tarantool
          args:
            - --name
            - instance-003
            - --config
            - config.yml
    
Нашли ответ на свой вопрос?
Обратная связь