尊龙凯时人生就是博

ÔõÑùÔÚLinuxÉÏʹÓÃDocker¹¹½¨¸ß¿ÉÓõÄÂþÑÜʽÎļþ´æ´¢ÏµÍ³£¿

ÔõÑùÔÚlinuxÉÏʹÓÃdocker¹¹½¨¸ß¿ÉÓõÄÂþÑÜʽÎļþ´æ´¢ÏµÍ³£¿

ÕªÒª£º±¾ÎÄÏÈÈÝÁËÔõÑùʹÓÃDocker¹¹½¨Ò»¸ö¸ß¿ÉÓõÄÂþÑÜʽÎļþ´æ´¢ÏµÍ³¡£ÎÒÃǽ«Ê¹ÓÃGlusterFS×÷ΪÎļþϵͳ£¬²¢Ê¹ÓÃDockerÈÝÆ÷½«Æä°²ÅÅÔÚ¶à¸ö½ÚµãÉÏʵÏָ߿ÉÓá£

¼ò½é

ÔÚ¹¹½¨Ò»¸ö¸ß¿ÉÓõÄÂþÑÜʽÎļþ´æ´¢ÏµÍ³Ö®Ç°£¬ÎÒÃÇÐèÒªÏàʶһЩÏìÓ¦µÄ¿´·¨ºÍÊÖÒÕ¡£GlusterFSÊÇÒ»¸öÇ¿Ê¢¡¢¿ÉÀ©Õ¹¡¢ÂþÑÜʽµÄÎļþϵͳ£¬Ëü¿ÉÒÔ½«¶ą̀ÅÌËã»úÉϵĴ洢¿Õ¼ä×éºÏ³ÉÒ»¸öͳһµÄÎļþϵͳ¡£DockerÊÇÒ»¸öÇáÁ¿¼¶µÄÈÝÆ÷»¯Æ½Ì¨£¬¿ÉÒÔ½«Ó¦ÓóÌÐò¼°ÆäÒÀÀµÏî´ò°ü³ÉÒ»¸ö×ÔÁ¦µÄÈÝÆ÷£¬´Ó¶øʵÏÖ¸ôÀëºÍ¿çƽ̨µÄ°²ÅÅ¡£

×¼±¸ÊÂÇé

ÔÚ×îÏÈ֮ǰ£¬È·±£ÄúÒѾ­×°ÖÃÁË×îа汾µÄDockerºÍDocker Compose¡£Ê¹ÓÃÒÔÏÂÏÂÁîÑéÖ¤£º

docker version
docker-compose version

µÇ¼ºó¸´ÖÆ

½¨ÉèGlusterFSÈÝÆ÷

Ê×ÏÈ£¬ÎÒÃÇÐèÒªÔÚÿ¸ö½ÚµãÉϽ¨ÉèÒ»¸öGlusterFSÈÝÆ÷¡£½¨ÉèÒ»¸öÃûΪgluster1µÄĿ¼£¬²¢ÔÚÆäÖн¨ÉèÒ»¸öÃûΪdocker-compose.ymlµÄÎļþ£¬²¢Ìí¼ÓÒÔÏÂÄÚÈÝ£º

version: '3'

services:
  glusterfs:
    image: gluster/gluster-centos
    volumes:
      - ./data:/data
    privileged: true
    network_mode: "host"

µÇ¼ºó¸´ÖÆ

È»ºó£¬Ê¹ÓÃÒÔÏÂÏÂÁîÆô¶¯ÈÝÆ÷£º

docker-compose up -d

µÇ¼ºó¸´ÖÆ

Öظ´ÒÔÉÏ°ì·¨£¬ÔÚÆäËû½ÚµãÉϽ¨ÉèÏìÓ¦µÄÈÝÆ÷¡£È·±£Ã¿¸öÈÝÆ÷µÄdocker-compose.ymlÎļþÖеÄvolumesºÍnetwork_modeÉèÖÃ׼ȷ¡£

½¨ÉèGlusterFS¾í

ÏÖÔÚ£¬ÎÒÃÇÐèÒªÔÚÿ¸ö½ÚµãÉϽ¨ÉèGlusterFS¾í¡£ÔÚÿ¸ö½ÚµãÉÏÖ´ÐÐÒÔÏÂÏÂÁ

docker exec -it <ÈÝÆ÷Ãû³Æ> gluster volume create <¾íÃû³Æ> replica <¸±±¾Êý> transport tcp <IP>:<¶Ë¿ÚºÅ>/data force

µÇ¼ºó¸´ÖÆ

