Link Search Menu Expand Document

SqlBak-CLI documentation

SqlBak-CLI

SqlBak-CLI is a free command-line utility that backs up SQL Server (MSSQL) and MySQL databases, sends them to cloud storage, and restores the backups when needed. SqlBak-CLI is a simplified command-line version of the SqlBak service.

SqlBak-CLI is currently in beta testing.

Main Features

SqlBak-CLI supports both backup jobs and restore jobs.

Backup Job

  1. Creates full, differential, transaction log backups for Microsoft SQL Server and full for MySQL.
  2. Compresses backups
  3. Sends backups to cloud storage
  4. Removes obsolete backups from cloud storage
  5. Sends email notification of success

Restore Job

A restore job automatically restores the backups created by SqlBak-CLI. A restore job runs in the following way:

  1. Downloads a backup from storage
  2. Unzips the backup
  3. Restores the backup

If a differential or transaction log needs to be restored, then SqlBak-CLI will download the entire backup chain required for the restore.

Supported platforms, storage locations and databases

Operating Systems

SqlBak-CLI is a cross-platform utility that does not require any dependencies. All popular Linux distributions (Ubuntu, CentOS, Debian, etc.) are supported, as well as all versions of Windows and Windows Server.

Storage locations

  • Local folder
  • Shared folder (SMB protocol)
  • FTP
  • SFTP (transfer over SSH)
  • Backblaze B2

Databases

All versions of SQL Server, starting from 2008, MySQL Version: 5.6, 5.7, 8.0 and all MariaDB versions starting from 10.2 are supported.

SqlBak-CLI Benefits

Simplicity, but not primitive

To configure SqlBak-CLI, a JSON file with a job description should be created. Here’s an example of how to backup all databases in a shared folder:

{
	"source":{
	  "type":"mssql",
	  "data_source":".",
	  "trust_server_certificate":true,
	  "user_name":"sa",
	  "user_password":"********",
	  "database_types": [ "mssql_custom" ]
	},
	"storages":[
	  {
		 "type":"folder",
		 "path":"\\backupserver\backup\\sql-server",
		 "user_name":"mike",
		 "user_password":"*********",
		 "keep_settings":[
			{
			   "backup_type":"full",
			   "hours":720
			}
		 ]
	  }
	]
}

There are many different settings in SqlBak-CLI: from the level of compression to the rate limit when transferring to FTP. All of these settings allow customizing a job as needed. But in most cases, the default value is fine.

Support

We officially support SqlBak-CLI. Our main products are SqlBak and SqlBak-CLI, which have a common code base, so we are interested in fixing bugs and adding new features.

If you have any problems with our software or have any thoughts on how to improve it, please feel free to contact us.

Adaptivity

SqlBak-CLI is a console utility. It can be easily built into existing maintenance scripts or scheduled to run via cron jobs or the Windows Task Scheduler.

0 */24 * * * sqlbak-cli run-backup --job-settings='~/backup-settings/db-backup.json'

Roadmap

In the near future, the following features will be supported:

  1. PostgreSQL Server backup/restore
  2. MySQL incremental backups (via binary logs)
  3. Automatic email notification
  4. 7zip compression

And also many more. Send us the features you are missing.

Start with the Get Started section as there are simple instructions on how to backup and restore via SqlBak-CLI.

If you prefer to use an app with a good UI, then take a look at our other two products:

  • SQLBackupAndFTP - the original SQL Server, MySQL and PostgreSQL backup utility, with over a million installations since 2008.
  • SqlBak - an agent-based backup service for centralized backup management across multiple servers.

More examples configuring and using SqlBak-CLI.

Changelist