Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the commands used by clickhouse21.1.2.15

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article will explain in detail what commands are used in clickhouse21.1.2.15. The quality of the article is high, so Xiaobian shares it with you for reference. I hope you have a certain understanding of relevant knowledge after reading this article.

clickhouse-client -h ip address-d default -m -u default --password password plaintext

clickhouse-client --help //Help documentation

Login permission authentication

The requested URL/etc/clickhouse-server/users.xml was not found on this server.

123456 ::/0 default default

Modify configuration restart clickhouse restart

Here is Springboot Access clickhouse documentation:

https://www.cnblogs.com/cicada-smile/p/11632251.html

Source code:

GitHub·Address github.com/cicadasmile/middle-ware-parent

GitEE·Address gitee.com/cicadasmile/middle-ware-parent

1. sudo clickhouse start //start

2. clickhouse stop //Close

3. clickhouse restart //restart

4. clickhouse -client //Open the client command line

5. The requested URL/etc/index.html was not found on this server.

6. Configure to allow remote connections

Go to the clickhouse configuration file/etc/clickhouse-server/config.xml

uncomment;

Service restart: clickhouse restart

clickhouse local [args]

clickhouse client [args]

clickhouse benchmark [args]

clickhouse server [args]

clickhouse extract-from-config [args]

clickhouse compressor [args]

clickhouse format [args]

clickhouse copier [args]

clickhouse obfuscator [args]

clickhouse git-import [args]

clickhouse install [args]

clickhouse start [args]

clickhouse stop [args]

clickhouse status [args]

clickhouse restart [args]

clickhouse hash-binary [args]

7. Create table query demo

create database test;//create library create table if not exists test.tb_test(id Int64,datetime DateTime,content Nullable(String),value Nullable(Float64),date Date)engine = MergeTree --use mergeTree engine, ch main engine partition by to YMM (datetime) --Partitioning by month of datetime field order by id --sort by id TTL datetime + INTERVAL 3 DAY ; --Three days expired--Modify the expiration time of data in the table, after which the data will be deleted at merge ALTER TABLE test.tb_test MODIFY TTL datetime + INTERVAL 1 DAY;--Query select * from tb_test order by id;--Delete partition, which can be used for timed tasks Delete old data alter table tb_test drop partition '202005';--Insert data into tb_test values (5, '2020-02-29 12:38: 37',' abcde', 12.553, '2020-04- 25');--Modify data, not recommended to use alter table tb_test update content = 'hello click' where id=52;--Delete data, not recommended to use alter table tb_test delete WHERE id=56;

8. SummingMergeTree

This engine can automatically aggregate non-primary key numeric columns and can be used for event statistics

--Autosum aggregate table CREATE TABLE IF NOT EXISTS tb_stat(regionId String, --Store id groupId String, --statistics group idin int, --incoming passenger flow out int, - outbound passenger flow statDate DateTime ENGINE = SummingMergeTrepartition by (toYYYYMM(statDate), regionId)ORDER BY (toStartOfHour(statDate), regionId, groupId);insert into tb_stat values ('1232364', '111', 32, 2, '2020-03-25 12:56:00');insert into tb_stat values ('1232364', '111', 34, 44, '2020-03-25 12:21:00');insert into tb_stat values ('1232364', '111', 54, 12, '2020-03-25 12:20:00');insert into tb_stat values ('1232364', '222', 45, 11, '2020-03-25 12:13:00');insert into tb_stat values ('1232364', '222', 32, 33, '2020-03-25 12:44:00');insert into tb_stat values ('1232364', '222', 12, 23, '2020-03-25 12:22:00');insert into tb_stat values ('1232364', '333', 54, 54, '2020-03-25 12:11:00');insert into tb_stat values ('1232364', '333', 22, 74, '2020-03-25 12:55:00');insert into tb_stat values ('1232364', '333', 12, 15, '2020-03-25 12:34:00');select toStartOfHour(statDate), regionId, groupId, sum(in), sum(out) from tb_stat group by toStartOfHour(statDate), regionId, groupId;

After inserting the data, about 1 minute later, query the table here and you can find that there are only 3 tones of data left:

ambari-03 :) select * from tb_stat;

┌─regionId─┬─groupId─┬──in─┬─out─┬────────────statDate─┐

│ 1232364 │ 111 │ 120 │ 58 │ 2020-03-25 12:56:00 │

│ 1232364 │ 222 │ 89 │ 67 │ 2020-03-25 12:13:00 │

│ 1232364 │ 333 │ 88 │ 143 │ 2020-03-25 12:11:00 │

└──────────┴─────────┴─────┴─────┴─────────────────────┘

About clickhouse21.1.2.15 What commands are used to share here, I hope the above content can be of some help to everyone, you can learn more knowledge. If you think the article is good, you can share it so that more people can see it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report