Managing ClickHouse Tenants

Note

This section applies only to MRS 3.2.0 or later.

Scenario

On FusionInsight Manager, cluster administrators can create a ClickHouse tenant and associate it with a logical cluster. After a system user is bound to the tenant, the system user has the permissions on the logical cluster of the tenant.

Creating a ClickHouse Tenant

  1. Log in to FusionInsight Manager and choose Tenant Resources.

  2. Click image1. On the page that is displayed, configure tenant attributes according to Table 1.

    Table 1 Tenant parameters

    Parameter

    Description

    Cluster

    Cluster for which you want to create a tenant

    Name

    • Name of the current tenant. The value consists of 3 to 50 characters, including numbers, letters, and underscores (_).

    • Plan a tenant name based on service requirements. The name cannot be the same as that of a role, HDFS directory, or Yarn queue that exists in the current cluster.

    Tenant Resource Type

    Select Leaf Tenant Resource.

    Note

    Create a ClickHouse tenant. Tenant Resource Type can only be Leaf Tenant.

    Computing Resource

    Dynamic compute resources for the current tenant

    • When Yarn is selected, the system automatically creates a queue in Yarn and the queue is named the same as the tenant name.

    • If Yarn is not selected, the system does not automatically create a queue.

    Configuration Mode

    Configuration mode of compute resource parameters

    • If you select Basic, you only need to configure Default Resource Pool Capacity (%).

    • If you select Advanced, you can manually configure the resource allocation weight and the minimum, maximum, and reserved resources of the tenant.

    Default Resource Pool Capacity (%)

    Percentage of compute resources used by the current tenant in the default resource pool. The value ranges from 0 to 100%.

    Weight

    Resource allocation weight. The value ranges from 0 to 100.

    Minimum Resource

    Resources guaranteed for the tenant (preemption supported). The value can be a percentage or an absolute value of the parent tenant's resources. When a tenant has a light workload, the resources of the tenant are automatically allocated to other tenants. When the available tenant resources are less than the value of Minimum Resource, the tenant can preempt the resources that have been lent to other tenants.

    Maximum Resource

    Maximum resources that can be used by the tenant. The tenant cannot obtain more resources than the value configured. The value can be a percentage or an absolute value of the parent tenant's resources.

    Reserved Resource

    Resources reserved for the tenant resource. The reserved resources cannot be used by other tenants even if no job is running in the current tenant resources. The value can be a percentage or an absolute value of the parent tenant's resources.

    Storage Resource

    Storage resources for the current tenant.

    • When HDFS is selected, the system automatically allocates storage resources.

    • If HDFS is not selected, the system does not automatically allocate storage resources.

    Quota

    Quota for files and directories

    Space Quota

    Quota for the HDFS storage space used by the current tenant

    • If the unit is set to MB, the value ranges from 1 to 8796093022208. If the unit is set to GB, the value ranges from 1 to 8589934592.

    • This parameter indicates the maximum HDFS storage space that can be used by the tenant, but not the actual space used.

    • If its value is greater than the size of the HDFS physical disk, the maximum space available is the full space of the HDFS physical disk.

    Storage Path

    HDFS storage directory for the tenant

    • The system automatically creates a folder named after the tenant name in the /tenant directory by default. For example, the default HDFS storage directory for tenant ta1 is /tenant/ta1.

    • When a tenant is created for the first time, the system automatically creates the /tenant directory in the HDFS root directory. The storage path is customizable.

    Service

    • Select ClickHouse for Service.

      • Association Type: When Service is set to ClickHouse, Association Type can only be set to Shared.

      • Associate Logical Cluster: If the logical cluster function is not enabled for ClickHouse, default_cluster is selected by default. If the function is enabled, select the logical cluster to which you want to associate.

      • CPU Priority: The CPU priority ranges from -20 to 19. This value is associated with the NICE value of the OS. A smaller value indicates a higher CPU priority. For details about how to enable the CPU priority, see Enabling the CPU Priority Feature.

      • Memory: The maximum value of this parameter is 100, in percentage. For example, if this parameter is set to 80, the total memory that can be used by the current tenant is calculated as follows: Available memory x 80%.

    Description

    Description of the current tenant

  3. Click OK. Wait until the tenant is created.

  4. After the ClickHouse tenant is created, you can view and modify tenant resources on the Tenant Resources page.

    1. On FusionInsight Manager, choose Tenant Resources. In the tenant list, select the ClickHouse tenant whose information you want to view and view the tenant overview and resource quota.

    2. Choose Resources and click image2 next to Resource Details to modify tenant resources.

    3. After the modification is complete, click OK. The modified resource details are displayed on the Resources page.

      Note

      After modifying the resource quota of the ClickHouse tenant, you need to log in to the ClickHouse client again for the modification to take effect.

Adding a User and Binding the User to a Tenant

  • To create a user and bind the user to a tenant, log in to FusionInsight Manager, choose System > Permission > User, click Create User to add a human-machine user, and add the tenant created by referring to Creating a ClickHouse Tenant. Then, the user has the permissions on the ClickHouse logical cluster.

  • To bind an existing user to a tenant, log in to FusionInsight Manager, choose System > Permission > User, click Modify in the Operation column of the user, and add the tenant created by referring to Creating a ClickHouse Tenant. Delete the ClickHouse tenant from the role if the tenant is no longer needed.

    Note

    • After a user is bound to a ClickHouse tenant, the user has the permission to modify the logical cluster of the tenant.

    • When multiple users are bound to the same tenant, the tenant-level memory limit of the current version does not support real-time total memory limit. For example, user1 and user2 are bound to tenant1, the memory limit for tenant1 is 10 GB, and the query performed by user1 uses 5 GB memory. When user2 initiates a query, the memory that can be used by user2 is limited to 5 GB. During the query, the service does not dynamically update this restriction.

    • In the current version, a user cannot be bound to multiple ClickHouse tenants. If user1 has been associated with tenant1, no error message is displayed when user1 is associated with tenant2, but the information is recorded in background logs, indicating that the user has been associated with a tenant and this association operation is invalid.

Associating an Existing Tenant with the ClickHouse Service

  1. On FusionInsight Manager, choose Tenant Resources, select the tenant to which you want to associate a service, click the Service Association tab, and click Associate Service. The following table describes the parameters.

    Parameter

    Description

    Service

    Select ClickHouse.

    Association Type

    Select Shared.

    Associate Logical Cluster

    If the logical cluster function is not enabled for ClickHouse, default_cluster is selected by default. If the function is enabled, select the logical cluster to which you want to associate.

    CPU Priority

    The CPU priority ranges from -20 to 19. This value is associated with the NICE value of the OS. A smaller value indicates a higher CPU priority. For details about how to enable the CPU priority, see Enabling the CPU Priority Feature.

    Memory

    The maximum value of this parameter is 100, in percentage. For example, if this parameter is set to 80, the total memory that can be used by the current tenant is calculated as follows: Available memory x 80%.

  2. On the displayed tab page, configure the tenant based on service requirements and click OK. The tenant is associated with the service.

  3. To disassociate the ClikHouse service, perform the following operations:

    On FusionInsight Manager, choose Tenant Resources, select the tenant whose ClickHouse service is to be disassociated, and click Delete in the Operation column. In the dialog box that is displayed, click OK.

    Note

    After the ClickHouse service is disassociated from a tenant, the tenant and its users no longer have the permissions on the ClickHouse logical cluster.