Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
24206c9
orchestrator-agent redesign. Structures
Jan 14, 2020
4eba4ef
agent redesign. Add structures. Change submit-agent to post
Jan 16, 2020
f4d971c
support new agent logic p1. Add seedmethod
Feb 4, 2020
d592efb
Merge branch 'master' into orchestrator_agent_dev
Feb 4, 2020
3c27d3b
agent. refactor seeding p1
Feb 5, 2020
c1f0c5e
agent. refactore agent hosts and seeding p2
Feb 10, 2020
02d7552
agent. refactor agent struct and methods
Feb 11, 2020
0f1af60
agent. new seed process
Feb 12, 2020
9a698bc
update vendor dependencies for dockertest package
Feb 16, 2020
94482da
functional tests for agent + bugfix
Feb 16, 2020
151528e
add tests for seed processing + bugfix
Feb 17, 2020
a8113fe
add more tests + bugfix
Feb 18, 2020
9283bf2
redesign agent tests
Feb 19, 2020
39917f2
add more tests + bugfix
Feb 19, 2020
a2ceb9d
add post-seed-cmd for agent
Feb 20, 2020
31cc75a
add more tests + bugfix
Feb 20, 2020
fed54f4
instance_dao unmarshall count_mysql_snaphosts from db
Feb 20, 2020
4a4b39e
instance_dao make InitializeInstanceDao public in order to run tests
Feb 20, 2020
573aab5
agent remove MySQLVersion, as Orchestrator already know it
Feb 20, 2020
a7f4c69
additional checks for new seed. AbortSeed + tests
Feb 20, 2020
15c5a18
ContinuousSeedProcess only on leader
Feb 20, 2020
d801cc9
move agent commands to agent.go; update cli and api
Feb 20, 2020
38e276f
remove unused agent variables from config
Feb 21, 2020
2490f84
api use getagentinfo
Feb 21, 2020
8888243
add ReadFailedSeeds, ReadErroredSeeds + tests
Feb 21, 2020
11e2677
add additional checks that targetInstance is not slave or master
Feb 21, 2020
c2ea445
skip drop statements when using sqlite
Feb 28, 2020
fdb5da1
replace chen isMaster to len(SlaveHosts) when starting seed
Feb 28, 2020
55ee494
fix bug with agent discovery during seed
Feb 28, 2020
da37dd6
fix logging in seed stages
Feb 28, 2020
125a42a
agent_http. unmarshall error message from agent in case of 500 response
Mar 2, 2020
3feb093
seed. Swap ConnectSlave and Cleanup stages
Mar 2, 2020
942d2ac
agent_test. Update tests. Create docker containers before running suite
Mar 2, 2020
307586f
seed ConnectSlave. Stop slave threads if they are running before exec…
Mar 2, 2020
881188e
rename SeedProcessIntervalMinutes to SeedProcessIntervalSeconds
Mar 3, 2020
785c1c2
seed ConnectSlave. Log additional seed stage info
Mar 3, 2020
db403a2
SeedBackupStaleFailMinutes. Fail seed in backup stage if no data copied
Mar 3, 2020
5e281b2
seed. Use databases size instead of mysql datadir size in backup mess…
Mar 4, 2020
101cc4a
seed. SeedBackupStaleFailMinutes for restore if seeding to backupdir
Mar 5, 2020
c4ad362
seed. user real database size instead of mysql datadir spaces used in…
Mar 5, 2020
634e866
ProcessSeeds log only if had active seeds
Mar 5, 2020
e182ea8
support changes in tables for sqlite. Add indexes
Mar 6, 2020
94207a2
seed. Add timestamp to seedstagedetails
Mar 6, 2020
4b4b52a
fix typo in log message in NewSeed
Mar 6, 2020
393cf5e
use seedHost in backup to support xtrabackup\lvm
Mar 9, 2020
51a829d
seed. Fix a bug in restore when BackupToDatadir == true
Mar 9, 2020
77fae29
change details text NOT NULL in agent_seed_state table
Mar 9, 2020
3e5c795
seed. Use time.now() when submitting seedState
Mar 10, 2020
10ebc16
seed. use error instead of failed status
Mar 10, 2020
7ca8780
agent. add CreatedAt for LogicalVolume
Mar 11, 2020
0e77b86
seed. additional lvm checks
Mar 11, 2020
c6f6bae
skip AddReplicaKey if it is specified in config.Config.DiscoveryIgnor…
Mar 12, 2020
b57c070
Merge branch 'skip_adding_replicas' into orchestrator_agent_dev
Mar 12, 2020
b7aa8af
seed. Log backup\restore progress event if size not changed
Mar 13, 2020
245c26b
seed. Move creating of progress tracking stucts to processRunning
Mar 16, 2020
d5bf77f
add UI for agents\seeds. Add additional APIs for UI. Fix bugs with ab…
Mar 28, 2020
0bdf29a
agent UI. add confirmation dialog for agent-commands
Mar 31, 2020
64979ad
update orchestrator css
Mar 31, 2020
18033ca
orchestrator js fix bug with toHumanFormat func if bytes is 0
Mar 31, 2020
92920af
seed. fix a bug with processrunning on prepare stage
Apr 1, 2020
7c32b01
agent UI. add forgotten action for discover button
Apr 1, 2020
09fd2b8
agent bugfix. wrong cluster alias shown on agents page
Apr 2, 2020
591bfc2
agents ui bugfix. user /web/cluster link for cluster page
Apr 2, 2020
7ff2db6
add agent-data api endpoint
Apr 3, 2020
5ce85a4
remove unnecessary isAuthorizedForAction check for information agent\…
Apr 3, 2020
5ff4468
seed. when using abort always call abort api for target agent on prep…
Apr 4, 2020
f6c09a3
add agents-failed-seeds api
Apr 6, 2020
0aea224
Merge branch 'master' into orchestrator_agent_dev
Apr 9, 2020
ec3dd85
update agents docs
Apr 9, 2020
43fc609
merge branch 'master' into orchestrator_agent_dev
Apr 12, 2020
4218d84
fix build errors
Apr 12, 2020
7acb357
fix build errors p1
Apr 12, 2020
57d2ce1
fix build errors p2
Apr 12, 2020
e7b9276
fix build errors p3
Apr 12, 2020
957ed0a
bugfix. Seed set inst.GTIDHintForce only if master.UsingGTID(). /api/…
Apr 17, 2020
014f8a2
bugfix. Active seed states not displayed on agent page
Apr 21, 2020
91ff9ef
bugfix. Active seed states not displayed on agent page
Apr 22, 2020
c5b5b40
seed. downtime target host in order to prevent clusterName flapping b…
Jun 16, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ main
.vendor/go19
/bin
/build
.vscode/
62 changes: 50 additions & 12 deletions docs/agents.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,56 @@
# Agents

