当前位置:网站首页>Clickhouse learning (IX) Clickhouse integrating MySQL
Clickhouse learning (IX) Clickhouse integrating MySQL
2022-07-29 05:33:00 【Crying dogs in the sun】
Catalog
Integrate mysql database
!!!clickhouse Improper support mysql, It also supports other databases , If necessary, you can check it on the official website
MaterializeMySQL engine
MaterializeMySQL The engine can map mysql One of the database, And it will automatically be ClickHouse Create the corresponding ReplacingMergeTree, It can directly monitor binlog Events are imported directly clickhouse in , No longer use third-party middleware .
- Creating database After that, it will be fully synchronized mysql Tables and data in , After that, it will pass binlog Incremental synchronization
- Will be created for each ReplacingMergeTree Automatic increase _sign( Whether the tag is deleted , The value is 1 and -1) and _version( Listen for adding, deleting and modifying events , If it happens, it will increase ) Field
MySQL Turn on binlog and GTID Pattern
!!! Note the version of the database , It's better to use mysql8.0 Version of , Otherwise, it is likely to report code 537 error
Get into /etc/my.cnf Add information to
Turn on binlog

Turn on GTID Pattern
Ensure the consistency of data synchronization 
To configure mysql Of default_authentication_plugin, in order to clickhouse You can create tables
default_authentication_plugin = mysql_native_password
Restart after modification mysql service
[[email protected] etc]# systemctl restart mysqld
test
Get ready MySQL Tables and data


clickhouse Open materialized view
set allow_experimental_database_materialize_mysql=1;
ClickHouse Created in MaterializeMySQL database
CREATE DATABASE [IF NOT EXISTS] db_name [ON CLUSTER cluster]
ENGINE = MaterializedMySQL(‘host:port’, [‘database’ | database], ‘user’, ‘password’) [SETTINGS …]
CREATE DATABASE test_binlog ENGINE = MaterializeMySQL('192.168.124.26:3306','mybatis','root','123456789');

Check the mapping



Insert data test
stay mysql Insert a piece of data in 

Delete the test

Delete successful 
You can't see from the table _sign and _version These two fields , Because these two fields are hidden , If you want to check, you have to add this condition yourself 
You can see that it just marks the inserted and deleted data , It's not really about data deletion or update
Integrate MySQL surface
It is similar to the operation of integrating databases, but the commands are different
CREATE TABLE [IF NOT EXISTS] [db.]table_name [ON CLUSTER cluster]
(
name1 [type1] [DEFAULT|MATERIALIZED|ALIAS expr1] [TTL expr1],
name2 [type2] [DEFAULT|MATERIALIZED|ALIAS expr2] [TTL expr2],
...
) ENGINE = MySQL('host:port', 'database', 'table', 'user', 'password'[, replace_query, 'on_duplicate_clause'])
SETTINGS
[connection_pool_size=16, ]
[connection_max_tries=3, ]
[connection_auto_close=true ]
;


边栏推荐
猜你喜欢

Alibaba cloud and Dingjie software released the cloud digital factory solution to realize the localized deployment of cloud MES system

Live broadcast Preview: integration of JD cloud Devops and jfrog product library

Day 3

365 day challenge leetcode 1000 questions - day 040 design jump table + avoid flooding + find the latest grouping with size M + color ball with reduced sales value

365 day challenge leetcode 1000 questions - day 039 full binary tree inserter + find peak II + snapshot array

510000 prize pool invites you to fight! The second Alibaba cloud ECS cloudbuild developer competition is coming

vim编辑器使用

Detailed explanation of serial port communication

阿里云联合鼎捷软件发布云上数字工厂解决方案,实现云MES系统本地化部署

科班同学真的了解未来的职业规划吗?
随机推荐
【剑指offer】— 详解库函数atoi以及模拟实现atoi函数
Redirection and files
力扣994:腐烂的橘子(BFS)
Li Kou 994: rotten orange (BFS)
The function of using wechat applet to scan code to log in to the PC web of the system
During the appointment, the 2022 JD cloud industrial integration new product launch was launched online
Preemptive appointment | Alibaba cloud shadowless cloud application online conference appointment opens
Complete ecological map of R & D Efficiency & selection of Devops tools
js深拷贝-笔记
EXIT中断详解
阿里云联合鼎捷软件发布云上数字工厂解决方案,实现云MES系统本地化部署
Thousands of databases, physical machines all over the country, JD logistics full volume cloud live record | interview with excellent technical team
·来一篇编程之路的自我介绍吧·
ClickHouse学习(十一)clickhouseAPI操作
VIM editor use
Cryengine Technology
副作用和序列点
微信小程序视频上传组件直接上传至阿里云OSS
With cloud simulation platform, Shichuang technology supports the upgrading of "China smart manufacturing"
167. 两数之和 II - 输入有序数组