<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                # Clean up > 原文:[https://docs.gitlab.com/ee/raketasks/cleanup.html](https://docs.gitlab.com/ee/raketasks/cleanup.html) * [Remove unreferenced LFS files](#remove-unreferenced-lfs-files) * [Remove unreferenced LFS files immediately](#remove-unreferenced-lfs-files-immediately) * [Clean up project upload files](#clean-up-project-upload-files) * [Clean up project upload files from filesystem](#clean-up-project-upload-files-from-filesystem) * [Clean up project upload files from object storage](#clean-up-project-upload-files-from-object-storage) * [Remove orphan artifact files](#remove-orphan-artifact-files) * [Remove expired ActiveSession lookup keys](#remove-expired-activesession-lookup-keys) * [Container Registry garbage collection](#container-registry-garbage-collection) # Clean up[](#clean-up-core-only "Permalink") GitLab 提供 Rake 任務來清理 GitLab 實例. ## Remove unreferenced LFS files[](#remove-unreferenced-lfs-files "Permalink") 在 GitLab 12.10 中[引入](https://gitlab.com/gitlab-org/gitlab/-/issues/36628) . **危險:**不要在 GitLab 升級后的 12 小時內運行此程序. 這是為了確保所有后臺遷移均已完成,否則可能導致數據丟失. 當您從存儲庫的歷史記錄中刪除 LFS 文件時,它們將變成孤立文件并繼續占用磁盤空間. 使用此 Rake 任務,您可以從數據庫中刪除無效的引用,這將允許對 LFS 文件進行垃圾回收. 例如: ``` # omnibus-gitlab sudo gitlab-rake gitlab:cleanup:orphan_lfs_file_references PROJECT_PATH="gitlab-org/gitlab-foss" # installation from source bundle exec rake gitlab:cleanup:orphan_lfs_file_references RAILS_ENV=production PROJECT_PATH="gitlab-org/gitlab-foss" ``` 您也可以使用`PROJECT_ID`而不是`PROJECT_PATH`指定項目. 例如: ``` $ sudo gitlab-rake gitlab:cleanup:orphan_lfs_file_references PROJECT_PATH="gitlab-org/gitlab-foss" I, [2019-12-13T16:35:31.764962 #82356] INFO -- : Looking for orphan LFS files for project GitLab Org / GitLab Foss I, [2019-12-13T16:35:31.923659 #82356] INFO -- : Removed invalid references: 12 ``` 默認情況下,此任務不會刪除任何內容,但會顯示它可以刪除多少個文件引用. 如果您確實要刪除引用,請運行`DRY_RUN=false`的命令. 您還可以使用`LIMIT={number}`參數來限制已刪除引用的數量. 請注意,此 Rake 任務僅刪除對 LFS 文件的引用. 未引用的 LFS 文件將在以后(每天一次)進行垃圾收集. 如果您需要立即進行垃圾回收,請運行以下描述的`rake gitlab:cleanup:orphan_lfs_files` . ### Remove unreferenced LFS files immediately[](#remove-unreferenced-lfs-files-immediately "Permalink") 在 GitLab 12.10 中[引入](https://gitlab.com/gitlab-org/gitlab/-/issues/36628) . 每天都會刪除未引用的 LFS 文件,但是如果需要,您可以立即刪除它們. 例如: ``` # omnibus-gitlab sudo gitlab-rake gitlab:cleanup:orphan_lfs_files # installation from source bundle exec rake gitlab:cleanup:orphan_lfs_files ``` 輸出示例: ``` $ sudo gitlab-rake gitlab:cleanup:orphan_lfs_files I, [2020-01-08T20:51:17.148765 #43765] INFO -- : Removed unreferenced LFS files: 12 ``` ## Clean up project upload files[](#clean-up-project-upload-files "Permalink") 如果項目上傳文件在 GitLab 數據庫中不存在,請清理它們. ### Clean up project upload files from filesystem[](#clean-up-project-upload-files-from-filesystem "Permalink") 在 GitLab 11.2 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/20863) . 如果本地項目上傳文件在 GitLab 數據庫中不存在,請清理它們. 如果該任務可以找到其項目,則該任務將嘗試修復該文件,否則,它將文件移至丟失并找到的目錄. ``` # omnibus-gitlab sudo gitlab-rake gitlab:cleanup:project_uploads # installation from source bundle exec rake gitlab:cleanup:project_uploads RAILS_ENV=production ``` 輸出示例: ``` $ sudo gitlab-rake gitlab:cleanup:project_uploads I, [2018-07-27T12:08:27.671559 #89817] INFO -- : Looking for orphaned project uploads to clean up. Dry run... D, [2018-07-27T12:08:28.293568 #89817] DEBUG -- : Processing batch of 500 project upload file paths, starting with /opt/gitlab/embedded/service/gitlab-rails/public/uploads/test.out I, [2018-07-27T12:08:28.689869 #89817] INFO -- : Can move to lost and found /opt/gitlab/embedded/service/gitlab-rails/public/uploads/test.out -> /opt/gitlab/embedded/service/gitlab-rails/public/uploads/-/project-lost-found/test.out I, [2018-07-27T12:08:28.755624 #89817] INFO -- : Can fix /opt/gitlab/embedded/service/gitlab-rails/public/uploads/foo/bar/89a0f7b0b97008a4a18cedccfdcd93fb/foo.txt -> /opt/gitlab/embedded/service/gitlab-rails/public/uploads/qux/foo/bar/89a0f7b0b97008a4a18cedccfdcd93fb/foo.txt I, [2018-07-27T12:08:28.760257 #89817] INFO -- : Can move to lost and found /opt/gitlab/embedded/service/gitlab-rails/public/uploads/foo/bar/1dd6f0f7eefd2acc4c2233f89a0f7b0b/image.png -> /opt/gitlab/embedded/service/gitlab-rails/public/uploads/-/project-lost-found/foo/bar/1dd6f0f7eefd2acc4c2233f89a0f7b0b/image.png I, [2018-07-27T12:08:28.764470 #89817] INFO -- : To cleanup these files run this command with DRY_RUN=false $ sudo gitlab-rake gitlab:cleanup:project_uploads DRY_RUN=false I, [2018-07-27T12:08:32.944414 #89936] INFO -- : Looking for orphaned project uploads to clean up... D, [2018-07-27T12:08:33.293568 #89817] DEBUG -- : Processing batch of 500 project upload file paths, starting with /opt/gitlab/embedded/service/gitlab-rails/public/uploads/test.out I, [2018-07-27T12:08:33.689869 #89817] INFO -- : Did move to lost and found /opt/gitlab/embedded/service/gitlab-rails/public/uploads/test.out -> /opt/gitlab/embedded/service/gitlab-rails/public/uploads/-/project-lost-found/test.out I, [2018-07-27T12:08:33.755624 #89817] INFO -- : Did fix /opt/gitlab/embedded/service/gitlab-rails/public/uploads/foo/bar/89a0f7b0b97008a4a18cedccfdcd93fb/foo.txt -> /opt/gitlab/embedded/service/gitlab-rails/public/uploads/qux/foo/bar/89a0f7b0b97008a4a18cedccfdcd93fb/foo.txt I, [2018-07-27T12:08:33.760257 #89817] INFO -- : Did move to lost and found /opt/gitlab/embedded/service/gitlab-rails/public/uploads/foo/bar/1dd6f0f7eefd2acc4c2233f89a0f7b0b/image.png -> /opt/gitlab/embedded/service/gitlab-rails/public/uploads/-/project-lost-found/foo/bar/1dd6f0f7eefd2acc4c2233f89a0f7b0b/image.png ``` ### Clean up project upload files from object storage[](#clean-up-project-upload-files-from-object-storage "Permalink") 在 GitLab 11.2 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/20918) . 如果對象存儲庫上載文件在 GitLab 數據庫中不存在,請將其移動到丟失和找到的目錄中. ``` # omnibus-gitlab sudo gitlab-rake gitlab:cleanup:remote_upload_files # installation from source bundle exec rake gitlab:cleanup:remote_upload_files RAILS_ENV=production ``` Example output: ``` $ sudo gitlab-rake gitlab:cleanup:remote_upload_files I, [2018-08-02T10:26:13.995978 #45011] INFO -- : Looking for orphaned remote uploads to remove. Dry run... I, [2018-08-02T10:26:14.120400 #45011] INFO -- : Can be moved to lost and found: @hashed/6b/DSC_6152.JPG I, [2018-08-02T10:26:14.120482 #45011] INFO -- : Can be moved to lost and found: @hashed/79/02/7902699be42c8a8e46fbbb4501726517e86b22c56a189f7625a6da49081b2451/711491b29d3eb08837798c4909e2aa4d/DSC00314.jpg I, [2018-08-02T10:26:14.120634 #45011] INFO -- : To cleanup these files run this command with DRY_RUN=false ``` ``` $ sudo gitlab-rake gitlab:cleanup:remote_upload_files DRY_RUN=false I, [2018-08-02T10:26:47.598424 #45087] INFO -- : Looking for orphaned remote uploads to remove... I, [2018-08-02T10:26:47.753131 #45087] INFO -- : Moved to lost and found: @hashed/6b/DSC_6152.JPG -> lost_and_found/@hashed/6b/DSC_6152.JPG I, [2018-08-02T10:26:47.764356 #45087] INFO -- : Moved to lost and found: @hashed/79/02/7902699be42c8a8e46fbbb4501726517e86b22c56a189f7625a6da49081b2451/711491b29d3eb08837798c4909e2aa4d/DSC00314.jpg -> lost_and_found/@hashed/79/02/7902699be42c8a8e46fbbb4501726517e86b22c56a189f7625a6da49081b2451/711491b29d3eb08837798c4909e2aa4d/DSC00314.jpg ``` ## Remove orphan artifact files[](#remove-orphan-artifact-files "Permalink") 版本歷史 * 在 GitLab 12.1 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/29681) . * 在 GitLab 12.10 中[修復](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/28023)了[`ionice`支持](https://gitlab.com/gitlab-org/gitlab/-/merge_requests/28023) . 如果發現磁盤上的作業工件文件多于應有的數量,則可以運行: ``` sudo gitlab-rake gitlab:cleanup:orphan_job_artifact_files ``` 該命令: * 掃描整個工件文件夾. * 檢查哪些文件在數據庫中仍然有記錄. * 如果找不到數據庫記錄,那么將從磁盤中刪除該文件. 默認情況下,此任務不會刪除任何內容,但會顯示它可以刪除的內容. 如果您實際上要刪除文件,請運行`DRY_RUN=false`的命令: ``` sudo gitlab-rake gitlab:cleanup:orphan_job_artifact_files DRY_RUN=false ``` 您還可以使用`LIMIT`要刪除的文件數: ``` sudo gitlab-rake gitlab:cleanup:orphan_job_artifact_files LIMIT=100 ``` 這只會從磁盤上刪除多達 100 個文件. 您可以使用此功能刪除一小集以進行測試. 如果提供`DEBUG=1` ,則將看到被檢測為孤立文件的每個文件的完整路徑. 如果安裝了`ionice` ,則任務將使用它來確保命令不會在磁盤上造成太大的負載. 您可以使用`NICENESS`配置`NICENESS`級別. 以下是有效水平,但請務必咨詢`man 1 ionice` . * `0` or `None` * `1` or `Realtime` * `2` or `Best-effort` (default) * `3` or `Idle` ## Remove expired ActiveSession lookup keys[](#remove-expired-activesession-lookup-keys "Permalink") 在 GitLab 12.2 中[引入](https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/30668) . ``` # omnibus-gitlab sudo gitlab-rake gitlab:cleanup:sessions:active_sessions_lookup_keys # installation from source bundle exec rake gitlab:cleanup:sessions:active_sessions_lookup_keys RAILS_ENV=production ``` ## Container Registry garbage collection[](#container-registry-garbage-collection "Permalink") 容器注冊表可以使用大量的磁盤空間. 為了清除未使用的層,注冊表包括一個[垃圾收集命令](../administration/packages/container_registry.html#container-registry-garbage-collection) .
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看