网上找了找备份还原的方法,实践如下
clickhouse-client -udefault --password netjoy1234 -h127.0.0.1 --query="select * from netjoytest1.tank1 FORMAT CSV" > /home/tidb/ck_bak/1.csv clickhouse-client -udefault --password netjoy1234 -h127.0.0.1 --query="insert into netjoytest1.tank2 FORMAT CSV" < /home/tidb/ck_bak/1.csv [tidb@testjian ck_bak]$ cat 1.csv 2,"tank",0,"2021-08-23 14:21:30" 3,"tank",0,"2021-08-23 14:21:30" 4,"tank",0,"2021-08-23 14:21:30" clickhouse-client -udefault --password netjoy1234 -h127.0.0.1 --query="select * from netjoytest1.tank1 " > /home/tidb/ck_bak/1.txt clickhouse-client -udefault --password netjoy1234 -h127.0.0.1 --query="insert into netjoytest1.tank2 FORMAT TabSeparated" < /home/tidb/ck_bak/1.txt [tidb@testjian ck_bak]$ cat 1.txt 2 tank 0 2021-08-23 14:21:30 3 tank 0 2021-08-23 14:21:30 4 tank 0 2021-08-23 14:21:30
这二个方法是一样的。缺点如下:
1,备份,还原单一,不能到库只能到表
2,如果单表太大,例如4亿的数据量,导出50多个G,上面的方式估计实现不了。
转载请注明
作者:海底苍鹰
地址:http://blog.51yip.com/clickhouse/2528.html