Bu sayfa henüz yerel dilinizde mevcut değildir. Daha fazla dil seçeneği eklemek için yoğun bir şekilde çalışıyoruz. Desteğiniz için teşekkür ederiz.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ CloudTable Service/ Getting Started/ Getting Started with ClickHouse

Getting Started with ClickHouse

Updated on 2024-04-29 GMT+08:00

ClickHouse offers easy-to-use, flexible, and stable hosting services in the cloud. A data warehouse can be created in minutes for massive real-time data query and analysis, improving the overall efficiency of data value mining. By leveraging the massively parallel processing (MPP) architecture, ClickHouse can query data several times faster than conventional data warehouses.

Background Information

Assume that there is a student score table and you need to use ClickHouse to perform the following operations:

  • Create the user information table demo_t.
  • Add the user gender and subject to the user information.
  • Query basic user information by user ID.
  • Delete the user information table after the service ends.
    Table 1 Score table

    user_id

    name

    sex

    subject

    score

    time

    10000

    A

    1

    Spanish

    89

    2023-07-01 09:00:00

    10001

    B

    0

    Math

    132

    2023-07-01 09:00:00

    10002

    C

    0

    Math

    90

    2023-07-02 09:00:00

    10003

    D

    0

    English

    120

    2023-07-01 14:00:00

    10004

    E

    1

    Spanish

    101

    2023-07-01 09:00:00

    10005

    F

    1

    Spanish

    110

    2023-07-01 09:00:00

    Table 2 Parameters

    Parameter

    Description

    10000

    User ID, which uniquely identifies a user.

    2023-07-01 09:00:00

    Data import time.

    A

    Student name.

    1

    Gender female (0 indicates male).

    Spanish

    Discipline.

    89

    Score.

Buying a ClickHouse Cluster

  1. Log in to the CloudTable console.
  2. Select a region in the upper left corner.
  3. Click Cluster Management.
  4. Click Buy Cluster in the upper right corner of the Cluster Management page and set related parameters.
  5. Click Buy Now. On the displayed page, confirm the specifications and click Finish.
  6. Return to the cluster list to view the cluster creation progress. If the cluster status is In service, the cluster is created. For details, see Creating a ClickHouse Cluster.

Downloading the ClickHouse Client

  1. Log in to the CloudTable console.
  2. Select a region in the upper left corner.
  3. Click Help in the navigation pane.
  4. Choose Download the ClickHouse Client under Helpful Links on the right of the help page to download the client installation package.

Preparing an ECS

  1. Buy an ECS.
    1. Log in to the ECS console.
    2. Click in the upper left corner to select a region.
    3. Click the service list icon and choose Compute > Elastic Cloud Server.
    4. Click Buy ECS.
    5. Configure ECS parameters.
      1. Select the CPU architecture and specifications.
        Figure 1 Configuring basic settings
      2. Select the image and disk specifications.
        Figure 2 Selecting the image and disk specifications
  2. Click Next: Configure Network.
    1. Select a VPC and a security group.
      Figure 3 Configuring network
    2. Select Auto assign and set Billed By to Traffic.
      Figure 4 Configuring EIP type and bandwidth billing type
  3. Click Next: Configure Advanced Settings.

    Configure the ECS name and password.

    Figure 5 Configuring advanced settings
  4. Click Next: Confirm to confirm the configuration information.
    Figure 6 Confirming the configuration information
  5. Select an enterprise project, select the sentence in the Agreement area, confirm the configuration information, and click Submit.
  6. Return to the ECS list page and view the ECS creation progress.

    When the ECS status changes to Running, the ECS is created.

Installing the ClickHouse Client

