1.Docker Checkpoint/Restore
Docker Checkpoint/Restore
åï¼ææ¶å°è®°ä¸ä¸checkpoint / restoreï¼å¸æä¹åè½åé¡¾å¹¶æ·±å ¥è®¤è¯ä¸ç®åçé®é¢ãCRIUå ¨ç§°âCheckpoint / Restore in Userspaceâï¼æ¯ä¸ä¸ªä¸ºLinuxæä¾æ£æ¥ç¹/æ¢å¤åè½çå·¥å ·ï¼ä¸»è¦æ¯å¯¹è¿è¡ä¸çåºç¨è¿è¡å»ç»(freeze)ååºäºå ¶å¨ç£çä¸çæææ件建ç«æ£æ¥ç¹ï¼å¹¶æ ¹æ®checkpointæ¢å¤å»ç»æ¶ç¶æ并继ç»è¿è¡ãCRIUå¯ä»¥è¿ç¨å°åºæ¯å æ¬ï¼åºç¨çè¿ç§»ï¼live migrationï¼ãå¿«ç §ãè¿ç¨è°è¯ï¼debuggingï¼ççãCRIU为OpenVZãLXZ/LXDãDockerçé½æä¾äºå¾å¥½çæ¯æã
/procæ¯ä¸ä¸ªåºäºå åçæ件系ç»ï¼å æ¬CPUãå åãååºååã[I/Oå°å]ãç´æ¥å å访é®ééåæ£å¨è¿è¡çè¿ç¨ççï¼Linuxéè¿/proc访é®å æ ¸å é¨æ°æ®ç»æåæ´æ¹å æ ¸è®¾ç½®çãCheckpointå¾å¤§ç¨åº¦ä¸æ¯åºäº/procæ件系ç»è¿è¡çï¼ä¸»è¦ä¾èµ/procè·åæ件æ述符信æ¯ã管éåæ°ãå åæ å°çã
Checkpointéè¿è¿ç¨è½¬åå¨(process dumper)è¿è¡ä»¥ä¸æ¥éª¤ï¼
Restoreæ¢å¤è¿ç¨ä¸»è¦è¿è¡ä»¥ä¸æ¥éª¤ï¼
Docker containerå®é ä¸ä¹æ¯ä¸ä¸ªè¿ç¨ï¼æ CRIUå®è´¨ä¸æ¯å¯¹å®¹å¨è¿ç¨è¿è¡checkpoint/restoreã
æºç è£ CRIUæä¸ä¸¢ä¸¢éº»ç¦ï¼è®°å¾æå®ç½è¯´çé£äºåºé½ä¸å®æ´å¦ã
dockerè½ç¶æä¾äºcheckpointï¼ä½åæ¢è³experimentalä¸æè½ç¨ï¼æ°å»º/etc/docker/daemon.jsonæ件ï¼ï¼dockerçé ç½®æ件ï¼é»è®¤æ²¡æï¼ã
è¥è¯¥æ件åæ°æ´æ¹å¾å¤ï¼å°±ä¼èµ·å²çª......解å³åæ³ï¼å°½éåªå°èªå·±éè¦æ´æ¹çé ç½®åæ°åå ¥å°±å¥½ï¼è¥è¿å²çªï¼å°±å¯å¨dockeræ¶æå¨æå®åæ°æèæ¬å¯å¨å§ã
å¦å¤ï¼æ使ç¨docker åä¹åççæ¬æ¶ï¼checkpointæ æ³æ£å¸¸ä½¿ç¨ï¼ä¸»è¦åºç°ä»¥ä¸é®é¢ï¼
æ®è¯´æ¯?源码抛物线 源码mobyçåå ï¼ä½çStackflowä¸çé®é¢ä¹è¿æ¯opençï¼å ³éäºä¸ä¸ªä½æè§ä»å ³çè«åå ¶å¦ï¼æä¸ä¸ªé®é¢ä¸ï¼å¼å人å说解å³äºï¼ä½è¿æªæ¨å°æ°çæ¬ãæç解å³åæ³ï¼è¯éªä¹åï¼å»ºè®®ä½¿ç¨è¾æ°çæ¬.è¿è¡checkpoint/restoreï¼å¯ä»¥æ£å¸¸ä½¿ç¨ï¼å¯è½çæ¬ï¼å°çå¹´æ¹ï¼å°æªå©å¨¶ï¼å¤ªæ°äºèè·è¿æ²¡ç«ç¨³ã
ç°å¨å¯ä»¥å¼å§æå¿«å°ä½¿ç¨docker checkpointäºï¼ï¼Docker CLIæä¾äºcheckpointå½ä»¤ã
create
ls
rmæ è¯å¯è¯´
start
å¯å¨æ¶æ²¡æåç¬çå½ä»¤ï¼ä½å¨container startå¯ä»¥æå®checkpointé项åæ°ï¼å¦å°å®¹å¨ä»/home/vickee/chkps/ç®å½ä¸çchkp0æ¢å¤ï¼
注æï¼å¨å建checkpointæ¶ï¼è¥æ们æå®çè·¯å¾ä¸º/home/PATHï¼åæ¢å¤æ¶è¿éè¦å ·ä½æå®å°è¯¥è·¯å¾ä¸ç/home/PATH/[CONTAINER_FULL_ID]/checkpointsãå 为æ¢å¤æ¶ï¼æ们å¯è½æ°å»ºå®¹å¨ï¼æè å°å¦ä¸ä¸ªå®¹å¨ä»å«ç容å¨çcheckpointæ¢å¤ï¼æ éèªå·±æ ¹æ®checkpointä¿¡æ¯è¿è¡è·¯å¾å®åã
CRIU对ææ°å æ ¸çæ¯ææéï¼ä¸å¥½åå¨è¾æ°çæ¬ä¸ï¼ç§»é¤äº--checkpoint-dirå³æå®ç®å½è¿ä¸ç¹æ§ã
è¥å®¹å¨è¿è¡æ¶æç¨external terminalï¼ docker run -t ï¼ï¼checkpointä¼å¤±è´¥çã[ åæ°-t 让dockeråé ä¸ä¸ªä¼ªç»ç«¯å¹¶ç»å®å°å®¹å¨çæ åè¾å ¥ä¸, -i å让容å¨çæ åè¾å ¥ä¿ææå¼ï¼å¸¸ä¸èµ·ä½¿ç¨ã]
linksï¼
https://criu.org/Docker
https://criu.org/Installation
https://criu.org/Checkpoint/Restore
2024-12-23 00:36
2024-12-23 00:35
2024-12-23 00:09
2024-12-22 23:32
2024-12-22 22:45
2024-12-22 21:58