agent in orchestrator

Table of contents

Orchestrator is an open source MySQL high availability (High Availability) solution. It can automatically perform MySQL failover, master-slave switching, data center migration and other operations. It also provides a Web interface and API interface to facilitate operation and maintenance personnel to perform MySQL cluster operations. Management and monitoring.

Among the common functions of Orchestrator, agents are rarely mentioned. In fact, Orchestrator also has agent-related functions and has an independent project orchestrator-agent.

The agent in Orchestrator mainly has the following functions:

  • Establish a connection with the Orchestrator server, receive instructions from the server and execute them;
  • Supports interaction with Orchestrator server through HTTP API, such as obtaining instance information, starting and stopping MySQL instances, etc.;

In Orchestrator, config.Config.ServeAgentsHttpconfigure whether agent-related functions are enabled through configuration items, mainly http server. This http server listens to port 3001 by default, and can actively report information to the Orchestrator server through the HTTP API agent, for example, MySQL machine hostname, etc.

Next, this article mainly introduces orchestrator-agent.

orchestrator-agent

orchestrator-agent is a sub-project of Orchestrator.

orchestrator-agent is a process running on the MySQL server. It can report the status information of the MySQL server to the Orchestrator server through communication with the Orchestrator server, thereby realizing automated management and monitoring of the MySQL cluster. At the same time, the agent can also perform some MySQL operations, such as starting, stopping, etc., as well as executing some customized scripts.

Orchestrator and agent interact through HTTP protocol. When the agent starts, it registers itself with the Orchestrator server and periodically sends status information of the MySQL instance to Orchestrator. When performing these operations, the Orchestrator will send commands to the agent, and the agent will perform corresponding operations according to the commands and return the execution results to the Orchestrator.

The http server on the orchestrator-agent side listens to port 3002 by default.
The main http interfaces include:

    m.Get("/api/hostname", this.Hostname)
    m.Get("/api/lvs", this.ListLogicalVolumes)
    m.Get("/api/lvs/:pattern", this.ListLogicalVolumes)
    m.Get("/api/lvs-snapshots", this.ListSnapshotsLogicalVolumes)
    m.Get("/api/lv", this.LogicalVolume)
    m.Get("/api/lv/:lv", this.LogicalVolume)
    m.Get("/api/mount", this.GetMount)
    m.Get("/api/mountlv", this.MountLV)
    m.Get("/api/removelv", this.RemoveLV)
    m.Get("/api/umount", this.Unmount)
    m.Get("/api/du", this.DiskUsage)
    m.Get("/api/mysql-du", this.MySQLDiskUsage)
    m.Get("/api/create-snapshot", this.CreateSnapshot)
    m.Get("/api/available-snapshots-local", this.AvailableLocalSnapshots)
    m.Get("/api/available-snapshots", this.AvailableSnapshots)
    m.Get("/api/mysql-error-log-tail", this.MySQLErrorLogTail)
    m.Get("/api/mysql-port", this.MySQLPort)
    m.Get("/api/mysql-status", this.MySQLRunning)
    m.Get("/api/mysql-stop", this.MySQLStop)
    m.Get("/api/mysql-start", this.MySQLStart)
    m.Get("/api/delete-mysql-datadir", this.DeleteMySQLDataDir)
    m.Get("/api/mysql-datadir-available-space", this.GetMySQLDataDirAvailableDiskSpace)
    m.Get("/api/post-copy", this.PostCopy)
    m.Get("/api/receive-mysql-seed-data/:seedId", this.ReceiveMySQLSeedData)
    m.Get("/api/send-mysql-seed-data/:targetHost/:seedId", this.SendMySQLSeedData)
    m.Get("/api/abort-seed/:seedId", this.AbortSeed)
    m.Get("/api/seed-command-completed/:seedId", this.SeedCommandCompleted)
    m.Get("/api/seed-command-succeeded/:seedId", this.SeedCommandSucceeded)
    m.Get("/api/mysql-relay-log-index-file", this.RelayLogIndexFile)
    m.Get("/api/mysql-relay-log-files", this.RelayLogFiles)
    m.Get("/api/mysql-relay-log-end-coordinates", this.RelayLogEndCoordinates)
    m.Get("/api/mysql-binlog-contents", this.BinlogContents)
    m.Get("/api/mysql-binlog-binary-contents", this.BinlogBinaryContents)
    m.Get("/api/mysql-relaylog-contents-tail/:relaylog/:start", this.RelaylogContentsTail)
    m.Post("/api/apply-relaylog-contents", this.ApplyRelaylogContents)
    m.Get("/api/custom-commands/:cmd", this.RunCommand)
    m.Get(config.Config.StatusEndpoint, this.Status)

As can be seen from the http interface above, the orchestrator-agent functions mainly include
obtaining the MySQL machine hostname, lvs related operations, mount operations, mysql start, stop and other operations, binlog, relay log related operations, and other customized operations.

Above, this article introduces the basic functions of the agent in Orchestrator.

reference

orchestrator

orchestrator-agent

Guess you like

Origin blog.csdn.net/lanyang123456/article/details/131352269