You can manually install the client on an ECS.

  1. Use the SSH login tool (such as PuTTY) to log in to the Linux ECS through the EIP.

    For details about how to log in to the ECS, see "Remotely Logging In to a Linux ECS (Using an SSH Password)" in Logging In to a Linux ECS of the Elastic Cloud Server User Guide.

  2. Transfer the client downloaded in 2 to the Linux ECS.
  3. Install the client and connect to the cluster.
    1. Use the SSH login tool to remotely log in to the Linux ECS through the EIP.

      For details, see Login Using an SSH Password in the Elastic Cloud Server User Guide.

    2. Go to the root directory of the SSH login tool.
      cd /
    3. Create a folder in the root directory.
      mkdir Folder name
    4. Go to the directory of the created folder.
      cd /Folder name/
    5. Place the client in the directory.
    6. Decompress the client package.
      tar  -zxf   Client package name
    7. Load the .so file.
      sh install.sh
    8. Go to the bin directory.
      cd bin/

      Grant the 700 permission to the directory.

      chmod 700 clickhouse
    9. Connect to the port of the ClickHouse cluster.
      Use the following command to connect to a normal cluster.
      ./clickhouse client --host Private IP address of the cluster   --port Port --user admin --password Password

      Check the security cluster connection commands in Connecting to a Security Cluster.

      ./clickhouse client --host Private IP address of the cluster --port port --user admin --password Password --secure --config-file /root/config.xml
      NOTE:
      • Private IP address of the cluster: cluster access address on the cluster details page. Replace it with the access address of the cluster you purchased.
      • Password: the password set when you purchase the cluster. If there are special characters, use backslashes (\) to escape them. If the password is enclosed in single quotation marks ('), the special characters do not need to be escaped.
      Table 3 Custom security rules

      Direction

      Action

      Port/Range

      Type

      Destination/Source Address

      Usage

      Outbound

      Allow

      All

      IPv4/IPv6

      0.0.0.0/0

      Permit in the outbound direction

      Inbound

      Allow

      8123

      Security group of the CloudTable ClickHouse cluster

      ClickHouse HTTP port number

      Allow

      9000

      ClickHouse TCP port number

      Allow

      8443

      ClickHouse HTTPS port number

      Allow

      9440

      Secure TCP security port of ClickHouse

Inserting Data

Create a data table using the ClickHouse cluster and query the table data.
  1. Create a database.
    create database DB_demo;
  2. Use the database.
    use DB_demo;
  3. Create a table.
    create table DB_demo_t(user_id Int32,name String,sex Tinyint ,subject String,score Int32,time datetime)engine=TinyLog;
  4. Insert data.
    insert into DB_demo_t(user_id,name,sex,subject,score,time) values('10000','A','1','Spanish','89','2023-07-01 09:00:00');
    insert into DB_demo_t(user_id,name,sex,subject,score,time) values('10001','B','0','Math','132','2023-07-01 09:00:00');
    insert into DB_demo_t(user_id,name,sex,subject,score,time) values('10002','C','0','Math','90','2023-07-02 09:00:00');
    insert into DB_demo_t(user_id,name,sex,subject,score,time) values('10003','D','0','English','120','2023-07-01 14:00:00');
    insert into DB_demo_t(user_id,name,sex,subject,score,time) values('10004','E','1','Spanish','101','2023-07-01 09:00:00');
    insert into DB_demo_t(user_id,name,sex,subject,score,time) values('10005','F','1','Spanish','110','2023-07-01 09:00:00');
  5. Query data.
    • Query the imported data.
      host-172-16-13-95 :) select * from DB_demo_t;
      SELECT *
      FROM DB_demo_t
      Query id: 4e119f77-0592-4131-bbe2-31f42bc069a1
      ┌─user_id─┬─name─┬─sex─┬─subject─┬─score─┬────────────────time─┐
      │   10000 │ A    │   1 │ Spanish   │    89 │ 2023-07-01 09:00:00 │
      │   10001 │ B    │   0 │ Math   │   132 │ 2023-07-01 09:00:00 │
      │   10002 │ C    │   0 │ Math   │    90 │ 2023-07-02 09:00:00 │
      │   10003 │ D    │   0 │ English   │   120 │ 2023-07-01 14:00:00 │
      │   10004 │ E    │   1 │ Spanish   │   101 │ 2023-07-01 09:00:00 │
      │   10005 │ F    │   1 │ Spanish   │   110 │ 2023-07-01 09:00:00 │
      └─────────┴──────┴─────┴────────┴───────┴─────────────────────┘
      6 rows in set. Elapsed: 0.004 sec.
  6. Delete data.
    • Delete the table.
      drop table DB_demo_t;
    • Delete the database.
      drop database DB_demo;

Sitemizi ve deneyiminizi iyileştirmek için çerezleri kullanırız. Sitemizde tarama yapmaya devam ederek çerez politikamızı kabul etmiş olursunuz. Daha fazla bilgi edinin

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback