Skip to content

Commit

Permalink
Added command documentation, more hints, supports "-c help" to list all
Browse files Browse the repository at this point in the history
known commands with short description
  • Loading branch information
shlomi-noach committed Oct 15, 2015
1 parent 0fe10cc commit 4e6d34e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 14 deletions.
2 changes: 1 addition & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
set -e

RELEASE_VERSION="1.4.444"
RELEASE_VERSION="1.4.445"
TOPDIR=/tmp/orchestrator-release
export RELEASE_VERSION TOPDIR

Expand Down
10 changes: 8 additions & 2 deletions go/app/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ func commandsListing() string {
}

func availableCommandsUsage() string {
return fmt.Sprintf("Available commands (-c):\n%+v\nRun 'orchestrator' for full blown documentation\n", commandsListing())
return fmt.Sprintf(`Available commands (-c):
%+v
Run 'orchestrator' for full blown documentation
Usage for most commands:
orchestrator -c <command> [-i <instance.fqdn>] [-d <destination.fqdn>] [--verbose|--debug]
`, commandsListing())
}

func getInstanceKey(instanceKey *inst.InstanceKey) *inst.InstanceKey {
Expand Down Expand Up @@ -1103,7 +1109,7 @@ func Cli(command string, strict bool, instance string, destination string, owner
fmt.Println("hostname resolve cache cleared")
}
// Help
case "list":
case "help":
{
fmt.Fprintf(os.Stderr, availableCommandsUsage())
}
Expand Down
49 changes: 38 additions & 11 deletions go/cmd/orchestrator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,20 @@ import (
)

const prompt string = `
orchestrator [-c command] [-i instance] [--verbose|--debug] [... cli ] | http
orchestrator [-c command] [-i instance] [-d destination] [--verbose|--debug] [... cli ] | http
Cheatsheet:
See all possible commands:
orchestrator -c list
Run orchestrator in HTTP mode:
orchestrator --debug http
For CLI executuon see details below.
See all possible commands:
orchestrator -c help
Usage for most commands:
orchestrator -c <command> [-i <instance.fqdn>] [-d <destination.fqdn>] [--verbose|--debug]
-i (instance):
instance on which to operate, in "hostname" or "hostname:port" format.
Default port is 3306 (or DefaultInstancePort in config)
Expand Down Expand Up @@ -189,6 +190,16 @@ Cheatsheet:
with a definitve candidate, which could act as a replace master. See also regroup-slaves. Example:
orchestrator -c get-candidate-slave -i instance.with.slaves.one.of.which.may.be.candidate.com
regroup-slaves-bls
Given an instance that has Binlog Servers for slaves, promote one such Binlog Server over its other
Binlog Server siblings.
Example:
orchestrator -c regroup-slaves-bls -i instance.with.binlog.server.slaves.com
--debug is your friend.
Topology refactoring using GTID
Expand Down Expand Up @@ -219,6 +230,15 @@ Cheatsheet:
orchestrator -c move-slaves-gtid -i instance.whose.slaves.will.relocate -d instance.that.becomes.their.master --pattern=regexp.filter
only apply to those instances that match given regex
regroup-slaves-gtid
Given an instance (possibly a crashed one; it is never being accessed), pick one of its slave and make it
local master of its siblings, using GTID. The rules are similar to those in the "regroup-slaves" command.
Example:
orchestrator -c regroup-slaves-gtid -i instance.with.gtid.and.slaves.one.of.which.will.turn.local.master.if.possible
--debug is your friend.
Topology refactoring using Pseudo-GTID
These operations require that the topology's master is periodically injected with pseudo-GTID,
Expand Down Expand Up @@ -342,7 +362,7 @@ Cheatsheet:
skip-query
On a failed replicating slave, skips a single query and attempts to resume replication.
Only applies when the replication seems to be broken on SQL thread (e.g. on duplicate
key error). Example:
key error). Also works in GTID mode. Example:
orchestrator -c skip-query -i slave.with.broken.sql.thread.com
Expand Down Expand Up @@ -391,6 +411,13 @@ Cheatsheet:
orchestrator -c flush-binary-logs -i instance.with.binary.logs.com --binlog=mysql-bin.002048
Flushes binary logs until reaching given number. Fails when current number is larger than input
purge-binary-logs
Purge binary logs on an instance. Examples:
orchestrator -c purge-binary-logs -i instance.with.binary.logs.com --binlog mysql-bin.002048
Purges binary logs until given log
Pool commands
Orchestrator provides with getter/setter commands for handling pools. It does not on its own investigate pools,
but merely accepts and provides association of an instance (host:port) and a pool (any_name).
Expand Down Expand Up @@ -756,9 +783,9 @@ func main() {
fmt.Fprintln(os.Stderr, `Usage:
orchestrator --options... [cli|http]
See complete list of commands:
orchestrator -c list
orchestrator -c help
Full blown documentation:
orchestrator
`)
`)
}
}

0 comments on commit 4e6d34e

Please # to comment.