~drizzle-trunk/drizzle/development

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
Replication Slave
=================

Description
-----------

The replication slave plugin provides a native implementation of replication
between two Drizzle processes.

This plugin requires a master that is running with the InnoDB replication log
enabled.

Configuration
-------------

Most of the options that can be used to control the replication slave plugin
can only be given in a configuration file. The only exception is the
**config-file** option which designates the location of this configuration
file.

**slave.config-file**

   Path to the replication slave configuration file.

The options below are read from the configuration file.

**master-host**

   Hostname/IP address of the master server.

**master-port**

   Drizzle port used by the master server. Default is 3306.

**master-user**

   Username to use for connecting to the master server.

**master-pass**

   Password associated with the username given by **master-user**.

**max-reconnects**

   The number of reconnection attempts the slave plugin will try if the
   master server becomes unreachable. Default is 10.

**seconds-between-reconnects**

   The number of seconds to wait between reconnect attempts when the master
   server becomes unreachable. Default is 30.

Implementation Details
----------------------

The replication slave plugin creates two worker threads, each accessing a
work queue (implemented as an InnoDB table) that contains the replication
events. This is a producer/consumer paradigm where one thread populates the
queue (the producer), and the other thread (the consumer) reads events from
the queue.

The producer thread (or I/O thread) is in charge of connecting to the master
server and pulling down replication events from the master's transaction
log and storing them locally in the slave queue. It is required that the
master use the InnoDB replication log (--innodb.replication-log=true).

The consumer thread (or applier thread) reads the replication events from
the local slave queue, applies them locally, and then deletes successfully
applied events from the queue.

Schemas and Tables
------------------

The slave plugin creates its own schema and set of tables to store its
metadata. It stores everything in the **sys_replication** schema. The
following are the tables that it will create:

**sys_replication.io_state**

   Stores metadata about the IO/producer thread.

**sys_replication.applier_state**

   Stores metadata about the applier/consumer thread.

**sys_replication.queue**

   The replication event queue.