Distributed Service Execution
torero's architecture allows for a highly available, scalable deployment to ensure that your services always have enough resources to execute as well as increasing the likelihood that they can be run in the event of an outage.
Clusters Overview
torero supports an architecture model where the management of torero resources and handling of incoming requests is handled by one or more torero 'core' servers and the actual service execution is delegated to special torero 'runner' nodes. A group of torero core/runner nodes that share the same resources (services, decorators, etc) is known as a 'cluster'.
A simple torero cluster architecture with a single core server as well as three runner nodes can be seen below. In order to utilize torero's runners, an etcd database must be configured so that database resources can be shared within your cluster. It should be noted that all runner nodes must be able to connect to the etcd database as well as the torero core server that lives in the 'control plane'.
Similarly to a regular torero server deployment, a torero client will send all of its requests to the core torero server.
Configuring A Simple Cluster
The sections below give an overview on how to configure a torero cluster's etcd database, core server, runners, and torero client.
Etcd Database
More information on configuring an etcd server/etcd cluster (different from a torero cluster) can be found on this guide.
torero Core Server
- Ensure that your torero server is configured to connect to your etcd server/etcd cluster (different from a torero cluster).
You will want to set the configuration variable
TORERO_STORE_ETCD_HOSTS
to thehostname:port
of your etcd server. If you are running an etcd cluster, set it to a space separated list of the hosts you have exposed in your etcd cluster e.g.hostname1:port hostname2:port
. Additionally, ensure that all of theTORERO_STORE_ETCD_*
configuration variables defined on this configuration variables document are correctly set for your particular cluster. If you need to migrate data between a local database to an etcd database, please reference thetorero db migrate
commands. - Ensure your cluster's ID is set to your desired value via the configuration variable
TORERO_APPLICATION_CLUSTER_ID
. It should be noted that if you switch your cluster ID, all torero resources will now be pulled from/saved to a different namespace within your database. This design allows for architectures where multiple torero clusters that share the same etcd database. - Set the configuration variable
TORERO_APPLICATION_MODE
toserver
. For more information on application modes, please refer to the application modes guide. - Switch the configuration variable
TORERO_SERVER_DISTRIBUTED_EXECUTION
totrue
. This will ensure that the torero server will now always round-robin between torero runners that are also registered to the same etcd database and share the sameTORERO_APPLICATION_CLUSTER_ID
. - Ensure that all the remaining
TORERO_SERVER_*
configuration variables are correctly set to allow your torero client to send requests to your server. - Run
torero server
. Your torero server will listen for requests from a correctly configured torero client as it normally would.
torero Runners
These same steps shown below can be followed for as many torero runners that you have.
- Set all of the
TORERO_STORE_ETCD_*
configuration variables to the same values as your torero core server. - Set
TORERO_APPLICATION_CLUSTER_ID
to the same value as your torero core server. - Set
TORERO_APPLICATION_MODE
torunner
. - Set
TORERO_RUNNER_*
configuration variables to the appropriate values to ensure that your runner nodes can properly communicate with the core server. - Run
torero runner
and look for an info level log that saysregistered runner with etcd database
.
torero Client
As described in the application modes guide, torero clients are used to send requests to torero servers.
- Ensure that your
TORERO_CLIENT_HOST
configuration variable is set to the hostname of your torero server and that all otherTORERO_CLIENT_*
configuration variables are correctly configured to connect to your torero server. - Login to the torero server by following the login guide.
- Run
torero get runners
on the client to see a list of all runners that are currently online and registered to the cluster. - Run requests as you normally would against the server. Observe that when services are executed, corresponding logs are present on the actual runner node(s).
Multiple Cluster Architectures
The Configuring A Simple Cluster section above shows how a single torero cluster can
be configured. If desired, multiple clusters can be deployed. Each cluster will need its own unique TORERO_APPLICATION_CLUSTER_ID
.
This can be useful in scenarios where runners need to be close to the actual infrastructure that they are sending requests
to if firewalls are a consideration. A torero client can then send requests to the different clusters to execute
the different services that pertain to each cluster.
The diagram shown below shows a scenario where each cluster gets its own etcd database. This is entirely optional as multiple clusters can share the same etcd database if desired. It should be noted that clusters that share an etcd database will not share actual database resources (services, decorators, etc) as resources are given their own namespace in the database per cluster ID.