• Stars
    star
    952
  • Rank 46,134 (Top 1.0 %)
  • Language
    Go
  • License
    MIT License
  • Created over 3 years ago
  • Updated 9 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Data syncing in golang for ClickHouse.

ClickHouse Data Synchromesh

Data syncing in golang for ClickHouse.

based on go-zero

ARCH

Data workflow of a typical data warehouse architecture

avatar

Design of Data Sync

Automatically synchronizing data from MySQL/MongoDB data source to ClickHouse cluster in real time(< 2min).

sync

start up

git clone https://github.com/zeromicro/cds.git
cd cds
make up

After the build , pay attention to check if any container exits abnormally.

click http://localhost:3414/cds.html to accessing the web interface.

using username and password below to login

user: [email protected]
password: 123456

create table in ClickHouse for syncing MySQL(or MongoDB) data

Chose "create table" tab

1. Click "Target ClickHouse Database Info",
2. Click “connect”
3. Select the schema ("default") synchronized to Clickhouse
4. switch to "Data Source" 
5. MySQL input connection string root:root@tcp(mysql:3306)/test_mysql
or
MongoDB input connection string mongodb://mongo1:30001/test_mongo
6. Click “connect”
7. Select the table, such as the default example_mysql (MySQL) or example (MongoDB)
8. click "Generate create Table SQL" 
 Note: select the partition field as needed, here'PARTITION BY toYYYYMM()' can be deleted, or replaced with'PARTITION BY toYYYYMM(dt)'
9. . Click "send SQL to ClickHouse", and the successful execution will pop up below

One-time full data synchronization:

Chose "full sync" tab

1. Click "+" in the upper right corner
2. MySQL input connection string root:root@tcp(mysql:3306)/test_mysql
or
MongoDB input connection string mongodb://mongo1:30001/test_mongo
3. Click “connect”
4. Select the table, such as the default example_mysql (MySQL) or example (MongoDB)
5. Click "Target ClickHouse Database Info"
6. Click “connect”
7. Select the schema ("default") synchronized in Clickhouse
10. Click "Add", a pop-up below shows successful execution

check task status

Refresh the page

Confirm data in Clickhouse

image-20201118135156133

Turn on real-time incremental synchronization

Take mysql as an example

chose "Connector" tab

1. Click "+" in the upper right corner
2. MySQL input connection string root:root@tcp(mysql:3306)/test_mysql
3. select table 
4. Click "Add"

chose "Incremental Sync" tab

1. Click "+" in the upper right corner
2. MySQL input connection string root:root@tcp(mysql:3306)/test_mysql
3. select table 
4. Click "Target ClickHouse Database Info"
5. Click “connect”
6. Select the schema ("default") synchronized in Clickhouse
7. Click "Add", a pop-up below shows successful execution

refresh page

Verify incremental update

Execute the initialization database script again, you can insert 100000 rows of data again.

cd sit/docker/
sh ./init.sh

Verify the incremental data of mysql in clickhouse:

image-20201118135503830

clean up

To clean up all the docker containers started above and restore the initial state, you can :

cd cds
make down

only clean

cd cds
make docker_clean

data model in clickhouse

CDS中ClickHouse使用的建表方案

help

提问的智慧

如何有效的报告bug


if you like this project and want to support it,please star 🤝

More Repositories

1

go-zero

A cloud-native Go microservices framework with cli tool for productivity.
Go
27,635
star
2

zero-examples

go-zero examples
Go
822
star
3

go-queue

Kafka, Beanstalkd Pub/Sub framework.
Go
644
star
4

zero-doc

The docs for go-zero
JavaScript
528
star
5

zeromall

The mall/eshop system based on go-zero.
Go
277
star
6

awesome-zero

A curated list of awesome projects that powered by go-zero.
225
star
7

goctl-swagger

PHP
176
star
8

zero-contrib

A collection of extensions and tools for go-zero.
Go
162
star
9

go-zero-demo

the source code of the go-zero-doc
Go
70
star
10

goctl-go-compact

Go
32
star
11

portal

go-zero official documentation
TypeScript
25
star
12

goctl-intellij

A intellij plugin of goctl
Java
22
star
13

goctl-php

goctl php plugin
Go
21
star
14

go-zero-pages

go-zero-pages is the gitbook document of go-zero. This repository is a managed repository on github pages. Please do not try to add or update files in this repository, because this repository is hosted by https://github.com/zeromicro/go-zero-pages -Doc’s github action is automatically built, if you need to submit or update the document, please fork go-zero-doc to modify and submit pr
HTML
18
star
15

goctl-vscode

goctl extension for Visual Studio Code
TypeScript
17
star
16

ddl-parser

A tool to parse mysql ddl.
ANTLR
14
star
17

x

This repository is part of the go-zero project but outside the main tree. It's developed under looser compatibility requirements than the go-zero project.
Go
13
star
18

zero-api

zero-api is a RESTful API description language.
12
star
19

go-zero-doc

The gitbook source for go-zero document
JavaScript
12
star
20

goctl-android

goctl android plugin demo
Go
12
star
21

go-zero-template

A golang template repo for go-zero, Do not accept pr!
Smarty
6
star
22

zero-test

The repo for integration test of go-zero project.
5
star
23

protoc-gen-zrpc-gateway

5
star
24

goctl-plugins

goctl plugins for languages and platforms.
4
star
25

zero-legacy

The legacy mongo/mongoc packages from go-zero.
Go
4
star
26

antlr

forked from antlr/antlr4 and remove another useless code, in order to solve the antlr official module conflict bug
Go
4
star
27

grpc-mock

A gRPC mocking tool.
Go
4
star
28

zero-ci

go-zero continuous integration.
Go
3
star
29

goctl-restclient

Generate Visual Studio Code REST Client plugin files for zero-api
Go
3
star
30

go-zero.dev

go-zero.dev
JavaScript
1
star
31

goctl-vue-element-admin

生成vue-element-admin,api/views文件
1
star