Merge pull request #221 from twotwotwo/override-applier-host
Add -override-applier-host for use with -allow-master-master
This commit is contained in:
commit
96f108d3b4
@ -109,6 +109,7 @@ type MigrationContext struct {
|
||||
CutOverType CutOver
|
||||
|
||||
Hostname string
|
||||
OverrideApplierHostname string
|
||||
TableEngine string
|
||||
RowsEstimate int64
|
||||
RowsDeltaEstimate int64
|
||||
|
@ -44,6 +44,7 @@ func main() {
|
||||
migrationContext := base.GetMigrationContext()
|
||||
|
||||
flag.StringVar(&migrationContext.InspectorConnectionConfig.Key.Hostname, "host", "127.0.0.1", "MySQL hostname (preferably a replica, not the master)")
|
||||
flag.StringVar(&migrationContext.OverrideApplierHostname, "override-applier-host", "", "(with -allow-master-master), optionally specify which host should have changes applied to it")
|
||||
flag.IntVar(&migrationContext.InspectorConnectionConfig.Key.Port, "port", 3306, "MySQL port (preferably a replica, not the master)")
|
||||
flag.StringVar(&migrationContext.CliUser, "user", "", "MySQL user")
|
||||
flag.StringVar(&migrationContext.CliPassword, "password", "", "MySQL password")
|
||||
@ -161,6 +162,9 @@ func main() {
|
||||
}
|
||||
log.Warning("--test-on-replica-skip-replica-stop enabled. We will not stop replication before cut-over. Ensure you have a plugin that does this.")
|
||||
}
|
||||
if migrationContext.OverrideApplierHostname != "" && !migrationContext.AllowedMasterMaster {
|
||||
log.Fatalf("--override-applier-host is only for use with --allow-master-amster")
|
||||
}
|
||||
|
||||
switch *cutOver {
|
||||
case "atomic", "default", "":
|
||||
|
@ -761,6 +761,9 @@ func (this *Migrator) initiateInspector() (err error) {
|
||||
if this.migrationContext.ApplierConnectionConfig, err = this.inspector.getMasterConnectionConfig(); err != nil {
|
||||
return err
|
||||
}
|
||||
if this.migrationContext.OverrideApplierHostname != "" {
|
||||
this.migrationContext.ApplierConnectionConfig.Key.Hostname = this.migrationContext.OverrideApplierHostname
|
||||
}
|
||||
if this.migrationContext.TestOnReplica || this.migrationContext.MigrateOnReplica {
|
||||
if this.migrationContext.InspectorIsAlsoApplier() {
|
||||
return fmt.Errorf("Instructed to --test-on-replica or --migrate-on-replica, but the server we connect to doesn't seem to be a replica")
|
||||
|
Loading…
Reference in New Issue
Block a user