ÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄÈÝÆ÷´æ´¢ÐÔÄÜÓÅ»¯
ÔõÑùÔÚlinuxÉÏÉèÖø߿ÉÓõÄÈÝÆ÷´æ´¢ÐÔÄÜÓÅ»¯
СÐò£º
Ëæ×ÅÈÝÆ÷ÊÖÒÕµÄÒ»Ö±Éú³¤£¬Ô½À´Ô½¶àµÄÆóÒµ½«ÆäÓ¦ÓÃÓÚÉú²úÇéÐÎÖУ¬¶ø´æ´¢ÐÔÄÜÊÇÈÝÆ÷ÔËÐеÄÒªº¦ÒòËØÖ®Ò»¡£±¾ÎĽ«ÏÈÈÝÔÚLinuxϵͳÉÏÔõÑùÉèÖø߿ÉÓõÄÈÝÆ÷´æ´¢ÐÔÄÜÓÅ»¯£¬²¢ÌṩÏìÓ¦µÄ´úÂëʾÀý¡£
Ò»¡¢Ñ¡ÔñÊʺϵĴ洢Çý¶¯
ÔÚÉèÖÃÈÝÆ÷´æ´¢ÐÔÄÜʱ£¬Ê×ÏÈÐèҪѡÔñÊʺϵĴ洢Çý¶¯¡£³£¼ûµÄ´æ´¢Çý¶¯ÓÐOverlayFS¡¢AUFS¡¢Device MapperµÈ¡£ÏÂÃæÒÔOverlayFSΪÀý¾ÙÐÐÏÈÈÝ¡£
ÔÚLinuxϵͳÉϼì²éOverlayFSÄ£¿éÊÇ·ñÒѼÓÔØ£º
lsmod | grep overlay
µÇ¼ºó¸´ÖÆ
Èôδ¼ÓÔØ£¬ÇëÔËÐÐÒÔÏÂÏÂÁî¼ÓÔØÄ£¿é£º
modprobe overlay
µÇ¼ºó¸´ÖÆ
ÐÞ¸ÄDockerµÄĬÈÏ´æ´¢Çý¶¯£¬½«ÆäÉèÖÃΪOverlayFS¡£±à¼DockerÉèÖÃÎļþ/etc/docker/daemon.json£¬²¢Ìí¼ÓÒÔÏÂÄÚÈÝ£º
{ "storage-driver": "overlay2" }
µÇ¼ºó¸´ÖÆ
ÉúÑIJ¢ÖØÆôDockerЧÀÍ£º
systemctl restart docker
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
¶þ¡¢Ê¹ÓøßÐÔÄܵĴ洢½éÖÊ
Ñ¡ÔñºÏÊʵĴ洢½éÖÊ¿ÉÒÔÏÔÖøÌáÉýÈÝÆ÷µÄ´æ´¢ÐÔÄÜ¡£ÏÂÃæÏÈÈÝÁ½ÖÖ³£¼ûµÄ¸ßÐÔÄÜ´æ´¢½éÖÊ¡£
NVMe SSD
NVMe SSD£¨Non-Volatile Memory Express Solid-State Drive£©ÊÇÒ»ÖÖÐÂÒ»´ú¸ßËÙ´æ´¢×°±¸¡£Ê¹ÓÃNVMe SSD×÷ΪÈÝÆ÷´æ´¢½éÖÊ¿ÉÒÔ´ó·ùÌá¸ßIOÐÔÄÜ¡£ÔÚLinuxϵͳÖУ¬¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîÉó²éϵͳÊÇ·ñÒÑʶ±ð³öNVMe SSD£º
lsblk
µÇ¼ºó¸´ÖÆ
ÈôÒÑʶ±ð³öNVMe SSD£¬¿ÉÒÔ½«Æä¹ÒÔص½ºÏÊʵÄĿ¼Ï£¬È»ºóÔÚ½¨Éè»òÆô¶¯ÈÝÆ÷ʱ£¬½«´æ´¢Â·¾¶Ö¸Ïò¹ÒÔصÄĿ¼¡£
ÂþÑÜʽ´æ´¢ÏµÍ³
½ÓÄÉÂþÑÜʽ´æ´¢ÏµÍ³¿ÉÒÔ½«Êý¾ÝÊèÉ¢´æ´¢ÔÚ¶à¸ö½ÚµãÉÏ£¬Ìá¸ßÊý¾Ý»á¼ûµÄ²¢·¢ÐԺͿÉÓÃÐÔ¡£³£¼ûµÄÂþÑÜʽ´æ´¢ÏµÍ³ÓÐCeph¡¢GlusterFSµÈ¡£ÏÂÃæÒÔCephΪÀý¾ÙÐÐÉèÖá£
°ì·¨Ò»£º×°ÖÃCeph
Ê×ÏÈÐèÒªÔÚ¸÷¸ö½ÚµãÉÏ×°ÖÃCephÈí¼þ°ü£¬¿Éͨ¹ýÒÔÏÂÏÂÁî×°Öãº
yum install ceph
µÇ¼ºó¸´ÖÆ
°ì·¨¶þ£º½¨Éè´æ´¢³Ø
½ÓÏÂÀ´ÐèÒª½¨ÉèÒ»¸öCeph´æ´¢³Ø£¬ÓÃÓÚ´æ·ÅÈÝÆ÷µÄÊý¾Ý¡£¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁÉè´æ´¢³Ø£º
ceph osd pool create {pool-name} {pg-num} {pgp-num}
µÇ¼ºó¸´ÖÆ
pool-nameΪ´æ´¢³ØÃû³Æ£¬pg-numºÍpgp-numΪPG£¨Placement Group£©ÊýÄ¿£¬¿Éƾ֤ÐèÇó¾ÙÐе÷½â¡£
°ì·¨Èý£ºÓ³Éä´æ´¢³Ø
½«¸Õ½¨ÉèµÄ´æ´¢³ØÓ³ÉäΪ¿é×°±¸£¬¿Éͨ¹ýÒÔÏÂÏÂÁîʵÏÖ£º
rbd create {pool-name}/{image-name} --size {size}
µÇ¼ºó¸´ÖÆ
image-nameΪӳÉäµÄ¿é×°±¸Ãû³Æ£¬sizeΪװ±¸¾Þϸ¡£
°ì·¨ËÄ£º¹ÒÔØ¿é×°±¸
½«Ó³ÉäµÄ¿é×°±¸¹ÒÔص½ÎļþϵͳϵÄij¸öĿ¼£¬¿Éͨ¹ýÒÔÏÂÏÂÁîʵÏÖ£º
rbd map {pool-name}/{image-name} mkdir -p {mount-dir} mount /dev/rbd/{pool-name}/{image-name} {mount-dir}
µÇ¼ºó¸´ÖÆ
mount-dirΪ¹ÒÔØĿ¼¡£
°ì·¨Î壺ÉèÖÃDocker´æ´¢Çý¶¯
±à¼DockerÉèÖÃÎļþ/etc/docker/daemon.json£¬²¢Ìí¼ÓÒÔÏÂÄÚÈÝ£º
{ "storage-driver": "rbd", "storage-opts": [ "ceph.fsname={pool-name}", "ceph.conf=/etc/ceph/ceph.conf", "ceph.user={ceph-username}" ] }
µÇ¼ºó¸´ÖÆ
pool-nameΪ½¨ÉèµÄCeph´æ´¢³ØÃû³Æ£¬ceph.confΪCephÉèÖÃÎļþ·¾¶£¬ceph-usernameΪ»á¼ûCeph´æ´¢³ØµÄÓû§Ãû¡£
ÉúÑIJ¢ÖØÆôDockerЧÀÍ£º
systemctl restart docker
µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ
Èý¡¢µ÷½âÄں˲ÎÊý
µ÷½âLinuxÄں˲ÎÊý¿ÉÒÔÌáÉýÈÝÆ÷µÄ´æ´¢ÐÔÄÜ¡£ÒÔÏÂÊÇһЩ³£ÓõÄÄں˲ÎÊýµ÷½âʾÀý¡£
Ìá¸ßÎļþϵͳµÄ×î´ó·¿ªÎļþÊý£º
echo 1000000 > /proc/sys/fs/file-max
µÇ¼ºó¸´ÖÆ
Ìá¸ß´ÅÅÌIOµÄ×î´óÇëÇóÐÐÁг¤¶È£º
echo 16384 > /sys/block/sdX/queue/nr_requests
µÇ¼ºó¸´ÖÆ
ÆäÖÐsdXΪ´ÅÅÌ×°±¸±êʶ£¬¿Éƾ֤ÏÖÕæÏàÐξÙÐе÷½â¡£
µ÷½âÎļþϵͳµÄ×î´ó¾ä±úÊý£º
echo 1000000 > /proc/sys/fs/inode-max
µÇ¼ºó¸´ÖÆ
ÉúÑÄÒÔÉϲÎÊýµ÷½â£¬¿É½«ÆäÌí¼Óµ½/etc/sysctl.confÎļþÖУ¬Ê¹ÆäÔÚϵͳÆô¶¯Ê±×Ô¶¯ÉúЧ¡£
½áÂÛ£º
±¾ÎÄÏÈÈÝÁËÔÚLinuxϵͳÉÏÉèÖø߿ÉÓõÄÈÝÆ÷´æ´¢ÐÔÄÜÓÅ»¯µÄÒªÁ죬²¢ÌṩÁËÏà¹ØµÄ´úÂëʾÀý¡£Í¨¹ýÑ¡ÔñÊʺϵĴ洢Çý¶¯¡¢Ê¹ÓøßÐÔÄܵĴ洢½éÖÊ¡¢µ÷½âÄں˲ÎÊý£¬¿ÉÒÔÏÔÖøÌáÉýÈÝÆ÷µÄ´æ´¢ÐÔÄÜ£¬Öª×ãÆóÒµÉú²úÇéÐζÔÈÝÆ÷µÄÒªÇó¡£ÔÚÏÖʵÉèÖÃÖУ¬ÐèҪƾ֤ÏêϸµÄ³¡¾°ºÍÐèÇó¾ÙÐе÷½âºÍÓÅ»¯¡£
ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏÉèÖø߿ÉÓõÄÈÝÆ÷´æ´¢ÐÔÄÜÓÅ»¯µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