ÆäÖУ¬ÈÝÆ÷Ãû³ÆÊÇGlusterFSÈÝÆ÷µÄÃû³Æ£¬¾íÃû³ÆÊÇÄúÒª½¨ÉèµÄ¾íÃû³Æ£¬¸±±¾ÊýÊÇÄúÒª½¨ÉèµÄ¸±±¾Êý£¬IPºÍ¶Ë¿ÚºÅÊÇÓÃÓÚͨѶµÄ½ÚµãµÄIPµØµãºÍ¶Ë¿ÚºÅ¡£Äú¿ÉÒÔʹÓÃdocker psÏÂÁîÉó²éÈÝÆ÷µÄÃû³Æ¡£

ÀýÈ磬ÔÚgluster1½ÚµãÉÏÖ´ÐÐÒÔÏÂÏÂÁ

docker exec -it gluster1 gluster volume create vol0 replica 2 transport tcp gluster1:49152,data gluster2:49152,data force

µÇ¼ºó¸´ÖÆ

ÔÚgluster2½ÚµãÉÏÖ´ÐÐÏàͬµÄÏÂÁî¡£

Æô¶¯GlusterFS¾í

ÔÚÿ¸ö½ÚµãÉÏÖ´ÐÐÒÔÏÂÏÂÁîÆô¶¯GlusterFS¾í£º

docker exec -it <ÈÝÆ÷Ãû³Æ> gluster volume start <¾íÃû³Æ>

µÇ¼ºó¸´ÖÆ

ÀýÈ磬ÔÚgluster1½ÚµãÉÏÖ´ÐÐÒÔÏÂÏÂÁ

docker exec -it gluster1 gluster volume start vol0

µÇ¼ºó¸´ÖÆ

ÔÚgluster2½ÚµãÉÏÖ´ÐÐÏàͬµÄÏÂÁî¡£

ÉèÖÃÎļþϵͳ¿Í»§¶Ë

ÏÖÔÚ£¬ÎÒÃÇÐèÒªÔÚÿ¸ö½ÚµãÉÏ×°ÖÃGlusterFS¿Í»§¶Ë£¬²¢¹ÒÔؽ¨ÉèµÄ¾í¡£ÔÚÿ¸ö½ÚµãÉÏÖ´ÐÐÒÔÏÂÏÂÁ

sudo apt-get install glusterfs-client
sudo mount -t glusterfs <IP>:<¾íÃû³Æ> /mnt/glusterfs

µÇ¼ºó¸´ÖÆ

ÆäÖУ¬IPÊÇGlusterFSЧÀÍÆ÷µÄIPµØµã£¬¾íÃû³ÆÊÇÄú½¨ÉèµÄ¾íÃû³Æ¡£

ÀýÈ磬ÔÚgluster1½ÚµãÉÏÖ´ÐÐÒÔÏÂÏÂÁ

sudo apt-get install glusterfs-client
sudo mount -t glusterfs gluster1:/vol0 /mnt/glusterfs

µÇ¼ºó¸´ÖÆ

ÔÚgluster2½ÚµãÉÏÖ´ÐÐÏàͬµÄÏÂÁî¡£

²âÊÔÎļþ´æ´¢ÏµÍ³

ÏÖÔÚ£¬ÎÒÃÇÒѾ­Àֳɵع¹½¨ÁËÒ»¸ö¸ß¿ÉÓõÄÂþÑÜʽÎļþ´æ´¢ÏµÍ³¡£Äú¿ÉÒÔʹÓÃ/mnt/glusterfsĿ¼¾ÙÐжÁд²Ù×÷£¬²¢ÑéÖ¤ËüÊÇ·ñÔÚÆäËû½ÚµãÉÏͬ²½¡£

echo "Hello, GlusterFS!" > /mnt/glusterfs/test.txt
cat /mnt/glusterfs/test.txt

µÇ¼ºó¸´ÖÆ

ÔÚÁíÒ»¸ö½ÚµãÉÏÖ´ÐÐÒÔÏÂÏÂÁȷ±£ÎļþÒÑÀÖ³Éͬ²½£º

cat /mnt/glusterfs/test.txt

µÇ¼ºó¸´ÖÆ

½áÂÛ

±¾ÎÄÏÈÈÝÁËÔõÑùʹÓÃDocker¹¹½¨Ò»¸ö¸ß¿ÉÓõÄÂþÑÜʽÎļþ´æ´¢ÏµÍ³¡£Í¨¹ýʹÓÃGlusterFSºÍDockerÈÝÆ÷£¬ÎÒÃÇÄܹ»¿ìËÙ¡¢Àû±ãµØʵÏָ߿ÉÓÃÐÔºÍÊý¾ÝÈßÓࡣϣÍû±¾ÎÄÄܶÔÄúÓÐËù×ÊÖú£¬×£Äú¹¹½¨Àֳɣ¡

ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏʹÓÃDocker¹¹½¨¸ß¿ÉÓõÄÂþÑÜʽÎļþ´æ´¢ÏµÍ³£¿µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí£¬°æȨÕùÒéÓë±¾Õ¾Î޹أ¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È£¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ£¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢£¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢£¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎ壬9:30-18:30£¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