标签:启动服务 replace engine har http 昨天 span ppi click
昨天有构建过一个clickhouse 的fdw docker 镜像,今天测试下
环境使用docker-compose 运行,clickhouse 同样也是
version: "3"
services:
server:
image: yandex/clickhouse-server
ports:
- "8123:8123"
- "9000:9000"
- "9009:9009"
ulimits:
nproc: 65535
nofile:
soft: 262144
hard: 262144
client:
image: yandex/clickhouse-client
command: [‘--host‘, ‘server‘]
pgspider:
image: dalongrong/pgspider:clickhouse
ports:
- "5432:5432"
environment:
- "POSTGRES_PASSWORD=dalong"
docker-compose up -d
创建表:
CREATE TABLE wikistat
(
project String,
subproject String,
hits UInt64,
size UInt64
) ENGINE = Log;
导入数据:
serverhost=192.168.0.103 // replace with your hostid
docker run -i yandex/clickhouse-client --format_csv_delimiter="|" --host ${serverhost} --query="INSERT INTO default.wikistat FORMAT CSV" < ./data/info.csv
数据内容
aa|File:Sleeping_lion.jpg|1|8030
aa|Main_Page|1|78261
aa|Special:Statistics|1|20493
aa|Special:WhatLinksHere/File:Crystal_Clear_app_email.png|1|5412
aa|Special:WhatLinksHere/File:Wikipedia-logo-fr.png|1|5370
aa|Steward_requests/Bot_status|1|4733
aa|Translation_teams/ru|1|4718
aa|User:%E5%8F%B8%E5%BE%92%E4%BC%AF%E9%A2%9C|2|20096
aa|User:149.62.201.0/24|1|4802
aa|User:191.101.30.0/24|1|4806
aa|User:5.172.192.0/21|1|4800
aa|User:62.76.7.25|1|4788
使用已经构建好,同时push dockerhub 的
CREATE EXTENSION clickhousedb_fdw;
CREATE SERVER myserver FOREIGN DATA WRAPPER clickhousedb_fdw OPTIONS(dbname ‘default‘, driver ‘/opt/clickhousedb/libclickhouseodbc.so‘, host ‘server‘);
CREATE USER MAPPING FOR postgres SERVER myserver;
CREATE FOREIGN TABLE wikistat (
project text,
subproject text,
hits int,
size int
) SERVER myserver OPTIONS (table_name ‘wikistat‘);
select * from wikistat;
clickhouse 的fdw 是一个不错的工具,但是对于clickhouse 的操作,当前还不是很强大
https://github.com/Percona-Lab/clickhousedb_fdw
https://hub.docker.com/repository/docker/dalongrong/pgspider
https://github.com/rongfengliang/pgspider-docker
https://github.com/rongfengliang/clickhouse-fdw-docker-learning
标签:启动服务 replace engine har http 昨天 span ppi click
原文地址:https://www.cnblogs.com/rongfengliang/p/12344929.html