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')
出处:http://tugeler.cnblogs.com/
本文版权归作者所,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。