Enabling the Read-Only Mode of the ClickHouse Table¶
Note
This section applies only to MRS 3.2.0 or later.
Scenario¶
During data migration, one-click balancing, decommissioning and capacity reduction, ClickHouse allows you to set the only_allow_select_statement parameter for MergeTree series tables to enable SELECT operations instead of ALTER, RENAME, DROP, and INSERT operations.
Procedure for Enabling the Read-Only Mode of the ClickHouse Table¶
Run the following commands to log in to the node where the client is installed as user root:
cd Client installation directory
source bigdata_env
Run the following command to authenticate the user if the cluster is in security mode (with Kerberos authentication enabled). Otherwise, skip this step.
kinit Component service user
Note
The user must have the ClickHouse administrator permissions.
Run the proper client command to connect to the ClickHouse server.
Normal mode
clickhouse client --host IP address of the ClickHouse instance--user Username --password --port 9440 --secure
Enter the user password.
Security mode
clickhouse client --host IP address of the ClickHouse instance--port 9440 --secure
Note
The user in normal mode is the default user, or you can create an administrator using the open source capability provided by the ClickHouse community. You cannot use the users created on FusionInsight Manager.
To obtain the IP address of the ClickHouseServer instance, log in to FusionInsight Manager, choose Cluster > Services > ClickHouse, and click the Instance tab.
Run the following statement to set the table to read-only:
ALTER TABLE {table_name} MODIFY SETTING only_allow_select_statement = true;