Docker 上跑 Clickhouse

docker run --rm --name clickhouse -p8123:8123 --ulimit nofile=262144:262144 yandex/clickhouse-server

 

下面是从MYSQL导入表

create table <table_name> engine = MergeTree ORDER BY ( <key1>,<key2>,<key3> ) \
as select * from mysql('<host>:<port>', '<db_name>','<table_name>', '<username>', '<password>') ;

create table ticks engine = MergeTree ORDER BY (contract,date,time )\
as select * from mysql('172.21.16.5:3306','rqsdk','ticks','root','xxxxxx') ;

 

修改数据

ALTER TABLE ticks UPDATE is_dominant=false WHERE is_dominant=true

 

删除数据

ALTER TABLE ticks DELETE WHERE contract='M2101'

 

表改动后即时生效
OPTIMIZE TABLE ticks FINAL

 

从MYSQL插入数据

insert into <table_name> select *
from mysql('<host>:<port>', '<db_name>','<table_name>', '<username>', '<password>')

insert into ticks select * from mysql('172.21.16.5:3306','rqsdk','ticks','root','xxxxxx')

 

posted @ 2022-10-06 23:02  LightingCui  阅读(53)  评论(0编辑  收藏  举报