TDengine 2.6 taosdump数据导出备份 导入恢复
官方文档
taosdump 数据导出
cd taos/bin 目录
#导出备份
./taosdump -o ./dump备份目录 -A -B 5000 -T 4
#备份所有数据库:指定 -A 或 --all-databases 参数;
#备份多个指定数据库:使用 -D db1,db2,... 参数;
# 压缩文件 方便传输tar -zcvf dump.tar.gz ./dump目录
taosdump 数据恢复
# 解压文件 方便传输
tar -zxvf dump.tar.gz
# 导入
taosdump -i ./dump导出文件存放路径
docker处理导入
docker -V 挂载的磁盘目录,上传备份文件
C:\Users\S>docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
36aa282750d4 tdengine/tdengine:2.6.0.34 "/tini -- /usr/bin/e…" 9 months ago Up 2 minutes 0.0.0.0:6030->6030/tcp, 0.0.0.0:6041->6041/tcp, 0.0.0.0:6043-6049->6043-6049/tcp, 0.0.0.0:6060->6060/tcp, 0.0.0.0:6044-6045->6044-6045/udp td2.6C:\Users\S>docker exec -it 36aa282750d4 bash
root@36aa282750d4:~# cd /usr/local/taos/bin
root@36aa282750d4:/usr/local/taos/bin# taosdump -i /tmp/dump挂载的目录
taosdump命令行参数
Usage: taosdump [OPTION...] dbname [tbname ...]or: taosdump [OPTION...] --databases db1,db2,...or: taosdump [OPTION...] --all-databasesor: taosdump [OPTION...] -i inpathor: taosdump [OPTION...] -o outpath-h, --host=HOST Server host dumping data from. Default islocalhost.-p, --password User password to connect to server. Default istaosdata.-P, --port=PORT Port to connect-u, --user=USER User name used to connect to server. Default isroot.-c, --config-dir=CONFIG_DIR Configure directory. Default is /etc/taos-i, --inpath=INPATH Input file path.-o, --outpath=OUTPATH Output file path.-r, --resultFile=RESULTFILE DumpOut/In Result file path and name.-a, --allow-sys Allow to dump system database-A, --all-databases Dump all databases.-D, --databases=DATABASES Dump inputted databases. Use comma to separatedatabases' name.-N, --without-property Dump database without its properties.-s, --schemaonly Only dump tables' schema.-y, --answer-yes Input yes for prompt. It will skip data filechecking!-d, --avro-codec=snappy Choose an avro codec among null, deflate, snappy,and lzma.-S, --start-time=START_TIME Start time to dump. Either epoch orISO8601/RFC3339 format is acceptable. ISO8601format example: 2017-10-01T00:00:00.000+0800 or2017-10-0100:00:00:000+0800 or '2017-10-0100:00:00.000+0800'-E, --end-time=END_TIME End time to dump. Either epoch or ISO8601/RFC3339format is acceptable. ISO8601 format example:2017-10-01T00:00:00.000+0800 or2017-10-0100:00:00.000+0800 or '2017-10-0100:00:00.000+0800'-B, --data-batch=DATA_BATCH Number of data per query/insert statement whenbackup/restore. Default value is 16384. If you see'error actual dump .. batch ..' when backup or ifyou see 'WAL size exceeds limit' error whenrestore, please adjust the value to a smaller oneand try. The workable value is related to thelength of the row and type of table schema.-I, --inspect inspect avro file content and print on screen-L, --loose-mode Using loose mode if the table name and column nameuse letter and number only. Default is NOT.-n, --no-escape No escape char '`'. Default is using it.-T, --thread-num=THREAD_NUM Number of thread for dump in file. Default is8.-C, --cloud=CLOUD_DSN specify a DSN to access TDengine cloud service-R, --restful Use RESTful interface to connect TDengine-t, --timeout=SECONDS The timeout seconds for websocket to interact.-g, --debug Print debug info.-?, --help Give this help list--usage Give a short usage message-V, --version Print program versionMandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.Report bugs to <support@taosdata.com>.