Parameter | Description | Data type | Required | Default value | Remarks |
connector | The type of the result table. | STRING | Yes | No default value | Set the value to clickhouse. |
url | The Java Database Connectivity (JDBC) URL of ClickHouse. | STRING | Yes | No default value | You must specify a URL in the jdbc:clickhouse://<yourNetworAddress>:<PortId>/<yourDatabaseName> format. If you want to directly write data to a ClickHouse local table, you can execute the select * from system.clusters statement to obtain the IP address of the node on which data is written to the ClickHouse local table. If you do not specify the database name, the database named default is used. Note If you want to write data to a ClickHouse distributed table, you must specify the URL to the JDBC URL of the node to which the ClickHouse distributed table belongs. |
userName | The username that is used to access ClickHouse. | STRING | Yes | No default value | N/A. |
password | The password that is used to access ClickHouse. | STRING | Yes | No default value | N/A. |
tableName | The name of the ClickHouse table. | STRING | Yes | No default value | N/A. |
maxRetryTimes | The maximum number of retries for writing data to the result table. | INT | No | 3 | N/A. |
batchSize | The number of data records that can be written at a time. | INT | No | 100 | If the number of data records in the cache reaches the value of the batchSize parameter or the interval at which the cache is cleared is greater than the value of the flushIntervalMs parameter, the system automatically writes the cached data to the ClickHouse table. |
flushIntervalMs | The interval at which the cache is cleared. | LONG | No | 1000 | Unit: milliseconds. |
ignoreDelete | Specifies whether to ignore the delete messages. | BOOLEAN | No | true | Valid values: true: The delete messages are ignored. This is the default value. false: The delete messages are not ignored. If you set this parameter to false and specify a primary key in the DDL statement, the system executes the ALTER statement to delete data from the ClickHouse table.
Note If you set the ignoreDelete parameter to false, data cannot be written to a ClickHouse local table that corresponds to the ClickHouse distributed table in partition write mode. In this case, you cannot set the writeMode parameter to partition. |
shardWrite | Specifies whether to directly write data to a ClickHouse local table if the current table is a ClickHouse distributed table. | BOOLEAN | No | false | Valid values: false: The system writes data to the ClickHouse distributed table and then to a ClickHouse local table that corresponds to the ClickHouse distributed table. This is the default value. In this case, if you set the shardWrite parameter to false, you must set the tableName parameter to the name of the ClickHouse distributed table. true: The system skips the ClickHouse distributed table and directly writes data to a ClickHouse local table that corresponds to the ClickHouse distributed table. If you want to increase the throughput for writing data to the ClickHouse distributed table, we recommend that you set this parameter to true. If you want to manually specify the nodes on which data is written to the ClickHouse local tables in the url parameter, you must set the tableName parameter to the names of the ClickHouse local tables. Example:
'url' = 'jdbc:clickhouse://192.XX.XX.1:3002,192.XX.XX.2:3002/default'
'tableName' = 'local_table'
If you do not want to manually specify the nodes on which data is written to the ClickHouse local tables in the url parameter, you can configure the inferLocalTable parameter together with the shardWrite parameter to allow Realtime Compute for Apache Flink to automatically infer the nodes of the ClickHouse local tables. In this case, you must set the tableName parameter to the name of the ClickHouse distributed table and the url parameter to the JDBC URL of the node to which the ClickHouse distributed table belongs. Example:
'url' = 'jdbc:clickhouse://192.XX.XX.1:3002/default' // Set the url parameter to the JDBC URL of the node to which the ClickHouse distributed table belongs.
'tableName' = 'distribute_table'
|
inferLocalTable | Specifies whether to automatically infer the information about the ClickHouse local tables that correspond to a ClickHouse distributed table if you want to write data to the ClickHouse distributed table and directly write data to the ClickHouse local tables. | BOOLEAN | No | false | Valid values: false: If you want to write data to a ClickHouse distributed table and specify only one node in the url parameter, the system does not automatically infer the information about the ClickHouse local tables that correspond to the ClickHouse distributed table. The system writes data to the ClickHouse distributed table and then to the ClickHouse local tables. This is the default value. true: The system automatically infers the information about the ClickHouse local tables that correspond to the ClickHouse distributed table and directly writes data to the ClickHouse local tables. In this case, if you set the inferLocalTable parameter to true, you must set the shardWrite parameter to true, the tableName parameter to the name of the ClickHouse distributed table, and the url parameter to the JDBC URL of the node to which the ClickHouse distributed table belongs.
Note If you want to write data to a ClickHouse non-distributed table, you do not need to configure this parameter. |
writeMode | The policy based on which data is written to a ClickHouse local table. | ENUM | No | default | Valid values: default: Data is written to the ClickHouse local table on the first node of the ClickHouse cluster. This is the default value. partition: Data with the same key is written to the same ClickHouse local table on a specific node. random: Data is randomly written to the ClickHouse local table on a node. balance: The round-robin algorithm is used to evenly write data to the ClickHouse local table on a node.
Note If you set the writeMode parameter to partition, make sure that the ignoreDelete parameter is set to true. |
shardingKey | The key based on which data is written to the same ClickHouse local table on a specific node. | default | No | No default value | If you set the writeMode parameter to partition, you must configure the shardingKey parameter. The value of the shardingKey parameter can contain multiple fields. Separate multiple fields with commas (,). |
exactlyOnce | Specifies whether to use the exactly-once semantics. | BOOLEAN | No | false | Valid values: Note You can use the exactly-once semantics to write data only to a ClickHouse cluster that is deployed in Alibaba Cloud EMR. Therefore, you can set this parameter to true only if you want to write data to a ClickHouse cluster that is deployed in Alibaba Cloud EMR. If you set the writeMode parameter to partition and you want to write data to a ClickHouse local table, you cannot use the exactly-once semantics. Therefore, if you set the exactlyOnce parameter to true, you cannot set the writeMode parameter to partition.
|