我无法备份数据库。
框架:Laravel
数据库:Mongodb
环境:拉多克
包装:Spatie / laravel备份
config / backup.php
'databases' => [ 'mongodb' ],
运行命令:php artisan backup:run
Backup failed because The dump process failed with exitcode 127 : Command not found : sh: 1: mongodump: not found
.
#0 /var/www/vendor/spatie/db-dumper/src/DbDumper.php(246): Spatie\DbDumper\Exceptions\DumpFailed::processDidNotEndSuccessfully(Object(Symfony\Component\Process\Process))
#1 /var/www/vendor/spatie/db-dumper/src/Databases/MongoDb.php(37): Spatie\DbDumper\DbDumper->checkIfDumpWasSuccessFul(Object(Symfony\Component\Process\Process), '/var/www/storag...')
#2 /var/www/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(250): Spatie\DbDumper\Databases\MongoDb->dumpToFile('/var/www/storag...')
#3 [internal function]: Spatie\Backup\Tasks\Backup\BackupJob->Spatie\Backup\Tasks\Backup\{closure}(Object(Spatie\DbDumper\Databases\MongoDb), 'mongodb')
#4 /var/www/vendor/laravel/framework/src/Illuminate/Support/Collection.php(1122): array_map(Object(Closure), Array, Array)
#5 /var/www/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(253): Illuminate\Support\Collection->map(Object(Closure))
#6 /var/www/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(167): Spatie\Backup\Tasks\Backup\BackupJob->dumpDatabases()
#7 /var/www/vendor/spatie/laravel-backup/src/Tasks/Backup/BackupJob.php(143): Spatie\Backup\Tasks\Backup\BackupJob->createBackupManifest()
#8 /var/www/vendor/spatie/laravel-backup/src/Commands/BackupCommand.php(52): Spatie\Backup\Tasks\Backup\BackupJob->run()
#9 [internal function]: Spatie\Backup\Commands\BackupCommand->handle()
#10 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array(Array, Array)
#11 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#12 /var/www/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array
, Object(Closure))
#13 /var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php(580): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NUL
L)
#14 /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php(183): Illuminate\Container\Container->call(Array)
#15 /var/www/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputS
tyle))
#16 /var/www/vendor/laravel/framework/src/Illuminate/Console/Command.php(170): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Objec
t(Illuminate\Console\OutputStyle))
#17 /var/www/vendor/spatie/laravel-backup/src/Commands/BaseCommand.php(16): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Componen
t\Console\Output\ConsoleOutput))
#18 /var/www/vendor/symfony/console/Application.php(908): Spatie\Backup\Commands\BaseCommand->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\
Output\ConsoleOutput))
#19 /var/www/vendor/symfony/console/Application.php(269): Symfony\Component\Console\Application->doRunCommand(Object(Spatie\Backup\Commands\BackupCommand), Object(Symfony\Component\C
onsole\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/vendor/symfony/console/Application.php(145): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Con
sole\Output\ConsoleOutput))
#21 /var/www/vendor/laravel/framework/src/Illuminate/Console/Application.php(90): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object
(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(122): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object
(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/artisan(37): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 {main}
Backup failed because: The dump process failed with exitcode 127 : Command not found : sh: 1: mongodump: not found
我尝试安装mongo,mongo工具...来执行mongodump,但失败了,我发现这里的问题是workspace
容器无法调用mongodump但不知道如何解决它。
答案 0 :(得分:1)
trackingTime: Date.now()
在Laradock的mongodump
容器中不可用,但在workspace
容器中。
无论如何,mongo容器无法运行php,因此无济于事。
也许您可以更改策略,创建一个名为mongo
的新容器,一旦启动该容器即可备份您的应用程序。
您可以从backup
目录中的Dockerfile
开始(以及laradock/workspace
文件中容器的定义。