Configuration
The configuration of Canal source connector has the following properties.Property
| Name | Required | Sensitive | Default | Description |
|---|---|---|---|---|
username | true | true | None | Canal server account (not MySQL). |
password | true | true | None | Canal server password (not MySQL). |
destination | true | false | None | Source destination that Canal source connector connects to. |
singleHostname | false | false | None | Canal server address. |
singlePort | false | false | None | Canal server port. |
cluster | true | false | false | Whether to enable cluster mode based on Canal server configuration or not. If set to true, it talks to zkServers to figure out the actual database host.If set to false, it connects to the database specified by singleHostname and singlePort. |
zkServers | true | false | None | Address and port of the Zookeeper that Canal source connector talks to figure out the actual database host. |
batchSize | false | false | 1000 | Batch size to fetch from Canal. |
Example
Before using the Canal connector, you can create a configuration file through one of the following methods.-
JSON
-
YAML
You can create a YAML file and copy the contents below to your YAML file.
Usage
Here is an example of storing MySQL data using the configuration file as above.-
Start a MySQL server.
-
Create a configuration file
mysqld.cnf. -
Copy the configuration file
mysqld.cnfto MySQL server. -
Restart the MySQL server.
-
Create a test database in MySQL server.
-
Start a Canal server and connect to MySQL server.
-
Start Pulsar standalone.
-
Modify the configuration file
canal-mysql-source-config.yaml. -
Create a consumer file
pulsar-client.py. -
Copy the configuration file
canal-mysql-source-config.yamland the consumer filepulsar-client.pyto Pulsar server. -
Download a Canal connector and start it.
-
Consume data from MySQL.
-
Open another window to log in MySQL server.
-
Create a table, and insert, delete, and update data in MySQL server.

































