clickhouse使用问题记录

### mysql引擎

 create table t_mysql
(
        id     Int32,
        name   String,
) engine = MySQL('127.0.0.1:3306', 'test', 't', 'root', '123456');

mysql进行ddl:

 alter table  t modify name int ,add age tinyint;

mysql添加、修改mysql字段时,ch无法生效,需要重建,群里有人说重启可以,我测试重启没有生效

### mysql同步到ch限制

    CREATE DATABASE t_mysql ENGINE = MaterializeMySQL('127.0.0.1:3306', 'db', 'root', '123456');
库创建后,ch先全量,再做为mysql的从库实时时同步mysql数据,但有一些限制:
  1. mysql5.6及以下版不支持
  2. ch版本太低也不支持,至少20.9以上
  3. mysql参数(binlog为row,开启gtid)

     binlog_format = row
     gtid-mode = on
     enforce-gtid-consistency =1
     log-slave-updates = true # mysql从库
     default_authentication_plugin='mysql_native_password' # 8.0默认caching_sha2_password
  4. 库中如果有无主键的表,会初始化失败
  5. 不支持like (creat table t1 like t;)

     
     Code: 48. DB::Exception: Received from 192.x.x.x:9000. DB::Exception: Cannot convert create like statement to ClickHouse SQL: While executing MYSQL_QUERY_EVENT. The query: create table t_1 like t

你可能感兴趣的:(数据库)