Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
*ghostferry.Config
// Filter configuration for databases to copy
Databases FilterAndRewriteConfigs
// Filter configuration for tables to copy
Tables FilterAndRewriteConfigs
// Specifies the order in which to create database tables as <db>.<table> .
// Names refer to original databases and tables (that is, before renaming
// occurs).
// If a table is to be created on start and appears in this list, it is
// created before any other table, and is created in the order listed here.
// All tables not specified in this list are created in arbitrary order.
//
// Note: if used to overcome foreign key restrictions, ensure SkipForeignKeyConstraintsCheck is true.
TablesToBeCreatedFirst []string
// If you're running Ghostferry from a read only replica, turn this option
// on and specify SourceReplicationMaster and ReplicatedMasterPositionQuery.
RunFerryFromReplica bool
// This is the configuration to connect to the master writer of the source DB.
// This is only used if the source db is a replica and RunFerryFromReplica
// is on.
SourceReplicationMaster *ghostferry.DatabaseConfig
// This is the SQL query used to read the position of the master binlog that
// has been replicated to the Source. As an example, you can query the
// pt-heartbeat table:
//
// SELECT file, position FROM meta.ptheartbeat WHERE server_id = master_server_id
ReplicatedMasterPositionQuery string
// The duration to wait for the replication to catchup before aborting. Only use if RunFerryFromReplica is true.
WaitForReplicationTimeout string
// Ghostferry will by default create tables on your target and fail if these already exist.
// This allows pre-existing tables on your target, schemas and data compatibility won't be validated.
// Use at your own risk.
AllowExistingTargetTable bool
}
func (*Config) InitializeAndValidateConfig ¶
type CopydbFerry ¶
type CopydbFerry struct {
Ferry *ghostferry.Ferry
// contains filtered or unexported fields
}
func NewFerry ¶
func NewFerry(config *Config) *CopydbFerry
func (*CopydbFerry) CreateDatabasesAndTables ¶
func (this *CopydbFerry) CreateDatabasesAndTables() error
func (*CopydbFerry) Initialize ¶
func (this *CopydbFerry) Initialize() error
func (*CopydbFerry) Run ¶
func (this *CopydbFerry) Run()
func (*CopydbFerry) Start ¶
func (this *CopydbFerry) Start() error
type FilterAndRewriteConfigs ¶
type FilterAndRewriteConfigs struct {
// Whitelisted databases/tables. Mutually exclusive with Blacklist as it will
// result in an error.
Whitelist []string
// Blacklisted databases/tables. Mutually exclusive with Whitelist as it will
// result in an error.
Blacklist []string
// Allows database/tables to be renamed from source to the target, where the
// key of this map is the database/table names on the source database and the
// value of the map is on the database/table names target database.
Rewrites map[string]string
}
Whitelisting and blacklisting databases/tables to copy. Also allows to rename databases/tables during the copy process.
If this is empty for a filter, it means to not filter for anything and thus whitelist everything.
func (FilterAndRewriteConfigs) Validate ¶
func (f FilterAndRewriteConfigs) Validate() error
type StaticTableFilter ¶
type StaticTableFilter struct {
Dbs []string
DbsIsBlacklist bool
Tables []string
TablesIsBlacklist bool
}
func NewStaticTableFilter ¶
func NewStaticTableFilter(dbs, tables FilterAndRewriteConfigs) *StaticTableFilter
func (*StaticTableFilter) ApplicableDatabases ¶
func (s *StaticTableFilter) ApplicableDatabases(dbs []string) ([]string, error)
func (*StaticTableFilter) ApplicableTables ¶
func (s *StaticTableFilter) ApplicableTables(tables []*ghostferry.TableSchema) ([]*ghostferry.TableSchema, error)
Click to show internal directories.
Click to hide internal directories.