A package that makes it easy to make backups of your SingleStore database.
miguilim/laravel-singlestore-backup is a Laravel package for a package that makes it easy to make backups of your singlestore database..
It currently has 9 GitHub stars and 5.946 downloads on Packagist (latest version 1.3.2).
Install it with composer require miguilim/laravel-singlestore-backup.
Discover more Laravel packages by miguilim
or browse all Laravel packages to compare alternatives.
Last updated
Laravel SingleStore Backup is a package that makes it easy to make backups of your SingleStore database to your favorite storage. Behind the scenes, this package uses the BACKUP DATABASE command, a native command from SingleStore DB engine.
You can install the package via composer:
composer require miguilim/laravel-singlestore-backup
This package supports the following backup drivers:
locals3gcsazureYou must add the following lines to your .env file in order to configure your S3 credentials:
SINGLESTORE_BACKUP_DRIVER=
# Local / External storage
SINGLESTORE_BACKUP_PATH=
# External storage (S3 / GCS / Azure)
SINGLESTORE_BACKUP_ENDPOINT=
SINGLESTORE_BACKUP_BUCKET=
SINGLESTORE_BACKUP_PUBLIC_KEY=
SINGLESTORE_BACKUP_SECRET_KEY=
# S3 storage (optionals)
SINGLESTORE_BACKUP_REGION=
SINGLESTORE_BACKUP_MULTIPART_CHUNK_SIZE=
SINGLESTORE_BACKUP_FORCE_PATH_STYLE=
SINGLESTORE_BACKUP_COMPATIBILITY_MODE=
Below there is a simple example of how you use the backup command. By default, the command will do a full backup.
php artisan singlestore:backup
You can set the timeout parameter, a value specified in milliseconds, to determines the length of time to wait for the BACKUP DATABASE command to commit across the cluster. If not specified, the default_distributed_ddl_timeout global variable value is used.
php artisan singlestore:backup --timeout=30000
If you want to add the date to the backup name, you can do that by using the --with-date parameter.
php artisan singlestore:backup --with-date
If you want to add the time to the backup name, you can do that by using the --with-time parameter.
php artisan singlestore:backup --with-time
[!IMPORTANT] The
--with-dateand--with-timeparameters cannot be used in an incremental backup.
If you're making an incremental backup and want to create the INIT backup, you can do that by using the --init parameter.
php artisan singlestore:backup --init
If you're making an incremental backup and want to do a DIFFERENTIAL backup, you can do that by using the --differential parameter.
php artisan singlestore:backup --differential
You can prune backups by using the singlestore:prune-backups command. This command will prune the {$database}.backup directory by default.
php artisan singlestore:prune-backups
[!IMPORTANT] All pruning command can only be executed with the
s3driver, and they follow the path specified in theSINGLESTORE_BACKUP_PATHenvironment variable.
If you want to prune incremental backups, you can do that by using the --incremental parameter. This will prune the {$database}.incr_backup directory.
php artisan singlestore:prune-backups --incremental
If you want to prune backups older than a certain number of days, you can do that by using the --older-than-days parameter. This will prune the {$database}_(.*?).backup (respecting the date) directory.
php artisan singlestore:prune-backups --older-than-days=30
If you want to prune backups older than a certain date, you can do that by using the --older-than-date parameter. This will prune the {$database}_(.*?).backup (respecting the date) directory.
php artisan singlestore:prune-backups --older-than-date=2024-01-01
[!IMPORTANT] Be careful when using the
--older-than-dateor--older-than-daysparameters. They will prune all directories matched with the{$database}_(.*?).backuppattern + respecting the date specified. It may delete other unrelated directories if they match the pattern.
Sometimes the simple backup command with configs may not be flexible as you want. Instead, you can use the SinglestoreBackup class:
use Miguilim\LaravelSinglestoreBackup\SinglestoreBackup;
$backupInstance = new SinglestoreBackup(
driver: 'local',
database: 'mydatabase',
path: '/my-backup/path'
);
$result = $backupInstance->executeQuery();
Available arguments:
driverdatabasepathendpointtimeoutpublicKeysecretKeybucketinitdifferentialregionmultipartChunkSizeMbs3ForcePathStylecompatibilityModewithDatewithTimeYou can publish the package configuration file to your project with the following command:
php artisan vendor:publish --tag=singlestore-backup-config
Laravel SingleStore Backup is open-sourced software licensed under the MIT license.