Skip to main content

backup:create

Creates a new backup of the current database state - all nodes, all relations, and (unless disabled) any stored files - and writes it to var/backup/<name> on local storage.

The name argument is optional and defaults to the current timestamp (YmdHis). The name can not be empty, ., or .., and the command fails if a backup with the same name already exists; use backup:load to restore, or backup:fetch to import one from a remote source.

Options:

  • -p, --pretty - pretty-prints the exported JSON files. Off by default, since it makes backups noticeably larger.
  • --no-files - skips exporting files, only backing up nodes and relations.

A summary.json is written alongside the backup with the node/relation/file counts, hostname, and API version - this is what backup:list reads to populate its table.

The command counts nodes and relations up front and pages through them while exporting, so it can take a while on large graphs. It does not lock the database, so changes made while a backup is running are not guaranteed to be captured consistently.

Help

php bin/console backup:create --help

Example

php bin/console backup:create test
TypeError {#397
  #message: "App\Command\BackupCreateCommand::__construct(): Argument #5 ($elementService) must be of type App\Service\ElementService, Symfony\Component\DependencyInjection\ParameterBag\ContainerBag given, called in /var/www/html/var/cache/prod/ContainerRnqxWK2/getBackupCreateCommandService.php on line 21"
  #code: 0
  #file: "./src/Command/BackupCreateCommand.php"
  #line: 53
  trace: {
    ./src/Command/BackupCreateCommand.php:53 {
      App\Command\BackupCreateCommand->__construct(ElementManager $elementManager, EntityManager $cypherEntityManager, FilesystemOperator $backupStorage, ElementToRawService $elementToRawService, ElementService $elementService, ParameterBagInterface $bag, FileService $fileService, S3Service $s3Service, FileOperationFactory $fileOperationFactory, Server500LogicExceptionFactory $server500LogicExceptionFactory)
      › private ElementToRawService $elementToRawService,
      › private ElementService $elementService,
      › private ParameterBagInterface $bag,
    }
    ./var/cache/prod/ContainerRnqxWK2/getBackupCreateCommandService.php:21 { …}
    ./var/cache/prod/ContainerRnqxWK2/App_KernelProdContainer.php:130 { …}
    ./var/cache/prod/ContainerRnqxWK2/getBackupCreateCommand_LazyService.php:21 { …}
    ./vendor/symfony/console/Command/LazyCommand.php:189 { …}
    ./vendor/symfony/console/Application.php:352 { …}
    ./vendor/symfony/framework-bundle/Console/Application.php:77 { …}
    ./vendor/symfony/console/Application.php:195 { …}
    ./vendor/symfony/runtime/Runner/Symfony/ConsoleApplicationRunner.php:49 { …}
    ./vendor/autoload_runtime.php:32 { …}
    ./bin/console:11 { …}
  }
}