Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

The server OS is CentOS, with Memcached installed

Before Memcached installed, I use

mysqldump -u root -p --lock-tables --add-locks --disable-keys --skip-extended-insert --quick wcraze > /var/backup/backup.sql

But now, Memcached has been installed.

According to Wikipedia;

When the table is full, subsequent inserts cause older data to be purged in least recently used (LRU) order.

This means new data entry is not directly saved in MySQL, but saved in Memcached instead, until limit_maxbytes is full, the least accessed data will be saved in MySQL.

This means, some data is not in the MySQL but in Memcached. So, when backup, the new entry is not in the backup data

What is the right way to backup?

share|improve this question

1 Answer 1

Memcached does not persist data to disk. Your application should be using Memcached as a cache and not for any sort of persistence. All data should be in MySQL and so your backup procedure shouldn't be any different. If there is important data stored in Memcached but not MySQL then this is a serious design flaw of your application.

General overview of Memcached from MySQL: http://dev.mysql.com/doc/refman/5.1/en/ha-memcached.html

share|improve this answer
    
Is that means Memcached do nothing for write? –  cewebugil Mar 5 '11 at 15:01
1  
Memcached and MySQL are completely independent unless your application "wires" the two together somehow. Memcached is a key-value store that keeps data in memory for fast access. Reboot the Memcached server and your data is gone. Common practice is for applications to use Memcached to cache things like session data, slow running query results, etc to decrease the number of times MySQL has to be queried thus increasing performance. Memcached should only store data that is temporary or can be derived from someplace else (like MySQL). –  MDaubs Mar 5 '11 at 15:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.