一键安装Gitlab后的备份、迁移与恢复
鍒涘缓澶囦唤#gitlab-rake gitlab:backup:create浣跨敤浠ヤ笂鍛戒护浼氬湪/var/opt/gitlab/backups鐩綍涓嬪垱寤轰竴涓悕绉扮被浼间负1393513186_gitlab_鐨勫帇缂╁寘,杩欎釜鍘嬬缉鍖呭氨鏄?/span>Gitlab鏁翠釜鐨勫畬鏁撮儴鍒?/span>,鍏朵腑寮€澶寸殑1393513186鏄浠藉垱寤虹殑鏃ユ湡銆?/s
鍒涘缓澶囦唤
#gitlab-rake gitlab:backup:create
浣跨敤浠ヤ笂鍛戒护浼氬湪/var/opt/gitlab/backups鐩綍涓嬪垱寤轰竴涓悕绉扮被浼间负1393513186_gitlab_鐨勫帇缂╁寘, 杩欎釜鍘嬬缉鍖呭氨鏄?/span>Gitlab鏁翠釜鐨勫畬鏁撮儴鍒?/span>, 鍏朵腑寮€澶寸殑1393513186鏄浠藉垱寤虹殑鏃ユ湡銆?/span>
鎭㈠
# 鍋滄鐩稿叧鏁版嵁杩炴帴鏈嶅姟 gitlab-ctl stop unicorn gitlab-ctl stop sidekiq # 浠?393513186缂栧彿澶囦唤涓仮澶? gitlab-rake gitlab:backup:restore BACKUP=1393513186 # 鍚姩Gitlab sudo gitlab-ctl start
杩佺Щ
杩佺Щ濡傚悓澶囦唤涓庢仮澶嶇殑姝ラ涓€鏍?/span>, 鍙渶瑕佸皢鑰佹湇鍔″櫒/var/opt/gitlab/backups鐩綍涓嬬殑澶囦唤鏂囦欢鎷疯礉鍒版柊鏈嶅姟鍣ㄤ笂鐨?/span>/var/opt/gitlab/backups鍗冲彲(濡傛灉浣犳病淇敼杩囬粯璁ゅ浠界洰褰曠殑璇?/span>)銆備絾鏄渶瑕佹敞鎰忕殑鏄柊鏈嶅姟鍣ㄤ笂鐨?/span>Gitlab鐨勭増鏈繀椤讳笌鍒涘缓澶囦唤鏃剁殑Gitlab鐗堟湰鍙风浉鍚?/span>. 姣斿鏂版湇鍔″櫒瀹夎鐨勬槸鏈€鏂扮殑鐗堟湰鐨?/span>Gitlab, 閭d箞杩佺Щ涔嬪墠, 鏈€濂藉皢鑰佹湇鍔″櫒鐨?/span>Gitlab 鍗囩骇涓?/span>鍐嶈繘琛屽浠姐€?/span>
4.鑷姩澶囦唤
閫氳繃crontab浣跨敤澶囦唤鍛戒护瀹炵幇鑷姩澶囦唤:
sudo su - crontab -e
渚嬪鍔犲叆浠ヤ笅, 瀹炵幇姣忓ぉ鍑屾櫒2鐐硅繘琛屼竴娆¤嚜鍔ㄥ浠?
0 2 * * * /opt/gitlab/bin/gitlab-rake gitlab:backup:create
4.娉ㄦ剰浜嬮」
鈶犳坊鍔犺繖椤规槸鍥犱负娣诲姞鑷姩澶囦唤鍚庣殑鍑犲ぉ鏃堕棿閲岋紝Gitlab鎵€鍦ㄧ殑KVM涓€鐩村畷鏈恒€傞€氳繃妯℃嫙cron璁″垝浠诲姟锛屽彂鐜扮涓€鏉itlab鍒涘缓澶囦唤鐨勮繃绋嬫槸鍏堝浠藉嚭璁稿(db銆乺epo绛夋枃浠讹級锛屽啀閫氳繃杩欎簺鏂囦欢鍚堝苟鎴愪竴涓浠藉帇缂╁寘锛屾渶鍚庡垹闄ゆ枃浠讹紝鍙墿涓€涓浠藉帇缂╁寘銆傝繖灏辩浉褰撲簬鍏堜骇鐢?鍊嶅浠藉帇缂╁寘锛屽鑷寸鐩樼垎婊°€傛仮澶嶄篃鏄悓鏍风殑杩囩▼銆?/p>
鈶?/p>
Unpacking backup ... tar: 1479265387_gitlab_: Cannot open: Permission denied tar: Error is not recoverable: exiting now unpacking backup failed
杩佺Щ鐨勫浠芥枃浠舵潈闄愪笉瓒筹紝鍙互缁欒冻鏉冮檺锛岀劧鍚庡啀鎭㈠銆?/p>
鈶㈡仮澶嶈繃绋嬩腑閬囧埌涓€涓敊璇細
Started GET "/EagleEye/" for at 2016-10-25 10:54:32 +0800 Processing by ProjectsController#show as HTML Parameters: {"namespace_id"=>"EagleEye", "id"=>""} Completed 500 Internal Server Error in 215ms (ActiveRecord: ) OpenSSL::Cipher::CipherError (bad decrypt): app/models/:383:in `import_url' app/models/:413:in `external_import?' app/models/:405:in `import?' app/models/:421:in `import_in_progress?' app/controllers/projects_:93:in `show' lib/gitlab/middleware/:16:in `call'
绯荤粺鏄痗entos 鐨?,gitlab鏄縼绉诲埌鍙﹀涓€鍙版湇鍔″櫒涓婄殑锛屽叾瀹冮〉闈㈤兘鍙互姝e父鏄剧ず锛屼絾鏄竴鐐瑰嚮椤圭洰灏变細鏄剧ず500,銆傛煡鐪?var/log/gitlab/gitlab-rails/鏃ュ織锛屽彂鐜颁笂杩伴敊璇?銆?/span>
閫氳繃鎼滅储鐭ラ亾锛岃繖鏄痝itlab鏁版嵁杩佺Щ鏃剁殑涓€涓己闄枫€傝В鍐虫柟娉曪細
1銆佽鐩栧師鏉itlab鐨?nbsp;db_key_base 鍒版柊鐨刧itlab
db_key_base 浣嶇疆鍦?/span> /etc/gitlab/gitlab-
2銆丒E鐗堟湰鎵ц
sudo gitlab-rails runner "(mirror: false)(import_url: nil).each { |p| _ if _data }"
CE鐗堟湰鎵ц
sudo gitlab-rails runner "(import_url: nil).each { |p| _ if _data }"
閲嶅惎gitlab锛屽彂鐜?00閿欒涓嶈锛岄」鐩兘璁块棶鍒般€?/p>
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)