Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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:

share|improve this answer
Is that means Memcached do nothing for write? – cewebugil Mar 5 '11 at 15:01
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


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.