If you have a very large datadir in MariaDB and you want to transfer the data to another host (e.g. for replication) you may want to avoid storing it locally and copying it between the hosts.
You can stream the backup directly via netcat
.
$ mkdir mariabackup
$ cd mariabackup
$ nc -l 9999 | cat - | mbstream -x
$ mariabackup --backup --stream=xbstream | nc destination-host 9999
After the streaming of the backup is complete, on the destination host run:
# systemctl stop mariadb
# rm -r /var/lib/mysql/*
To setup replication afterwards, get the output of:
# cat xtrabackup_binlog_info
Prepare and restore the backup:
$ cd ..
$ mariabackup --prepare --target-dir ./mariabackup
$ mariabackup --move-back --target-dir ./mariabackup
# chown -R mysql:mysql /var/lib/mysql/
# systemctl start mariadb