如何使用 mydumper 全备的备份文件中恢复某一个库,或恢复某一个库到另外一个库。类似于 myloader 中 “-B, --database ” 和 “-s, --source-db” 的功能?
你好
tidb 工具中的 loader 已不在维护,替代工具为 tidb-lightning 中的 tidb-backend 模式,与 loader 类似,可以看下说明
此需求可以根据 tidb-lightning 库表过滤完成:
好的,谢谢
ok,
您好,我在使用 tidb-lightning 时遇到了一个报错
[root@ceph1 bin]# ./tidb-lightning -config tidb-lightning.toml
Verbose debug logs will be written to /tmp/lightning.log.2020-07-01T12.48.26+0800.
tidb lightning encountered error: Error 1193: Unknown system variable 'allow_auto_random_explicit_insert'
源数据库版本 mysql8.0
导入tidb版本 4.0.0
导出语句
mydumper -h 127.0.0.1 -P 3306 -u root -a -t 16 -F 256 --skip-tz-utc -o /tmp/test
导入配置文件内容
[root@ceph1 bin]# cat tidb-lightning.toml |grep -vE "^$|^#"
[lightning]
index-concurrency = 2
table-concurrency = 6
io-concurrency = 5
[checkpoint]
enable = true
schema = "tidb_lightning_checkpoint"
driver = "file"
[tikv-importer]
backend = "tidb"
on-duplicate = "replace"
[mydumper]
read-block-size = 65536 # Byte (默认为 64 KB)
batch-size = 107_374_182_400 # Byte (默认为 100 GB)
batch-import-ratio = 0.75
data-source-dir = "/data/backup/test"
no-schema = false
character-set = "auto"
[mydumper.csv]
separator = ','
delimiter = '"'
not-null = false
null = '\N'
backslash-escape = true
trim-last-separator = false
[tidb]
host = "127.0.0.1"
port = 4000
user = "root"
password = ""
status-port = 10080
pd-addr = "192.168.20.201:2379"
log-level = "error"
build-stats-concurrency = 20
distsql-scan-concurrency = 100
index-serial-scan-concurrency = 20
checksum-table-concurrency = 16
sql-mode = "STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION"
max-allowed-packet = 67_108_864
[post-restore]
checksum = true
level-1-compact = false
compact = false
analyze = true
[cron]
switch-mode = "5m"
log-progress = "5m"
[black-white-list]
do-dbs = ["test"]
ignore-dbs = ["edoc2v5"]
日志文件报错
[2020/07/01 13:00:45.326 +08:00] [INFO] [lightning.go:205] ["load data source completed"] [takeTime=8.466467ms] []
[2020/07/01 13:00:45.326 +08:00] [INFO] [checkpoints.go:770] ["open checkpoint file failed, going to create a new one"] [path=/tmp/tidb_lightning_checkpoint.pb] [error="open /tmp/tidb_lightning_checkpoint.pb: no such file or directory"]
[2020/07/01 13:00:45.331 +08:00] [ERROR] [lightning.go:216] ["restore failed"] [error="Error 1193: Unknown system variable 'allow_auto_random_explicit_insert'"]
[2020/07/01 13:00:45.332 +08:00] [ERROR] [main.go:78] ["tidb lightning encountered error stack info"] [error="Error 1193: Unknown system variable 'allow_auto_random_explicit_insert'"] [errorVerbose="Error 1193: Unknown system variable 'allow_auto_random_explicit_insert'\
github.com/pingcap/errors.AddStack\
\t/home/jenkins/agent/workspace/build_lightning_master/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20190809092503-95897b64e011/errors.go:174\
github.com/pingcap/errors.Trace\
\t/home/jenkins/agent/workspace/build_lightning_master/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20190809092503-95897b64e011/juju_adaptor.go:15\
github.com/pingcap/tidb-lightning/lightning/common.(*MySQLConnectParam).Connect\
\t/home/jenkins/agent/workspace/build_lightning_master/go/src/github.com/pingcap/tidb-lightning/lightning/common/util.go:80\
github.com/pingcap/tidb-lightning/lightning/restore.NewTiDBManager\
\t/home/jenkins/agent/workspace/build_lightning_master/go/src/github.com/pingcap/tidb-lightning/lightning/restore/tidb.go:63\
github.com/pingcap/tidb-lightning/lightning/restore.NewRestoreControllerWithPauser\
\t/home/jenkins/agent/workspace/build_lightning_master/go/src/github.com/pingcap/tidb-lightning/lightning/restore/restore.go:168\
github.com/pingcap/tidb-lightning/lightning/restore.NewRestoreController\
\t/home/jenkins/agent/workspace/build_lightning_master/go/src/github.com/pingcap/tidb-lightning/lightning/restore/restore.go:151\
github.com/pingcap/tidb-lightning/lightning.(*Lightning).run\
\t/home/jenkins/agent/workspace/build_lightning_master/go/src/github.com/pingcap/tidb-lightning/lightning/lightning.go:214\
github.com/pingcap/tidb-lightning/lightning.(*Lightning).RunOnce\
\t/home/jenkins/agent/workspace/build_lightning_master/go/src/github.com/pingcap/tidb-lightning/lightning/lightning.go:146\
main.main\
\t/home/jenkins/agent/workspace/build_lightning_master/go/src/github.com/pingcap/tidb-lightning/cmd/tidb-lightning/main.go:75\
runtime.main\
\t/usr/local/go/src/runtime/proc.go:203\
runtime.goexit\
\t/usr/local/go/src/runtime/asm_amd64.s:1357"]
[2020/07/01 13:00:45.332 +08:00] [ERROR] [main.go:79] ["tidb lightning encountered error"] [error="Error 1193: Unknown system variable 'allow_auto_random_explicit_insert'"]
不好意思打扰了。我下载错 tidb-toolkit 版本了 。 要和tidb 版本对应。
ok,有问题开新帖讨论,感谢配合、
此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。