You may optionally install [orchestrator-agent](https://github.com/github/orchestrator-agent) on your MySQL hosts.
`orchestrator-agent`* is a service which registers with your `orchestrator` server and accepts requests by `orchestrator` via web API.
You may optionally install [orchestrator-agent](https://github.com/opernark/orchestrator-agent) on your MySQL hosts.
*`orchestrator-agent`* is a service which registers with your `orchestrator` server and accepts requests by `orchestrator` via web API.

Supported requests relate to general, OS and LVM operations, such as:
- Stopping/starting MySQL service on host
- Getting MySQL OS info such as data directory, port, disk space usage
- Performing various LVM operations such as finding LVM snapshots, mounting/unmounting a snapshot
- Transferring data between hosts (e.g. via `netcat`)
**orchestrator-agent** is capable of seeding new replicas using different seed methods, providing operating system, file system and LVM information to *orchestrator*, managing MySQL service as well as invoke certain commands and scripts.

`orchestrator-agent` is an ongoing effort in solving host-specific operations. It was originally developed to overcome cloning and restoring issues, and later expanded to other areas.

The information and API exposed by `orchestrator-agent` to `orchestrator` allow `orchestrator` to coordinate and operate seeding of new or corrupted machines by getting data from freshly available snapshots. Moreover, it allows `orchestrator`
to automatically suggest the source of data for a given MySQL machine, by looking up such hosts that actually have a
recent snapshot available, preferably in the same datacenter.
Generic functionality offered by **orchestrator-agent**:
- Detection of the MySQL service, starting and stopping (start/stop/status commands provided via configuration)
- Detection of MySQL port, data directory, databases
- Calculation of disk usage on data directory mount point, OS and RAM size
- Tailing the error log file
- Discovery (the mere existence of the *orchestrator-agent* service on a host may suggest the existence or need of existence of a MySQL service)

Specialized functionality offered by **orchestrator-agent**:
- Seeding new slaves using different seed methods (LVM, Xtrabackup, Mydumper, Mysqldump, Clone plugin)
- Detection of LVM snapshots on MySQL host (snapshots that are MySQL specific)
- Creation of new snapshots
- Mounting/umounting of LVM snapshots
- Detection of DC-local and DC-agnostic snapshots available for a given cluster

For security measures, an agent requires a token to operate all but the simplest requests. This token is randomly generated by the agent and negotiated with `orchestrator`. `orchestrator` does not expose the agent's token (right now some work needs to be done on obscuring the token on error messages).

When using **orchestrator-agent** you will get access to new Agents UI, where you will be able to seed data to new hosts as well as monitor live seeding progress.

In order to enable **orchestrator-agent** add following to orchestrator configuration file

```json
{
"ServeAgentsHttp": true,
}
```

# Seeding
## Supported seed methods
Orchestrator-agent supports following seed methods:
* Mysqldump
* Mydumper
* Xtrabackup
* LVM
* Clone plugin

## Seed process
Seed process consists of 5 stages, running sequentaly one after another:
* Prepare. On this stage different preparations are performed. Depenging on seed method they can include creating specific directories, stopping MySQL, starting socat for data transfer
* Backup. On this stage data is backuped on source host and transfered to target host
* Restore. On this stage data is restored on source host
* ConnectSlave. On this stage backup metadata is read and target host is connected as slave to source host
* Cleanup. On this stage different cleanup activities are executed

There are also additional parameters, which can help you with tunning **orchestrator-agent** and seed process:
* `UnseenAgentForgetHours` - Number of hours after which an unseen agent is forgotten
* `AgentPollMinutes` - Minutes between agent polling
* `MaxRetriesForSeedStage` - Number of maximum retries for each of the seed stages, after which seed will be marked as failed
* `SeedProcessIntervalSeconds` - Interval in seconds between processing active seeds
* `SeedBackupStaleFailMinutes` - Number of minutes after which a stale (no progress) seed in Backup stage is considered failed
Loading