2016-02-28 58 views
0

我在使用rails中的備份gem備份數據庫時遇到了問題。在rails中使用gem「backup」備份數據庫

這是我daily_db_backup.rb

Model.new(:daily_db_backup, 'Description for daily_db_backup') do 
    database SQLite do |db| 
    db.path    = "home/ec2-user/project/db/production.sqlite3" 
    db.sqlitedump_utility = "/usr/bin/sqlite3" 
    end 

    compress_with Gzip 

    store_with S3 do |s3| 
    s3.access_key_id  = "my_key_id" 
    s3.secret_access_key = "my_access_key" 
    s3.region    = 'ap-northeast-2' 
    s3.bucket    = 'project' 
    s3.path    = 'home/ec2-user/project/db/production.sqlite3' 
    end 

    notify_by Mail do |mail| 
    mail.on_success   = true 
    mail.on_warning   = true 
    mail.on_failure   = true 
    mail.delivery_method  = :sendmail 
    mail.from     = "[email protected]" 
    mail.to     = "[email protected]" 
    end 
end 

,這些都是錯誤信息

[error] Model::Error: Backup for Description for daily_db_backup (daily_db_backup) Failed! 
[error] --- Wrapped Exception --- 
[error] Database::SQLite::Error: Database::SQLite Dump Failed! 
[error] Pipeline STDERR Messages: 
[error] (Note: may be interleaved if multiple commands returned error messages) 
[error] 
[error] Error: unable to open database "home/ec2-user/project/db/production.sqlite3": unable to open database file 
[error] The following system errors were returned: 
[error] Errno::EPERM: Operation not permitted - 'echo' returned exit code: 1 

那麼,如何解決這個問題呢?

回答

0

錯誤日誌說無法打開數據庫

「家用/ EC2用戶/項目/ DB/production.sqlite3」:無法打開數據庫文件

請檢查您的production.sqlite3路徑。我想應該是「/ home/ec2-user ...」