ÁÄÁÄgitlabÔõÑù»Ö¸´Êý¾Ý
Ëæ×ÅgitlabÔÚ¿ªÔ´ÉçÇøºÍ¿ª·¢ÕßÖеÄÆÕ±éÓ¦Óã¬gitlabµÄÈÕÒæÖ÷ÒªÐÔʹÆä³ÉΪÁË¿ª·¢ÍŶÓÖв»¿É»òȱµÄÒ»²¿·Ö£¬ÓÉÓÚËüÌṩÁËÒ»¸öÐ×÷¿ª·¢´úÂëºÍÏîÄ¿ÖÎÀíµÄƽ̨¡£È»¶ø£¬ÈôÊÇgitlab·ºÆðÎÊÌâ»òËð»µÁË£¬ÎÒÃÇÔõÑù²Å»ª¹»»Ö¸´gitlabÄØ£¿
±¾ÎĽ«ÏÈÈÝÔõÑù´ÓÔÖÄѻָ´£¨Disaster Recovery£©Öлָ´GitLab¡£ÔÚ±¾ÎÄÖУ¬ÎÒÃǽ«ÌÖÂÛһЩ×î³£¼ûµÄGitLabÔÖÄÑ£¬²¢ÏÈÈÝÔõÑù±£»¤ÄãµÄGitLabʵÀý£¬´Ó¶øÈ·±£ÄãµÄÊý¾ÝÇå¾²¡£
±¸·ÝGitLab
Ê×ÏÈ£¬±¸·ÝGitLabÊǺÜÊÇÖ÷ÒªµÄ¡£Í¨¹ý°´ÆÚ±¸·Ý£¬¿ÉÒÔÈ·±£ÔÚGitLab·ºÆð¹ÊÕÏʱ£¬ÎÒÃÇÄܹ»»Ö¸´Êý¾Ý¡£ÎªÁ˱¸·ÝGitLab£¬ÎÒÃÇ¿ÉÒÔʹÓÃGitLab×Ô´øµÄ±¸·Ý³ÌÐò£¬Ëü¿ÉÒÔ½¨ÉèÒ»¸ötar.gzÎļþ°üÀ¨ËùÓÐGitLabÉèÖúÍÊý¾Ý¡£ÎÒÃÇ¿ÉÒÔͨ¹ýÔËÐÐÒÔÏÂÏÂÁîÀ´½¨ÉèGitLab±¸·Ý£º
sudo gitlab-rake gitlab:backup:create
¸ÃÏÂÁÔÚGitLab×°ÖøùĿ¼Ï½¨ÉèÒ»¸ö±¸·ÝÎļþ¡£ÎÒÃǽ¨Ò齫±¸·ÝÎļþ´æ´¢ÔÚÍⲿλÖûò½«ÆäÉÏ´«µ½Ôƴ洢ЧÀÍÖУ¬ÒÔ·ÀGitLabЧÀÍÆ÷±¬·¢Ó²¼þ¹ÊÕÏ»òÔÖÄÑ¡£
µã»÷ÏÂÔØ¡°àËÃûÌÃÊý¾Ý»Ö¸´¾Þ½³¡±£»
±¸·Ý»Ö¸´
ÈôÊÇGitLab±¬·¢¹ÊÕÏ»òÊý¾Ýɥʧ£¬ÎÒÃÇÐèҪʹÓñ¸·ÝÎļþ¾ÙÐлָ´¡£ÎÒÃÇ¿ÉÒÔʹÓÃÒÔÏÂÏÂÁî´Ó±¸·ÝÎļþÖл¹ÔGitLab£º
sudo gitlab-rake gitlab:backup:restore BACKUP=
ÆäÖС°backup_file¡±ÊÇÎÒÃǽ¨ÉèµÄ±¸·ÝÎļþÃû¡£ÎÒÃÇ¿ÉÒÔʹÓøÃÏÂÁîÀ´»¹ÔGitLabÊý¾Ý¿âºÍ´úÂë´æ´¢¿â¡£
Êý¾Ý¿â»Ö¸´
GitLabµÄÊý¾ÝÊÇ´æ´¢ÔÚPostgreSQLÊý¾Ý¿âÖеġ£ÈôÊÇGitLabÊý¾Ý¿â·ºÆðÎÊÌ⣬ÎÒÃÇÐèÒª¾ÙÐÐÊý¾Ý¿â»Ö¸´¡£ÎÒÃÇ¿ÉÒÔͨ¹ýÒÔÏ°취À´»Ö¸´GitLabÊý¾Ý¿â¡£
Ê×ÏÈ£¬×èÖ¹GitLabЧÀÍÆ÷µÄËùÓÐЧÀÍ£º
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
sudo gitlab-ctl stop nginx
È»ºó£¬±¸·ÝÊý¾Ý¿âÊý¾Ý£º
sudo gitlab-rake gitlab:backup:create
½ÓÏÂÀ´£¬ÎÒÃÇÐèÒª´Ó±¸·ÝÖлָ´Êý¾Ý¿â£º
sudo gitlab-rake gitlab:db:drop
sudo gitlab-rake gitlab:db:create
sudo gitlab-rake gitlab:backup:restore BACKUP=
´Ó±¸·ÝÎļþÖлָ´ºó£¬ÎÒÃÇÐèÒªÖØÐÂÆô¶¯GitLabËùÓÐЧÀÍ£º
sudo gitlab-ctl start
Git´æ´¢¿â»Ö¸´
GitLabµÄ´úÂë´æ´¢¿âλÓÚ/var/opt/gitlab/git-data/repositoriesĿ¼ÖУ¬ÈôÊÇ´æ´¢¿â·ºÆðË𻵣¬ÎÒÃÇ¿ÉÒÔʹÓñ¸·ÝÀ´»Ö¸´Ëü¡£ÎÒÃÇ¿ÉÒÔͨ¹ýÒÔÏ°취À´»Ö¸´GitLab´æ´¢¿â£º
Ê×ÏÈ£¬×èÖ¹GitLabЧÀÍÆ÷µÄËùÓÐЧÀÍ£º
sudo gitlab-ctl stop unicorn
sudo gitlab-ctl stop sidekiq
sudo gitlab-ctl stop nginx
È»ºó£¬±¸·Ý´æ´¢¿âÊý¾Ý£º
sudo gitlab-rake gitlab:backup:create
½ÓÏÂÀ´£¬ÎÒÃÇÐèÒª´Ó±¸·ÝÖлָ´´æ´¢¿â£º
sudo rm -rf /var/opt/gitlab/git-data/repositories/ .git
sudo gitlab-rake gitlab:backup:restore BACKUP=
ÆäÖС°project_name¡±ÊÇÎÒÃÇÐèÒª»Ö¸´µÄ´æ´¢¿âÃû³Æ£¬¡°backup_file¡±ÊÇÎÒÃǽ¨ÉèµÄ±¸·ÝÎļþÃû¡£
´Ó±¸·ÝÎļþÖлָ´ºó£¬ÎÒÃÇÐèÒªÖØÐÂÆô¶¯GitLabËùÓÐЧÀÍ£º
sudo gitlab-ctl start
×ܽ᣺
ÔÚ±¾ÎÄÖУ¬ÎÒÃÇÏÈÈÝÁËÔõÑù»Ö¸´GitLab´ÓÔÖÄÑÖС£±¸·ÝGitLabÊǺÜÊÇÖ÷ÒªµÄ£¬ÎÒÃǽ¨Òé°´ÆÚ±¸·ÝGitLab£¬²¢½«±¸·ÝÊý¾Ý´æ´¢ÔÚ¿É¿¿µÄλÖᣱðµÄ£¬¿ÉÒÔͨ¹ýʹÓÃGitLabµÄ±¸·ÝºÍ»Ö¸´³ÌÐòÀ´¿ìËÙ»Ö¸´GitLabµÄÊý¾Ý¡£ÈôÊÇÄúµÄGitLabЧÀÍÆ÷Óöµ½ÎÊÌ⣬ͨ¹ýʹÓÃÕâЩ°ì·¨¾ÙÐлָ´£¬Äú¿ÉÒÔÈ·±£GitLabµÄÕý³£ÔËÐв¢È·±£ÄúµÄÊý¾ÝÇå¾²¡£
ÒÔÉϾÍÊÇÁÄÁÄgitlabÔõÑù»Ö¸´Êý¾ÝµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