Storing configuration in etcd | Tarantool
Concepts Configuration Storing configuration in etcd

Storing configuration in etcd

Enterprise Edition

Storing configuration in etcd is supported by the Enterprise Edition only.

Tarantool enables you to store configuration data in one place using etcd. To achieve this, you need to define how to access etcd and publish a cluster’s YAML configuration to an etcd server.

To store a cluster’s configuration in etcd, you need to provide etcd connection settings in a local configuration file. These settings are used to publish a cluster’s configuration and show it.

Connection options for etcd should be specified in the config.etcd section of the configuration file. At least, the following options should be specified:

    - http://localhost:2379
    prefix: /example
  • config.etcd.endpoints specifies the list of etcd endpoints.
  • config.etcd.prefix sets a key prefix used to search a configuration. Tarantool searches keys by the following path: <prefix>/config/*. Note that <prefix> should start with a slash (/).

You can also provide additional etcd connection options. In the example below, the following options are configured in addition to an endpoint and key prefix:

    - http://localhost:2379
    prefix: /example
    username: testuser
    password: foobar
      ca_file: ca.crt
        timeout: 3

You can find all the available configuration options in the etcd section.

The tt utility provides the tt cluster command for managing a cluster’s configuration. The tt cluster publish command can be used to publish a cluster’s configuration to etcd.

The example below shows how a layout of the application called app might look:

├── tt.yaml
└── instances.enabled
    └── app
        ├── config.yaml
        ├── cluster.yaml
        └── instances.yml
  • config.yaml contains a local configuration used to connect to etcd.
  • cluster.yaml contains a cluster’s configuration to be published.
  • instances.yml specifies instances to run in the current environment. tt cluster publish ignores the configured instances.

To publish a cluster’s configuration (cluster.yaml) to an etcd server, execute tt cluster publish as follows:

$ tt cluster publish "http://localhost:2379/example" instances.enabled/app/cluster.yaml


You can see a cluster’s configuration using the tt cluster show command.

To publish a cluster’s configuration using the etcdctl utility, use the put command:

$ etcdctl put /example/config/all < cluster.yaml


For etcd versions earlier than 3.4, you need to set the ETCDCTL_API environment variable to 3.

The tt utility is the recommended way to start Tarantool instances. You can learn how to do this from the Starting and stopping instances section.

You can also use the tarantool command to start a Tarantool instance. In this case, you can eliminate creating a local etcd configuration and provide etcd connection settings using the TT_CONFIG_ETCD_ENDPOINTS and TT_CONFIG_ETCD_PREFIX environment variables.

$ export TT_CONFIG_ETCD_ENDPOINTS=http://localhost:2379
$ export TT_CONFIG_ETCD_PREFIX=/example

$ tarantool --name instance001
$ tarantool --name instance002
$ tarantool --name instance003

By default, Tarantool watches etcd keys with the specified prefix for changes in a cluster’s configuration and reloads a changed configuration automatically. If necessary, you can set the config.reload option to manual to turn off configuration reloading:

  reload: 'manual'
    # ...

In this case, you can reload a configuration in an admin console or application code using the reload() function provided by the config module:

Found what you were looking for?