Dump and replay queries from Doris database.
curl -sSL https://raw.githubusercontent.com/Thearas/dorisdump/master/install.sh | bash
By default, only SELECT
statments will be dumped. Use --only-select=false
to dump all.
# Dump
dorisdump dump --help
# Dump schemas of database db1 and db2
dorisdump dump --dump-schema --host <host> --port <port> --user root --password '******' --dbs db1,db2
# Also dump queries from db1, queries will be extracted from audit logs
# Hint: Use '*' like '/path/to/fe.audit.log*' to match multiple logs
dorisdump dump --dump-schema --dump-query --dbs db1 --audit-logs '/path/to/fe.audit.log,/path/to/fe.audit.log.20240802-1'
# Auto download audit log from remote (require SSH password or private key)
dorisdump dump --dump-query --host <host> --port <port> --ssh-password '******'
# Replay
dorisdump replay --help
# Replay queries from dump sql file
dorisdump replay --host <host> --port <port> --user root --password '******' -f /path/to/dump.sql
# Replay with args
dorisdump replay -f /path/to/dump.sql \
--from '2024-09-20 08:00:00' --to '2024-09-20 09:00:00' \ # from time to time
--users 'readonly,root' --dbs 'db1,db2' \ # filter sql by users and databases
--count 100 \ # max replay sql count
--speed 0.5 \ # replay speed
--result-dir replay1
# Diff replay result
dorisdump diff --help
# Print diff of two replay result directories
dorisdump diff replay1 replay2
-
Install optional dependences:
- On macOS: vectorscan with Chimera support
- On Linux: hyperscan with Chimera support
-
Run
make
(ormake build-hyper
if the dependences in step 1 are installed)
make gen