export PGHOST=
export PGUSER=
export ZFS_POOL_NAME=
export BACKUP_USER=
export BACKUP_DIRECTORY=
export BACKUP_SERVER=
export BACKUP_TIME=
export BACKUP_SSH_KEY=
sudo zfs snapshot $ZFS_POOL_NAME/data@$NOW
sudo zfs list -t snapshot
Database server: If you are root user please skip this command
zfs allow $BACKUP_USER compression,mountpoint,create,mount,send,receive $ZFS_POOL_NAME
Backup server
zfs allow $BACKUP_USER compression,mountpoint,create,mount,send,receive $BACKUP_DIRECTORY
sudo zfs send $LAST_SNAPSHOT | ssh -i $BACKUP_SSH_KEY $BACKUP_USER@$BACKUP_SERVER sudo zfs receive -vF $BACKUP_DIRECTORY/data/$NOW
zfs rollback $LAST_SNAPSHOT
zfs destroy $SNAPSHOT_NAME