Clickhouse彻底删除表, drop表后重新创建报错,Code: 342, Existing table metadata in ZooKeeper differs in primary key
- 如题,drop表正常,新建表时报错
- 解决方式:在zookeeper上删除表
- 重新建表成功
如题,drop表正常,新建表时报错
clickhouse建表时提示错误:
Code: 342, e.displayText() = DB::Exception: Existing table metadata in ZooKeeper differs in primary key. Stored in ZooKeeper: ${字段名} local: ${字段名} (version 21.3.9.83 (official build))
解决方式:在zookeeper上删除表
# 进入zookeeper/bin,使用zkCli.sh脚本客户端登录zookeeper
./zkCli.sh -server 127.0.0.1:2181
# 删除clickhouse表节点, 老版本使用rmr删除
deleteall /clickhouse/${db_name}/tables/01/${table_name}
# 其中${db_name}为待删除表所在数据库名,${table_name}为待删除表名。可使用ls可查看其子节点
ls /clickhouse