This text describes deployments for orchestrator on raft.
This complements general deployment documentation.
You may choose between using MySQL and SQLite. See backend configuration.
-
For MySQL:
- The backend servers will be standalone. No replication setup. Each
orchestratornode will interact with its own dedicated backend server. - You must have a
1:1mappingorchestrator:MySQL. - Suggestion: run
orchestratorand its dedicated MySQL server on same box. - Make sure to
GRANTprivileges for theorchestratoruser on each backend node.
- The backend servers will be standalone. No replication setup. Each
-
For
SQLite:SQLiteis bundled withorchestrator.- Make sure the
SQLite3DataFileis writable by theorchestratoruser.
orchestrator high availability is gained by using raft. You do not need to take care of backend DB high availability.
-
Deploy the
orchestratorservice onto service boxes. As suggested, you may want to putorchestratorservice andMySQLservice on same box. If usingSQLitethere's nothing else to do. -
Consider adding a proxy on top of the service boxes; the proxy would redirect all traffic to the leader node. There is one and only one leader node, and the status check endpoint is
/api/leader-check.- Clients may only interact with healthy raft nodes.
- Simplest is to just interact with the leader. Setting up a proxy is one way to ensure that. See proxy: leader section.
- Otherwise all healthy raft nodes will reverse proxy your requests to the leader. See proxy: healthy raft nodes section.
- Clients may only interact with healthy raft nodes.
-
Nothing should directly interact with a backend DB. Only the leader is capable of coordinating changes to the data with the other
raftnodes. -
orchestratornodes communicate between themselves onDefaultRaftPort. This port should be open to allorchestratornodes, and no one else needs to have access to this port.
To interact with orchestrator from shell/automation/scripts, you may choose to:
-
Directly interact with the HTTP API
- You may only interact with the leader. A good way to achieve this is using a proxy.
-
Use the orchestrator-client script.
-
Deploy
orchestrator-clienton any box from which you wish to interact withorchestrator. -
Create and edit
/etc/profile.d/orchestrator-client.shon those boxes to read:ORCHESTRATOR_API="http://your.orchestrator.service.proxy:80/api"or
ORCHESTRATOR_API="http://your.orchestrator.service.host1:3000/api http://your.orchestrator.service.host2:3000/api http://your.orchestrator.service.host3:3000/api"In the latter case you will provide the list of all
orchestratornodes, and theorchestrator-clientscript will automatically figure out which is the leader. With this setup your automation will not need a proxy (though you may still wish to use a proxy for web interface users).Make sure to chef/puppet/whatever the
ORCHESTRATOR_APIvalue such that it adapts to changes in your environment.
-
-
The
orchestratorcommand line client will refuse to run given a raft setup, since it interacts directly with the underlying database and doesn't participate in the raft consensus, and thus cannot ensure all raft members will get visibility into it changes.- Fortunately
orchestrator-clientprovides an almost identical interface as the command line client. - You may force the command line client to run via
--ignore-raft-setup. This is a "I know what I'm doing" risk you take. If you do choose to use it, then it makes more sense to connect to the leader's backend DB.
- Fortunately
As noted, a single orchestrator node will assume leadership. Only the leader will:
- Run recoveries
However all nodes will:
- Discover (probe) your MySQL topologies
- Run failure detection
- Register their own health check
Non-leader nodes must NOT:
- Run arbitrary commands (e.g.
relocate,begin-downtime) - Run recoveries per human request.
- Serve client HTTP requests (but some endpoints, such as load-balancer and health checks, are valid).
In the above there are three orchestrator nodes in a raft cluster, each using its own dedicated database (either MySQL or SQLite).
orchestrator nodes communicate with each other.
Only one orchestrator node is the leader.
All orchestrator nodes probe the entire MySQL fleet. Each MySQL server is probed by each of the raft members.
Start the node, start the MySQL service if applicable, start the orchestrator service. The orchestrator service should join the raft group, get a recent snapshot, catch up with raft replication log and continue as normal.
Such that the backend database is completely empty/missing.
- If
SQLite, nothing to be done. The node will just join theraftgroup, get a snapshot from one of the active nodes, catch up withraftlog and run as normal. - If
MySQL, the same will be attempted. However, theMySQLserver will have to have the privileges fororchestratorto operate. So if this is a brand new server, those privileges are likely to not be there. As example, ourpuppetsetup periodically ensures privileges are set on our MySQL servers. Thus, when a new server is provisioned, nextpuppetrun lays the privileges fororchestrator.puppetalso ensures theorchestratorservice is running, and so, pending some time,orchestratorcan automatically join the group.
If you choose to, you may also provision new boxes by cloning your existing backend databases using your favorite backup/restore or dump/load method.
This is perfectly valid though not required.
-
If
MySQL, run backup/restore, either logical or physical. -
If
SQLite, run.dump+ restore, see 10. Converting An Entire Database To An ASCII Text File. -
Start the
orchestratorservice. It should catch up withraftreplication log and join theraftcluster.
Assuming RaftNodes: ["node1", "node2", "node3"], and you wish to replace node3 with nodeX.
- You may take down
node3, and theraftcluster will continue to work as long asnode1andnode2are good. - Create
nodeXbox. Generate backend db data (see above). - On
node1,node2andnodeXreconfigureRaftNodes: ["node1", "node2", "nodeX"]. - Start
orchestratoronnodeX. It will be refused and will not join the cluster becausenode1andnode2are not yet aware of the change. - Restart
orchestratoronnode1. - Restart
orchestratoronnode2.- All three nodes should form a happy cluster at this time.
