我正在测试备份gem,db的大小非常小。我和我有mongodb。
我的配置是:
Backup::Model.new(:backup_db, 'Backup for my db') do
split_into_chunks_of 250
database MongoDB do |db|
db.name = "my_dev"
# db.username = ""
# db.password = ""
db.host = "localhost"
db.port = 27017
db.ipv6 = false
# db.only_collections = ["only", "these", "collections"]
db.additional_options = []
db.lock = false
db.oplog = false
end
store_with S3 do |s3|
s3.access_key_id = "my key"
s3.secret_access_key = "my key"
s3.region = "my region"
s3.bucket = "https://region-2.amazonaws.com/bucket-name"
s3.keep = 10
s3.max_retries = 3
s3.retry_waitsec = 5
s3.chunk_size = 5 # MiB
end
sync_with Cloud::S3 do |s3|
s3.access_key_id = "my key"
s3.secret_access_key = "my key"
s3.bucket = "https://region-2.amazonaws.com/bucket-name"
s3.region = "my-region"
# s3.path = ""
s3.mirror = true
s3.concurrency_type = false
s3.concurrency_level = 2
s3.directories do |directory|
end
end
compress_with Gzip
end
运行备份时,我收到以下错误:
[2017/05/30 14:23:28][error] ModelError: Backup for Backup Gauge Lrs db (backup_db) Failed!
[2017/05/30 14:23:28][error] An Error occured which has caused this Backup to abort before completion.
[2017/05/30 14:23:28][error] Reason: Excon::Errors::SocketError
[2017/05/30 14:23:28][error] break from proc-closure (LocalJumpError)
[2017/05/30 14:23:28][error]
[2017/05/30 14:23:28][error] Backtrace:
有人向我解释这个错误吗?我使用日志文件选项运行该命令。同样的日志我也在文件中。
我正在使用Rails 4.2和Ruby 2.2.1
Backup Gem版本为3.4.0
答案 0 :(得分:0)
我重新配置了备份设置,现在它运行正常。我不知道为什么之前出现这个错误。
我使用以下命令运行备份:
$ backup perform --trigger my_backup
我为使其发挥作用所采取的步骤:
我正在使用rbenv,我在新文件夹中创建了.ruby-gemset和.ruby-version并安装了备份
$ gem install backup
它安装了备份的所有依赖项。
使用我的mongodb生成模型
$ backup generate:model --trigger my_backup --storages='s3' --compressor='gzip' --notifiers='mail' --databases="mongodb"
并运行backup perform命令,它可以工作!
$ backup perform --trigger my_backup
:)