Updated on 2024-09-11 GMT+08:00

Querying Data Synchronization Configurations

Function

This API is used to query data synchronization configuration. Before calling this API:

URI

GET /v3/{project_id}/instances/{instance_id}/clickhouse/replication/config

Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID of a tenant in a region.

To obtain this value, see Obtaining a Project ID.

instance_id

Yes

String

ClickHouse instance ID, which is compliant with the UUID format.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

database_name

Yes

String

Database name.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

User token.

To obtain this value, call the IAM API for obtaining a user token.

The value of X-Subject-Token in the response header is the token value.

X-Language

No

String

Request language type. The default value is en-us.

Values:

  • en-us
  • zh-cn

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

source_instance_id

String

Source instance ID.

source_node_id

String

Node ID of the source instance.

database_info

ChDatabaseConfigResponse object

Database configuration information.

table_infos

Array of ChDatabaseTableConfigCheckResult objects

Table configurations.

table_repl_config

ChDatabaseTableReplConfigInfo object

Table synchronization configurations.

is_tables_change

Boolean

Whether there is any change to the synchronization scope (tables to be synchronized).

new_table_repl_config

ChDatabaseTableReplConfigInfo object

Updated table synchronization configurations.

last_error_of_alter_table

String

Exception about the latest ALTER TABLE operation.

Table 5 ChDatabaseConfigResponse

Parameter

Type

Description

database_name

String

Source database name.

db_config_check_results

Array of ChDatabaseConfigCheckResult objects

Check result of the source database configurations.

Table 6 ChDatabaseConfigCheckResult

Parameter

Type

Description

param_name

String

Name of the database synchronization configuration parameter.

value

String

Value of the database synchronization configuration parameter.

check_result

String

Check result. Values:

  • success
  • fail
Table 7 ChDatabaseTableConfigCheckResult

Parameter

Type

Description

table_name

String

Table name.

table_config

String

Table configuration item.

The following column operations are allowed: PARTITION BY, COLUMNS, ORDER BY, SAMPLE BY, PRIMARY KEY, and TTL.

check_result

String

Check result.

Table 8 ChDatabaseTableReplConfigInfo

Parameter

Type

Description

repl_type

String

Table synchronization type. Values:

  • white_list: whitelist. In this case, tables cannot be left blank.
  • black_list: blacklist. If tables are left blank, all tables are selected.

tables

Array of strings

Tables listed on the whitelist or blacklist.

Status code: 400

Table 9 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 500

Table 10 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Request

Querying the data synchronization configurations of database db_test

GET https://{localhost}/v3/23a50154cf494ec9ad6883979a12db0a/instances/54e42160670e48e789af7075e1efea1fin16/clickhouse/replication/config?database_name=db_test

Example Response

Status code: 200

Success.

{
  "source_instance_id" : "77aa4096cb824a61b93dab5ca00ecc8fin07",
  "source_node_id" : "57bfeacf6e8d4eb685ea907372374b35no07",
  "database_info" : {
    "database_name" : "blackwhite_0018_61474479",
    "db_config_check_results" : [ {
      "param_name" : "default_isolation_level",
      "value" : "QUERY_SNAPSHOT",
      "check_result" : "success"
    }, {
      "param_name" : "enable_snapshots",
      "value" : "true",
      "check_result" : "success"
    }, {
      "param_name" : "enable_chunk_level",
      "value" : "true",
      "check_result" : "success"
    }, {
      "param_name" : "max_sync_threads",
      "value" : "1",
      "check_result" : "success"
    }, {
      "param_name" : "treat_numeric_string_as_integer",
      "value" : "false",
      "check_result" : "success"
    }, {
      "param_name" : "min_binlog_expire_logs_seconds",
      "value" : "86400",
      "check_result" : "success"
    }, {
      "param_name" : "max_rows_in_buffer",
      "value" : "2000000",
      "check_result" : "success"
    }, {
      "param_name" : "max_rows_in_buffers",
      "value" : "6000000",
      "check_result" : "success"
    }, {
      "param_name" : "max_bytes_in_buffer",
      "value" : "200000000",
      "check_result" : "success"
    }, {
      "param_name" : "max_bytes_in_buffers",
      "value" : "600000000",
      "check_result" : "success"
    }, {
      "param_name" : "max_flush_data_time",
      "value" : "5000",
      "check_result" : "success"
    } ]
  },
  "table_infos" : [ ],
  "table_repl_config" : {
    "repl_type" : "black_list",
    "tables" : [ ]
  },
  "is_tables_change" : false,
  "new_table_repl_config" : {
    "repl_type" : null,
    "tables" : null
  },
  "last_error_of_alter_table" : null
}

Status Code

Status Code

Description

200

Success.

400

Client error.

500

Server error.

Error Code

For details, see Error Codes.