Package com.zendesk.maxwell
Class Maxwell
- java.lang.Object
-
- com.zendesk.maxwell.Maxwell
-
-
Field Summary
Fields Modifier and Type Field Description protected MaxwellConfigconfigprotected MaxwellContextcontextprotected Replicatorreplicator
-
Constructor Summary
Constructors Modifier Constructor Description Maxwell(MaxwellConfig config)Intialize a top level Maxwell runnerprotectedMaxwell(MaxwellContext context)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PositiongetInitialPosition()Determines initial replication position Retrieve stored position from `maxwell`.`positons` Attempt master recovery Use previous client_id's position.StringgetMaxwellVersion()static voidmain(String[] args)The main entry point for Maxwellprotected voidonReplicatorEnd()Hook for subclasses to execute code before termination of the instanceprotected voidonReplicatorStart()Hook for subclasses to execute code after all initialization is complete, but before replication starts.voidrestart()restarts a stopped Maxwell instance.voidrun()run Maxwell, catching all Exceptions.voidstart()Start maxwellvoidterminate()Stop the currently running Maxwell
-
-
-
Field Detail
-
config
protected MaxwellConfig config
-
context
protected MaxwellContext context
-
replicator
protected Replicator replicator
-
-
Constructor Detail
-
Maxwell
public Maxwell(MaxwellConfig config) throws SQLException, URISyntaxException
Intialize a top level Maxwell runner- Parameters:
config- Maxwell configuration- Throws:
SQLException- If Maxwell can't connectURISyntaxException- If there's a problem with the database configuration
-
Maxwell
protected Maxwell(MaxwellContext context) throws SQLException, URISyntaxException
- Throws:
SQLExceptionURISyntaxException
-
-
Method Detail
-
restart
public void restart() throws Exceptionrestarts a stopped Maxwell instance. rebuilds all connections, threads, etc.- Throws:
Exception- If Maxwell can't initialize its context
-
terminate
public void terminate()
Stop the currently running Maxwell
-
getInitialPosition
protected Position getInitialPosition() throws Exception
Determines initial replication position- Retrieve stored position from `maxwell`.`positons`
- Attempt master recovery
- Use previous client_id's position. See https://github.com/zendesk/maxwell/issues/782
- Capture the current master position
- Returns:
- Binlog position to start replicating at
- Throws:
Exception- Various SQL and IO exceptions
-
getMaxwellVersion
public String getMaxwellVersion()
-
onReplicatorStart
protected void onReplicatorStart()
Hook for subclasses to execute code after all initialization is complete, but before replication starts.
-
onReplicatorEnd
protected void onReplicatorEnd()
Hook for subclasses to execute code before termination of the instance
-
start
public void start() throws ExceptionStart maxwell- Throws:
Exception- If maxwell stops due to an Exception
-
main
public static void main(String[] args)
The main entry point for Maxwell- Parameters:
args- command line arguments
-
-