Documentation ¶
Overview ¶
DBDeployer - The MySQL Sandbox Copyright © 2006-2021 Giuseppe Maxia
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func CreateAllMastersReplication(sandboxDef SandboxDef, origin string, nodes int, masterIp string) error
- func CreateChildSandbox(sandboxDef SandboxDef) (execList []concurrent.ExecutionList, err error)
- func CreateCustomMockVersion(version string, fileSet []MockFileSet) error
- func CreateFanInReplication(sandboxDef SandboxDef, origin string, nodes int, ...) error
- func CreateGroupReplication(sandboxDef SandboxDef, origin string, nodes int, masterIp string) error
- func CreateMasterSlaveReplication(sandboxDef SandboxDef, origin string, nodes int, masterIp string) error
- func CreateMockVersion(version string) error
- func CreateMultipleSandbox(sandboxDef SandboxDef, origin string, nodes int) (common.StringMap, error)
- func CreateNdbReplication(sandboxDef SandboxDef, origin string, nodes int, ndbNodes int, masterIp string) error
- func CreatePxcReplication(sandboxDef SandboxDef, origin string, nodes int, masterIp string) error
- func CreateReplicationSandbox(sdef SandboxDef, origin string, replData ReplicationData) error
- func CreateStandaloneSandbox(sandboxDef SandboxDef) (err error)
- func FillMockTemplates() error
- func RemoveCustomSandbox(sandboxDir, sandbox string, runConcurrently, useStop bool) (execList []concurrent.ExecutionList, err error)
- func RemoveMockEnvironment(mockUpperDir string) error
- func RemoveSandbox(sandboxDir, sandbox string, runConcurrently bool) (execList []concurrent.ExecutionList, err error)deprecated
- func SetMockEnvironment(mockUpperDir string) error
- type AllTemplateCollection
- type MockFileSet
- type Node
- type ReplicationData
- type SandboxDef
- type ScriptBatch
- type ScriptDef
- type Slave
- type TemplateCollection
- type TemplateDesc
Constants ¶
const (
DefaultMockDir = "mock_dir"
)
Variables ¶
var ( //go:embed templates/single/connection_info_json.gotxt ConnectionInfoJson string //go:embed templates/single/connection_info_super_json.gotxt ConnectionInfoSuperJson string //go:embed templates/single/connection_info_conf.gotxt ConnectionInfoConf string //go:embed templates/single/connection_info_super_conf.gotxt ConnectionInfoSuperConf string SingleTemplates = TemplateCollection{ globals.TmplCopyright: TemplateDesc{ Description: "Copyright for every sandbox script", Notes: "", Contents: globals.ShellScriptCopyright, }, globals.TmplReplicationOptions: TemplateDesc{ Description: "Replication options for my.cnf", Notes: "", Contents: replicationOptions, }, globals.TmplSemisyncMasterOptions: TemplateDesc{ Description: "master semi-synch options for my.cnf", Notes: "", Contents: semisyncMasterOptions, }, globals.TmplSemisyncSlaveOptions: TemplateDesc{ Description: "slave semi-synch options for my.cnf", Notes: "", Contents: semisyncSlaveOptions, }, globals.TmplGtidOptions56: TemplateDesc{ Description: "GTID options for my.cnf 5.6.x", Notes: "", Contents: gtidOptions56, }, globals.TmplGtidOptions57: TemplateDesc{ Description: "GTID options for my.cnf 5.7.x and 8.0", Notes: "", Contents: gtidOptions57, }, globals.TmplReplCrashSafeOptions: TemplateDesc{ Description: "Replication crash safe options", Notes: "", Contents: replCrashSafeOptions, }, globals.TmplExposeDdTables: TemplateDesc{ Description: "Commands needed to enable data dictionary table usage", Notes: "", Contents: exposeDdTables, }, globals.TmplInitDb: TemplateDesc{ Description: "Initialization template for the database", Notes: "This should normally run only once", Contents: initDbTemplate, }, globals.TmplStart: TemplateDesc{ Description: "starts the database in a single sandbox (with optional mysqld arguments)", Notes: "", Contents: startTemplate, }, globals.TmplUse: TemplateDesc{ Description: "Invokes the MySQL client with the appropriate options", Notes: "", Contents: useTemplate, }, globals.TmplUseAdmin: TemplateDesc{ Description: "Invokes the MySQL client as admin", Notes: "For MySQL 8.0.14+", Contents: useAdminTemplate, }, globals.TmplSysbench: TemplateDesc{ Description: "Invokes the sysbench tool with custom defined options", Notes: "Requires sysbench to be installed", Contents: sysbenchTemplate, }, globals.TmplSysbenchReady: TemplateDesc{ Description: "Invokes the sysbench tool with predefined actions", Notes: "Requires sysbench to be installed", Contents: sysbenchReadyTemplate, }, globals.TmplMysqlsh: TemplateDesc{ Description: "Invokes the MySQL shell with an appropriate URI", Notes: "", Contents: mysqlshTemplate, }, globals.TmplStop: TemplateDesc{ Description: "Stops a database in a single sandbox", Notes: "", Contents: stopTemplate, }, globals.TmplClear: TemplateDesc{ Description: "Remove all data from a single sandbox", Notes: "", Contents: clearTemplate, }, globals.TmplMyCnf: TemplateDesc{ Description: "Default options file for a sandbox", Notes: "", Contents: myCnfTemplate, }, globals.TmplStatus: TemplateDesc{ Description: "Shows the status of a single sandbox", Notes: "", Contents: statusTemplate, }, globals.TmplRestart: TemplateDesc{ Description: "Restarts the database (with optional mysqld arguments)", Notes: "", Contents: restartTemplate, }, globals.TmplSendKill: TemplateDesc{ Description: "Sends a kill signal to the database", Notes: "", Contents: sendKillTemplate, }, globals.TmplLoadGrants: TemplateDesc{ Description: "Loads the grants defined for the sandbox", Notes: "", Contents: loadGrantsTemplate, }, globals.TmplGrants5x: TemplateDesc{ Description: "Grants for sandboxes up to 5.6", Notes: "", Contents: grantsTemplate5x, }, globals.TmplGrants57: TemplateDesc{ Description: "Grants for sandboxes from 5.7+", Notes: "", Contents: grantsTemplate57, }, globals.TmplGrants8x: TemplateDesc{ Description: "Grants for sandboxes from 8.0+", Notes: "", Contents: grantsTemplate8x, }, globals.TmplTaskUserGrants: TemplateDesc{ Description: "Grants for task user (8.0+)", Notes: "", Contents: grantsTaskUserTemplate, }, globals.TmplMy: TemplateDesc{ Description: "Prefix script to run every my* command line tool", Notes: "", Contents: myTemplate, }, globals.TmplAddOption: TemplateDesc{ Description: "Adds options to the my.sandbox.cnf file and restarts", Notes: "", Contents: addOptionTemplate, }, globals.TmplShowLog: TemplateDesc{ Description: "Shows error log or custom log", Notes: "", Contents: showLogTemplate, }, globals.TmplShowBinlog: TemplateDesc{ Description: "Shows a binlog for a single sandbox", Notes: "", Contents: showBinlogTemplate, }, globals.TmplShowRelaylog: TemplateDesc{ Description: "Show the relaylog for a single sandbox", Notes: "", Contents: showRelaylogTemplate, }, globals.TmplTestSb: TemplateDesc{ Description: "Tests basic sandbox functionality", Notes: "", Contents: testSbTemplate, }, globals.TmplSbLocked: TemplateDesc{ Description: "locked sandbox script", Notes: "This script is replacing 'clear' when the sandbox is locked", Contents: sbLockedTemplate, }, globals.TmplAfterStart: TemplateDesc{ Description: "commands to run after the database started", Notes: "This script does nothing. You can change it and reuse through --use-template", Contents: afterStartTemplate, }, globals.TmplSbInclude: TemplateDesc{ Description: "Common variables and routines for sandboxes scripts", Notes: "", Contents: sbIncludeTemplate, }, globals.TmplConnectionInfoSql: TemplateDesc{ Description: "connection info to replicate from this sandbox", Notes: "", Contents: connectionInfoSql, }, globals.TmplConnectionInfoConf: TemplateDesc{ Description: "connection info to replicate from this sandbox (.conf)", Notes: "", Contents: ConnectionInfoConf, }, globals.TmplConnectionInfoSuperConf: TemplateDesc{ Description: "connection info use this sandbox as super user (.conf)", Notes: "", Contents: ConnectionInfoSuperConf, }, globals.TmplConnectionInfoJson: TemplateDesc{ Description: "connection info to replicate from this sandbox (.json)", Notes: "", Contents: ConnectionInfoJson, }, globals.TmplConnectionInfoSuperJson: TemplateDesc{ Description: "connection info to use this sandbox as super user (.json)", Notes: "", Contents: ConnectionInfoSuperJson, }, globals.TmplReplicateFrom: TemplateDesc{ Description: "starts replication from another sandbox", Notes: "", Contents: replicateFromTemplate, }, globals.TmplCloneConnectionSql: TemplateDesc{ Description: "connection info to clone from this sandbox", Notes: "", Contents: cloneConnectionSql, }, globals.TmplCloneFrom: TemplateDesc{ Description: "clone from another sandbox", Notes: "", Contents: cloneFromTemplate, }, globals.TmplMetadata: TemplateDesc{ Description: "shows data about the sandbox", Notes: "", Contents: metadataTemplate, }, globals.TmplWipeAndRestart: TemplateDesc{ Description: "wipe the database and re-create it", Notes: "", Contents: wipeAndRestartTemplate, }, } MockTemplates = TemplateCollection{ globals.TmplNoOpMock: TemplateDesc{ Description: "mock script that does nothing", Notes: "Used for internal tests", Contents: noOpMockTemplate, }, globals.TmplMysqldSafeMock: TemplateDesc{ Description: "mock script for mysqld_safe", Notes: "Used for internal tests", Contents: mysqldSafeMockTemplate, }, globals.TmplTidbMock: TemplateDesc{ Description: "mock script for tidb-server", Notes: "Used for internal tests", Contents: tidbMockTemplate, }, } AllTemplates = AllTemplateCollection{ "mock": MockTemplates, "single": SingleTemplates, "tidb": TidbTemplates, "import": ImportTemplates, "multiple": MultipleTemplates, "replication": ReplicationTemplates, "group": GroupTemplates, "pxc": PxcTemplates, "ndb": NdbTemplates, } )
var ( GroupTemplates = TemplateCollection{ globals.TmplInitNodes: TemplateDesc{ Description: "Initialize group replication after deployment", Notes: "", Contents: initNodesTemplate, }, globals.TmplCheckNodes: TemplateDesc{ Description: "Checks the status of group replication", Notes: "", Contents: checkNodesTemplate, }, globals.TmplGroupReplOptions: TemplateDesc{ Description: "replication options for Group replication node", Notes: "", Contents: groupReplOptionsTemplate, }, } )
var ( //go:embed templates/import/import_my_cnf.gotxt ImportMyCnfTemplate string )
var ImportTemplates = TemplateCollection{ globals.TmplImportInitDb: TemplateDesc{ Description: "Initialization template for the imported server", Notes: "no op", Contents: noOpTemplate, }, globals.TmplImportUse: TemplateDesc{ Description: "use template for the imported server", Notes: "", Contents: importUseTemplate, }, globals.TmplImportStart: TemplateDesc{ Description: "start template for the imported server", Notes: "no op", Contents: noOpTemplate, }, globals.TmplImportRestart: TemplateDesc{ Description: "restart template for the imported server", Notes: "no op", Contents: noOpTemplate, }, globals.TmplImportStatus: TemplateDesc{ Description: "status template for the imported server", Notes: "", Contents: importStatusTemplate, }, globals.TmplImportSendKill: TemplateDesc{ Description: "send_kill template for the imported server", Notes: "no op", Contents: noOpTemplate, }, globals.TmplImportStop: TemplateDesc{ Description: "stop template for the imported server", Notes: "no op", Contents: noOpTemplate, }, globals.TmplImportLoadGrants: TemplateDesc{ Description: "load_grants template for the imported server", Notes: "no op", Contents: noOpTemplate, }, globals.TmplImportClear: TemplateDesc{ Description: "clear template for the imported server", Notes: "no op", Contents: noOpTemplate, }, globals.TmplImportAddOption: TemplateDesc{ Description: "add_option template for the imported server", Notes: "no op", Contents: noOpTemplate, }, globals.TmplImportShowBinlog: TemplateDesc{ Description: "show_binlog template for the imported server", Notes: "no op", Contents: noOpTemplate, }, globals.TmplImportShowLog: TemplateDesc{ Description: "show_log template for the imported server", Notes: "no op", Contents: noOpTemplate, }, globals.TmplImportShowRelaylog: TemplateDesc{ Description: "show_relaylog template for the imported server", Notes: "no op", Contents: noOpTemplate, }, globals.TmplImportMysqlsh: TemplateDesc{ Description: "Invokes the MySQL shell with an appropriate URI for imported server", Notes: "", Contents: importMysqlshTemplate, }, globals.TmplImportMyCnf: TemplateDesc{ Description: "configuration file for imported mysql client", Notes: "", Contents: ImportMyCnfTemplate, }, globals.TmplImportTestSb: TemplateDesc{ Description: "Tests basic imported sandbox functionality", Notes: "", Contents: importTestSbTemplate, }, globals.TmplImportSbInclude: TemplateDesc{ Description: "Common variables and routines for imported sandboxes scripts", Notes: "", Contents: importSbIncludeTemplate, }, globals.TmplImportMetadata: TemplateDesc{ Description: "Show data about the sandbox", Notes: "", Contents: importMetadataTemplate, }, }
var ( MultipleTemplates = TemplateCollection{ globals.TmplStartMulti: TemplateDesc{ Description: "Starts all nodes (with optional mysqld arguments)", Notes: "", Contents: startMultiTemplate, }, globals.TmplRestartMulti: TemplateDesc{ Description: "Restarts all nodes (with optional mysqld arguments)", Notes: "", Contents: restartMultiTemplate, }, globals.TmplUseMulti: TemplateDesc{ Description: "Runs the same SQL query in all nodes", Notes: "", Contents: useMultiTemplate, }, globals.TmplExecMulti: TemplateDesc{ Description: "Runs the same command in all nodes", Notes: "", Contents: execMultiTemplate, }, globals.TmplMetadataMulti: TemplateDesc{ Description: "Runs a metadata query in all nodes", Notes: "", Contents: metadataMultiTemplate, }, globals.TmplUseMultiAdmin: TemplateDesc{ Description: "Runs the same SQL query (as admin user) in all nodes", Notes: "", Contents: useMultiAdminTemplate, }, globals.TmplStopMulti: TemplateDesc{ Description: "Stops all nodes", Notes: "", Contents: stopMultiTemplate, }, globals.TmplSendKillMulti: TemplateDesc{ Description: "Sends kill signal to all nodes", Notes: "", Contents: sendKillMultiTemplate, }, globals.TmplClearMulti: TemplateDesc{ Description: "Removes data from all nodes", Notes: "", Contents: clearMultiTemplate, }, globals.TmplStatusMulti: TemplateDesc{ Description: "Shows status for all nodes", Notes: "", Contents: statusMultiTemplate, }, globals.TmplTestSbMulti: TemplateDesc{ Description: "Run sb test on all nodes", Notes: "", Contents: testSbMultiTemplate, }, globals.TmplNode: TemplateDesc{ Description: "Runs the MySQL client for a given node", Notes: "", Contents: nodeTemplate, }, globals.TmplNodeAdmin: TemplateDesc{ Description: "Runs the MySQL client for a given node as admin user", Notes: "", Contents: nodeAdminTemplate, }, globals.TmplReplicateFromMulti: TemplateDesc{ Description: "calls script replicate_from from node #1", Notes: "", Contents: replicateFromMultiTemplate, }, globals.TmplSysbenchMulti: TemplateDesc{ Description: "calls script sysbench from node #1", Notes: "", Contents: sysbenchMultiTemplate, }, globals.TmplSysbenchReadyMulti: TemplateDesc{ Description: "calls script sysbench_ready from node #1", Notes: "", Contents: sysbenchReadyMultiTemplate, }, } )
var NdbTemplates = TemplateCollection{ globals.TmplNdbStartCluster: TemplateDesc{ Description: "NDB start cluster", Notes: "", Contents: ndbStartTemplate, }, globals.TmplNdbStopCluster: TemplateDesc{ Description: "NDB stop cluster", Notes: "", Contents: ndbStopTemplate, }, globals.TmplNdbConfig: TemplateDesc{ Description: "NDB cluster configuration", Notes: "", Contents: ndbConfigTemplate, }, globals.TmplNdbMgm: TemplateDesc{ Description: "NDB cluster manager", Notes: "", Contents: ndbMgmTemplate, }, globals.TmplNdbCheckStatus: TemplateDesc{ Description: "NDB check cluster status", Notes: "", Contents: ndbCheckStatusTemplate, }, }
var ( PxcTemplates = TemplateCollection{ globals.TmplPxcCheckNodes: TemplateDesc{ Description: "Checks the status of PXC replication", Notes: "", Contents: checkPxcNodesTemplate, }, globals.TmplPxcReplication: TemplateDesc{ Description: "Replication options for PXC", Notes: "", Contents: pxcReplicationTemplate, }, globals.TmplPxcStart: TemplateDesc{ Description: "start all nodes in a PXC", Notes: "", Contents: pxcStartTemplate, }, } )
var ( ReplicationTemplates = TemplateCollection{ globals.TmplInitSlaves: TemplateDesc{ Description: "Initialize slaves after deployment", Notes: "Can also be run after calling './clear_all'", Contents: initSlavesTemplate, }, globals.TmplSemiSyncStart: TemplateDesc{ Description: "Starts semi synch replication ", Notes: "", Contents: semiSyncStartTemplate, }, globals.TmplStartAll: TemplateDesc{ Description: "Starts nodes in replication order (with optional mysqld arguments)", Notes: "", Contents: startAllTemplate, }, globals.TmplRestartAll: TemplateDesc{ Description: "stops all nodes and restarts them (with optional mysqld arguments)", Notes: "", Contents: restartAllTemplate, }, globals.TmplUseAll: TemplateDesc{ Description: "Execute a query for all nodes", Notes: "", Contents: useAllTemplate, }, globals.TmplExecAll: TemplateDesc{ Description: "Execute a command in all nodes", Notes: "", Contents: execAllTemplate, }, globals.TmplMetadataAll: TemplateDesc{ Description: "Execute a metadata query for all nodes", Notes: "", Contents: metadataAllTemplate, }, globals.TmplUseAllAdmin: TemplateDesc{ Description: "Execute a query (as admin user) for all nodes", Notes: "", Contents: useAllAdminTemplate, }, globals.TmplUseAllSlaves: TemplateDesc{ Description: "Execute a query for all slaves", Notes: "master-slave topology", Contents: useAllSlavesTemplate, }, globals.TmplUseAllMasters: TemplateDesc{ Description: "Execute a query for all masters", Notes: "master-slave topology", Contents: useAllMastersTemplate, }, globals.TmplExecAllSlaves: TemplateDesc{ Description: "Execute a command in all slave nodes", Notes: "master-slave topology", Contents: execAllSlavesTemplate, }, globals.TmplExecAllMasters: TemplateDesc{ Description: "Execute a command in all master nodes", Notes: "master-slave topology", Contents: execAllMastersTemplate, }, globals.TmplStopAll: TemplateDesc{ Description: "Stops all nodes in reverse replication order", Notes: "", Contents: stopAllTemplate, }, globals.TmplSendKillAll: TemplateDesc{ Description: "Send kill signal to all nodes", Notes: "", Contents: sendKillAllTemplate, }, globals.TmplClearAll: TemplateDesc{ Description: "Remove data from all nodes", Notes: "", Contents: clearAllTemplate, }, globals.TmplStatusAll: TemplateDesc{ Description: "Show status of all nodes", Notes: "", Contents: statusAllTemplate, }, globals.TmplTestSbAll: TemplateDesc{ Description: "Run sb test on all nodes", Notes: "", Contents: testSbAllTemplate, }, globals.TmplTestReplication: TemplateDesc{ Description: "Tests replication flow", Notes: "", Contents: testReplicationTemplate, }, globals.TmplCheckSlaves: TemplateDesc{ Description: "Checks replication status in master and slaves", Notes: "", Contents: checkSlavesTemplate, }, globals.TmplMaster: TemplateDesc{ Description: "Runs the MySQL client for the master", Notes: "", Contents: masterTemplate, }, globals.TmplMasterAdmin: TemplateDesc{ Description: "Runs the MySQL client for the master as admin user", Notes: "", Contents: masterAdminTemplate, }, globals.TmplSlave: TemplateDesc{ Description: "Runs the MySQL client for a slave", Notes: "", Contents: slaveTemplate, }, globals.TmplSlaveAdmin: TemplateDesc{ Description: "Runs the MySQL client for a slave as admin_user", Notes: "", Contents: slaveAdminTemplate, }, globals.TmplMultiSource: TemplateDesc{ Description: "Initializes nodes for multi-source replication", Notes: "fan-in and all-masters", Contents: multiSourceTemplate, }, globals.TmplMultiSourceUseSlaves: TemplateDesc{ Description: "Runs a query for all slave nodes", Notes: "group replication and multi-source topologies", Contents: multiSourceUseSlavesTemplate, }, globals.TmplMultiSourceUseMasters: TemplateDesc{ Description: "Runs a query for all master nodes", Notes: "group replication and multi-source topologies", Contents: multiSourceUseMastersTemplate, }, globals.TmplMultiSourceExecSlaves: TemplateDesc{ Description: "Runs a command in each slave node", Notes: "group replication and multi-source topologies", Contents: multiSourceExecSlavesTemplate, }, globals.TmplMultiSourceExecMasters: TemplateDesc{ Description: "Runs a command in each slave node", Notes: "group replication and multi-source topologies", Contents: multiSourceExecMastersTemplate, }, globals.TmplWipeAndRestartAll: TemplateDesc{ Description: "clears the databases and restarts them all", Notes: "group replication and multi-source topologies", Contents: wipeAndRestartAllTemplate, }, globals.TmplMultiSourceTest: TemplateDesc{ Description: "Test replication flow for multi-source replication", Notes: "fan-in and all-masters", Contents: multiSourceTestTemplate, }, globals.TmplCheckMultiSource: TemplateDesc{ Description: "checks replication status for multi-source replication", Notes: "fan-in and all-masters", Contents: checkMultiSourceTemplate, }, globals.TmplReplReplicateFrom: TemplateDesc{ Description: "use replicate_from script from the master", Notes: "", Contents: replicateFromReplTemplate, }, globals.TmplReplSysbench: TemplateDesc{ Description: "use sysbench script from the master", Notes: "", Contents: sysbenchReplTemplate, }, globals.TmplReplSysbenchReady: TemplateDesc{ Description: "use sysbench_ready script from the master", Notes: "", Contents: sysbenchReadyReplTemplate, }, } )
var TidbTemplates = TemplateCollection{ globals.TmplTidbInitDb: TemplateDesc{ Description: "Initialization template for the TiDB server", Notes: "This should normally run only once", Contents: tidbInitTemplate, }, globals.TmplTidbMyCnf: TemplateDesc{ Description: "Default options file for a TiDB sandbox", Notes: "", Contents: tidbMyCnfTemplate, }, globals.TmplTidbStart: TemplateDesc{ Description: "Stops a database in a single TiDB sandbox", Notes: "", Contents: tidbStartTemplate, }, globals.TmplTidbStop: TemplateDesc{ Description: "Stops a database in a single TiDB sandbox", Notes: "", Contents: tidbStopTemplate, }, globals.TmplTidbSendKill: TemplateDesc{ Description: "Sends a kill signal to the TiDB database", Notes: "", Contents: tidbSendKillTemplate, }, globals.TmplTidbGrants5x: TemplateDesc{ Description: "Grants for TiDB sandboxes", Notes: "", Contents: tidbGrantsTemplate, }, globals.TmplTidbAfterStart: TemplateDesc{ Description: "commands to run after the database started", Notes: "This script does nothing. You can change it and reuse through --use-template", Contents: tidbAfterStartTemplate, }, }
Every template in this collection will replace the corresponding one in SingleTemplates when the flavor is "tidb"
Functions ¶
func CreateAllMastersReplication ¶
func CreateAllMastersReplication(sandboxDef SandboxDef, origin string, nodes int, masterIp string) error
func CreateChildSandbox ¶
func CreateChildSandbox(sandboxDef SandboxDef) (execList []concurrent.ExecutionList, err error)
func CreateCustomMockVersion ¶ added in v1.27.0
func CreateCustomMockVersion(version string, fileSet []MockFileSet) error
func CreateFanInReplication ¶
func CreateFanInReplication(sandboxDef SandboxDef, origin string, nodes int, masterIp, masterList, slaveList string) error
func CreateGroupReplication ¶
func CreateGroupReplication(sandboxDef SandboxDef, origin string, nodes int, masterIp string) error
func CreateMasterSlaveReplication ¶
func CreateMasterSlaveReplication(sandboxDef SandboxDef, origin string, nodes int, masterIp string) error
func CreateMockVersion ¶ added in v1.27.0
func CreateMultipleSandbox ¶
func CreateNdbReplication ¶ added in v1.23.0
func CreatePxcReplication ¶ added in v1.21.0
func CreatePxcReplication(sandboxDef SandboxDef, origin string, nodes int, masterIp string) error
func CreateReplicationSandbox ¶
func CreateReplicationSandbox(sdef SandboxDef, origin string, replData ReplicationData) error
func CreateReplicationSandbox(sdef SandboxDef, origin string, topology string, nodes int, masterIp, masterList, slaveList string) error {
func CreateStandaloneSandbox ¶
func CreateStandaloneSandbox(sandboxDef SandboxDef) (err error)
func FillMockTemplates ¶ added in v1.32.0
func FillMockTemplates() error
func RemoveCustomSandbox ¶ added in v1.54.0
func RemoveCustomSandbox(sandboxDir, sandbox string, runConcurrently, useStop bool) (execList []concurrent.ExecutionList, err error)
func RemoveMockEnvironment ¶ added in v1.27.0
func RemoveSandbox
deprecated
func RemoveSandbox(sandboxDir, sandbox string, runConcurrently bool) (execList []concurrent.ExecutionList, err error)
Deprecated: use RemoveCustomSandbox instead
func SetMockEnvironment ¶ added in v1.27.0
Types ¶
type AllTemplateCollection ¶
type AllTemplateCollection map[string]TemplateCollection
type MockFileSet ¶ added in v1.19.0
type MockFileSet struct {
// contains filtered or unexported fields
}
func MySQLMockSet ¶ added in v1.19.0
func MySQLMockSet(debug bool) []MockFileSet
type ReplicationData ¶ added in v1.23.0
type SandboxDef ¶
type SandboxDef struct { DirName string // Name of the directory containing the sandbox SBType string // Type of sandbox (single, multiple, replication-node, group-node) Multi bool // CoalesceString single or part of a multiple sandbox NodeNum int // In multiple sandboxes, which node is this Version string // MySQL version Basedir string // Where to get binaries from (e.g. $HOME/opt/mysql/8.0.11) SbHost string // The host for this sandbox (default 127.0.0.1) Imported bool // The server is being imported ClientBasedir string // Where to get client binaries from (e.g. $HOME/opt/mysql/8.0.15) BasedirName string // The bare name of the directory containing the binaries (e.g. 8.0.11) SandboxDir string // Target directory for sandboxes ShellPath string // The Bash interpreter to use for generated scripts StartArgs []string // Arguments passed to the 'start' command LoadGrants bool // Should we load grants? SkipReportHost bool // Do not add report-host to my.sandbox.cnf SkipReportPort bool // Do not add report-port to my.sandbox.cnf SkipStart bool // Do not start the server after deployment InstalledPorts []int // Which ports should be skipped in port assignment for this SB Port int // Port assigned to this sandbox MysqlXPort int // XPlugin port for this sandbox AdminPort int // Admin port for this sandbox (8.0.14+) UserPort int // Custom port provided by user BasePort int // Base port for calculating more ports in multiple SB MorePorts []int // Additional ports that belong to this sandbox Prompt string // Prompt to use in "mysql" client DbUser string // Database user name RplUser string // Replication user name DbPassword string // Database password RplPassword string // Replication password DefaultRole string // Role assigned to default user CustomRoleName string // Custom role name CustomRolePrivileges string // Custom role privileges (such as 'SELECT, INSERT') CustomRoleTarget string // Custom role target (such as 'dbName.*', or '*.*') CustomRoleExtra string // Custom role extra (such as 'with grant option') TaskUser string // Additional user to be created on demand TaskUserRole string // Role to be assigned to task user RemoteAccess string // What access have the users created for this SB (127.%) BindAddress string // Bind address for this sandbox (127.0.0.1) CustomMysqld string // Use an alternative mysqld executable ServerId int // Server ID (for single sandbox) BaseServerId int // Base Server ID (for multiple sandboxes) ReplOptions string // Replication options, as string to append to my.sandbox.cnf GtidOptions string // Options needed for GTID ReplCrashSafeOptions string // Options needed for Replication crash safe SemiSyncOptions string // Options for semi-synchronous replication ReadOnlyOptions string // Options for read-only passed to child sandboxes InitOptions []string // Options to be added to the initialization command MyCnfOptions []string // Options to be added to my.sandbox.cnf ChangeMasterOptions []string // Options to be added to CHANGE MASTER TO PreGrantsSql []string // SQL statements to execute before grants assignment PreGrantsSqlFile string // SQL file to load before grants assignment PostGrantsSql []string // SQL statements to run after grants assignment PostGrantsSqlFile string // SQL file to load after grants assignment MyCnfFile string // options file to merge with the SB my.sandbox.cnf HistoryDir string // Where to store the MySQL client history LogFileName string // Where to log operations for this sandbox Flavor string // The flavor of the binaries (MySQL, Percona, NDB, etc) PortAsServerId bool // Whether we use the port number as server ID FlavorInPrompt bool // Add flavor to prompt SocketInDatadir bool // Whether we want the socket in the data directory SlavesReadOnly bool // Whether slaves will set the read_only flag SlavesSuperReadOnly bool // Whether slaves will set the super_read_only flag Logger *defaults.Logger // Carries a logger across sandboxes InitGeneralLog bool // Enable general log during server initialization EnableGeneralLog bool // Enable general log for regular usage NativeAuthPlugin bool // Use the native password plugin for MySQL 8.0.4+ DisableMysqlX bool // Disable Xplugin (MySQL 8.0.11+) EnableMysqlX bool // Enable Xplugin (MySQL 5.7.12+) EnableAdminAddress bool // Enable Admin address (MySQL 8.0.14+) KeepUuid bool // Do not change UUID SinglePrimary bool // Use single primary for group replication Force bool // Overwrite an existing sandbox with same target ExposeDdTables bool // Show hidden data dictionary tables (MySQL 8.0.0+) RunConcurrently bool // Run multiple sandbox creation concurrently }
type ScriptBatch ¶
type ScriptBatch struct {
// contains filtered or unexported fields
}
type TemplateCollection ¶
type TemplateCollection map[string]TemplateDesc