Magento: Backup Advice

时光毁灭记忆、已成空白 提交于 2019-12-11 05:22:35

问题


This could just as well apply to any ecommerce system such as Magento.

I have a new Magento installation and I want to be prepared for when the client asks me about backups. I am aware of all (or most) of the methods of taking backups, and also the various bits that are protected by each type, however the concern I have is to do with open orders. What happens to orders placed after the most recent DB backup in the event of a restore? I presume a DB backup would store the open orders on the system, however obviously I cant be taking and storing backups every second of the day.

So what happens to the orders taken after the last backup if the database gets corrupted and needs to be restored? I presume there'd be at least a chance that some orders might be lost. Am I wrong? If not, then what is standard practice for this ? The goods my client is selling are not that cheap, so typical orders are at least into hundreds (of euro).


回答1:


There are 2 things I can think of right now:

1) Setup replication. This will ensure that your backup is always up to date and that you can quickly switch to the slave in case something happens to the master.

2) Export an order automatically, once an order is completed. You can make use of magento's event/observer implementation to export orders to other systems or to just send plain copies to some email address, depending on what exactly you want to backup.




回答2:


I know the answer was already selected, but for others that may go here I may as well throw in some input.

I prefer nightly backups for magento. This isn't for record keeping, but it's for shit hits the roof type senarios. If something really goes bad, you're better off getting the store up and running ASAP and worrying about open orders and lost sales information once the store is up.

The backup script is crude, but it makes a gziped copy of the database and file directory in a directory that you can make for backups. It appends the month and day to the files. You need to make sure the user has the correct permissions to tar the magento file structure.

!/bin/sh
m_user='databaseusername'
m_pass='databasepasswd'
db_name='databasename'
od='/home/user/backups/website/' #output directory of the backups
id='/var/www/html/' #the location of the site
name=$od$db_name
name+="_"
mysqldump --opt -u $m_user -p$m_pass $db_name | gzip -c | cat > $name$(date +%m-%d).sql.gz; tar -zcvf $name$(date +%m-%d).tar.gz $id

I also grab all order, customer, and item info and store them in a separate server, but it's for a different business purpose.



来源:https://stackoverflow.com/questions/8497876/magento-backup-advice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!