A script-based Git and Harbor data synchronization method and system

By deploying a script-based Git and Harbor data synchronization method in the cloud computing platform and using intermediate nodes for automated data synchronization, the problem of cumbersome manual copying in cloud computing platform upgrades is solved, and management efficiency and platform delivery speed are improved.

CN112000740BActive Publication Date: 2024-09-27SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010857675.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-24
Publication Date
2024-09-27
Estimated Expiration
2040-08-24

AI Technical Summary

Technical Problem

In the management of cloud computing platforms, when upgrading the cloud computing platform, it is necessary to copy codes and images from the central warehouse to regional warehouses. Manual operations are cumbersome and waste time and manpower.

Method used

Adopt a script-based Git and Harbor data synchronization method, deploy synchronization modules through intermediate nodes, monitor API requests in real time, establish thread queues, perform data synchronization, avoid manual copying, and achieve data synchronization from the central warehouse to regional warehouses.

Benefits of technology

It improves the efficiency of multi-region cloud computing platform management, saves upgrade time, simplifies the data synchronization process, and supports data reverse push.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112000740B
    Figure CN112000740B
Patent Text Reader

Abstract

The present invention provides a script-based Git and Harbor data synchronization method and system, which belongs to the field of cloud computing technology. The present invention includes two parts: Git and Harbor data synchronization. The synchronization module is deployed at the intermediate node between the central warehouse and the regional warehouse, exposing the service APIs for the central warehouse and the regional warehouse respectively, and monitoring the API requests in real time. When the synchronization module receives the API request, it establishes a thread queue and executes the data synchronization thread in sequence. By adopting this method, the purpose of cross-warehouse Git and Harbor data synchronization in a cloud computing environment is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to cloud computing technology, and more particularly to a script-based cross-warehouse synchronization method and system for Git and Harbor data in lifecycle management of a cloud computing environment. Background Art

[0002] As an innovative computing model, cloud computing has the characteristics of low cost, high performance and easy maintenance. The maturity of cloud computing technology has promoted the pace of cloud computing platform construction. With the increase in the number of cloud computing platform construction, the number of cloud computing platforms that need to be managed has also increased accordingly.

[0003] In the management of cloud computing platforms, the central warehouse stores a large number of code libraries and image libraries for the life cycle management of the cloud platform. Each regional warehouse only stores the code libraries and image libraries in use. When the regional cloud computing platform is upgraded, it is necessary to obtain the code and image of the central warehouse according to the upgrade requirements. If manual copying and transmission is used, it will face cumbersome operation steps, wasting a lot of time and manpower. Summary of the invention

[0004] In order to solve the above technical problems, the present invention provides a script-based Git and Harbor data synchronization method to realize the Git and Harbor data synchronization function from the central warehouse to the regional warehouse, avoid manual data copying and transmission work, and improve the efficiency of multi-region cloud computing platform management.

[0005] The technical solution of the present invention is:

[0006] A script-based Git and Harbor data synchronization method is deployed on an intermediate node between a central warehouse and a regional warehouse and receives API requests to perform synchronization of Git data and Harbor data.

[0007] It includes two parts: data synchronization of Git and Harbor. The synchronization module is deployed on the intermediate node between the central warehouse and the regional warehouse, exposing the service APIs for the central warehouse and the regional warehouse respectively, and monitoring API requests in real time. When the synchronization module receives the API request, it establishes a thread queue and executes the data synchronization threads in sequence.

[0008] The Git data synchronization method uses the storage of the intermediate node as a cache, configures the connection information of the remote warehouse, obtains the content of the central warehouse, and then pushes the content to the regional warehouse.

[0009] The Harbor data synchronization described above uses the storage of the intermediate node as a cache. After pulling the image of the central warehouse, the image is configured with the image tag of the regional warehouse, and the image marked with this tag is pushed to the regional warehouse.

[0010] 1. Set up the configuration table

[0011] The Git connection information of the central warehouse and the regional warehouse is stored separately according to the regional ID, and the Harbor connection information of the central warehouse and the regional warehouse is stored separately according to the regional ID.

[0012] type url username password isVaild center-git xxx.xxx.xxx xxx xxx true center-harbor xxx.xxx.xxx xxx xxx true region-git xxx.xxx.xxx xxx xxx true region-harbor xxx.xxx.xxx xxx xxx true

[0013] Field Description: type is the configuration type field, which has four types: center-git, center-harbor, region-git, and region-harbor; url is the connection address of the corresponding configuration; username is the username of the corresponding configuration; password is the connection password of the corresponding configuration; isVaild indicates whether the configuration is enabled, and the options are true or false.

[0014] 2. Synchronize Git data

[0015] (1) The synchronization module exposes the service API to the central repository and regional repository. When the synchronization module receives an API request for synchronizing Git data from the central repository or regional repository, it processes the request content and adds it to the thread queue, waiting for synchronization task scheduling.

[0016] (2) Regularly obtain the highest priority synchronization thread from the thread queue and start executing Git data synchronization.

[0017] (3) The synchronization module obtains the connection information of the central warehouse from the configuration table, initializes the synchronization task cache directory, and completes the configuration of the remote central warehouse information.

[0018] (4) The synchronization module pulls the specified content temporary cache directory from the remote central warehouse, obtains the connection information of the regional warehouse from the configuration table, configures the connection information to the local cache project warehouse, and then pushes the local cache file to the remote regional warehouse.

[0019] (5) Close the Git synchronization thread and clean up the local cache files.

[0020] 3. Synchronize Harbor data

[0021] (1) When the synchronization module receives an API request for synchronizing Harbor data from the central warehouse, it processes the request content and adds it to the thread queue, waiting for synchronization task scheduling.

[0022] (2) Regularly obtain the highest priority synchronization thread from the thread queue and start executing Harbor data synchronization.

[0023] (3) The synchronization module obtains the connection information of the central warehouse from the configuration table. The synchronization module pulls the image file of the remote central warehouse and temporarily stores it in the local image library. It obtains the connection information of the regional warehouse from the configuration table, reconfigures the tag of the image according to the URL address in the configuration table, and finally pushes the tag to the regional Harbor warehouse.

[0024] (9) Close the Harbor synchronization thread and clean up the local cache files.

[0025] In addition, the present invention also discloses a script-based Git and Harbor data synchronization system, in which the data synchronization function is implemented by three parts: API Server, thread scheduling, and synchronization module;

[0026] The API Server monitors user requests from the central warehouse and regional warehouses;

[0027] Thread scheduling is responsible for scheduling synchronization threads;

[0028] The synchronization module is responsible for performing data synchronization operations between Git and Harbor;

[0029] The above three main modules are deployed at the intermediate nodes between the central warehouse and the regional warehouse;

[0030] The client in the regional warehouse acts as the initiator of the synchronization task, and ultimately obtains the file content in the central warehouse through the intermediate node and synchronizes it to the regional warehouse.

[0031] The synchronous task execution is implemented as follows:

[0032] (1) The regional warehouse user calls the data synchronization API. The API Server located on the intermediate node listens to the user request, processes the request content, and adds it to the thread queue.

[0033] (2) The thread scheduling module obtains the synchronization thread with the highest priority from the thread queue, identifies the same data type, and executes Git data synchronization or Harbor data synchronization.

[0034] (3) If the synchronization data type is Git data, the Git synchronization module will be executed; the synchronization module initializes the synchronization task cache directory and completes the remote central warehouse information configuration.

[0035] (4) The Git synchronization module pulls the specified content from the remote central repository and temporarily stores it in the local cache directory. Then, based on the configured remote regional repository information, it pushes the local cache file to the remote regional repository.

[0036] (5) If the synchronization data type is Harbor data, the Harbor synchronization module will be executed;

[0037] (6) The Harbor synchronization module pulls the image file from the remote central warehouse and temporarily stores it in the local image library. It then configures the tag of the remote regional warehouse and pushes the tag to the regional Harbor warehouse.

[0038] (7) Close the synchronization thread and clean up the local cache files.

[0039] The beneficial effects of the present invention are

[0040] The cross-regional data synchronization function of the central warehouse and the regional warehouse is realized, avoiding the tedious steps of manual copying and transmission, saving the upgrade time of the cloud computing platform and improving the platform delivery speed. At the same time, if the data of the regional warehouse needs to be backed up in the central warehouse, data reverse push is also supported. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 is a schematic diagram of the data synchronization architecture of the present invention;

[0042] Figure 2 It is a schematic diagram of the synchronous task execution flow of the present invention. DETAILED DESCRIPTION

[0043] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0044] The present invention mainly consists of two parts. The first part synchronizes Git data, and the second part synchronizes Harbor data.

[0045] See also Figure 1 , the data synchronization architecture of the present invention is as follows:

[0046] The data synchronization function is implemented by three parts. The API Server listens to user requests from the central warehouse and the regional warehouse; the thread scheduler is responsible for scheduling the synchronization thread; the synchronization module is responsible for executing the data synchronization operation between Git and Harbor. The above three main modules are deployed in the intermediate node between the central warehouse and the regional warehouse.

[0047] The client in the regional warehouse acts as the initiator of the synchronization task, and ultimately obtains the file content in the central warehouse through the intermediate node and synchronizes it to the regional warehouse.

[0048] See alsoFigure 2 , the synchronous task execution implementation is as follows:

[0049] (1) The regional warehouse user calls the data synchronization API. The API Server located on the intermediate node listens to the user request, processes the request content, and adds it to the thread queue.

[0050] (2) The thread scheduling module obtains the synchronization thread with the highest priority from the thread queue, identifies the same data type, and executes Git data synchronization or Harbor data synchronization.

[0051] (3) If the synchronization data type is Git data, the Git synchronization module will be executed; the synchronization module initializes the synchronization task cache directory and completes the remote central warehouse information configuration.

[0052] (4) The Git synchronization module pulls the specified content from the remote central repository and temporarily stores it in the local cache directory. Then, based on the configured remote regional repository information, it pushes the local cache file to the remote regional repository.

[0053] (5) If the synchronization data type is Harbor data, the Harbor synchronization module will be executed;

[0054] (6) The Harbor synchronization module pulls the image file from the remote central warehouse and temporarily stores it in the local image library. It then configures the tag of the remote regional warehouse and pushes the tag to the regional Harbor warehouse.

[0055] (7) Close the synchronization thread and clean up the local cache files.

[0056] The present invention realizes the purpose of cross-warehouse synchronization of Git and Harbor data. When a regional warehouse needs to obtain the code and image of the central warehouse, it needs to request the intermediate node where the synchronization module is located, and the synchronization module performs thread scheduling to realize automatic data synchronization.

[0057] The above description is only a preferred embodiment of the present invention, which is only used to illustrate the technical solution of the present invention, and is not used to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A script-based Git and Harbor data synchronization method, characterized in that: Deploy and receive API requests on the intermediate nodes between the central warehouse and the regional warehouse, and perform synchronization of Git data and Harbor data; It includes two parts: data synchronization of Git and Harbor. The synchronization module is deployed in the intermediate node between the central warehouse and the regional warehouse, and the service APIs for the central warehouse and the regional warehouse are exposed respectively. The API requests are monitored in real time. When the synchronization module receives the API request, a thread queue is established to execute the data synchronization threads in sequence. The Git data synchronization method uses the storage of the intermediate node as a cache, configures the connection information of the remote warehouse, obtains the content of the central warehouse, and then pushes the content to the regional warehouse; The Harbor data synchronization described above uses the storage of the intermediate node as a cache. After pulling the image of the central warehouse, the image is configured with the image tag of the regional warehouse, and the image marked with this tag is pushed to the regional warehouse.

2. The method according to claim 1, characterized in that The Git connection information of the central warehouse and the regional warehouse is stored separately according to the regional ID, and the Harbor connection information of the central warehouse and the regional warehouse is stored separately according to the regional ID.

3. The method according to claim 1, characterized in that The synchronization of Git data includes: (1) The synchronization module exposes the service API to the central repository and regional repository. When the synchronization module receives an API request for synchronizing Git data from the central repository or regional repository, it processes the request content and adds it to the thread queue, waiting for synchronization task scheduling; (2) Regularly obtain the highest priority synchronization thread from the thread queue and start executing Git data synchronization; (3) The synchronization module obtains the connection information of the central warehouse from the configuration table, initializes the synchronization task cache directory, and completes the configuration of the remote central warehouse information; (4) The synchronization module pulls the specified content from the remote central warehouse to the temporary cache directory, obtains the connection information of the regional warehouse from the configuration table, configures the connection information to the local cache project warehouse, and then pushes the local cache file to the remote regional warehouse; (5) Close the Git synchronization thread and clean up the local cache files.

4. The method according to claim 1, characterized in that: The synchronized Harbor data includes: (1) When the synchronization module receives an API request for synchronizing Harbor data from the central warehouse, it processes the request content and adds it to the thread queue, waiting for synchronization task scheduling; (2) Regularly obtain the highest priority synchronization thread from the thread queue and start executing Harbor data synchronization; (3) The synchronization module obtains the connection information of the central warehouse from the configuration table. The synchronization module pulls the image file of the remote central warehouse and temporarily stores it in the local image library. It obtains the connection information of the regional warehouse from the configuration table, reconfigures the tag of the image according to the URL address in the configuration table, and finally pushes the tag to the regional Harbor warehouse. (9) Close the Harbor synchronization thread and clean up the local cache files.

5. A script-based Git and Harbor data synchronization system, characterized in that: The data synchronization function is implemented by three parts: API Server, thread scheduling, and synchronization module. The API Server monitors user requests from the central warehouse and regional warehouses; Thread scheduling is responsible for scheduling synchronization threads; The synchronization module is responsible for performing data synchronization operations between Git and Harbor; The above three main modules are deployed at the intermediate nodes between the central warehouse and the regional warehouse; The client in the regional warehouse acts as the initiator of the synchronization task, and finally obtains the file content in the central warehouse through the intermediate node and synchronizes it to the regional warehouse; The synchronous task execution is implemented as follows: (1) The regional warehouse user calls the data synchronization API. The API Server on the intermediate node listens to the user request, processes the request content, and adds it to the thread queue. (2) The thread scheduling module obtains the synchronization thread with the highest priority from the thread queue, identifies the same data type, and performs Git data synchronization or Harbor data synchronization; (3) If the synchronization data type is Git data, the Git synchronization module will be executed; the synchronization module initializes the synchronization task cache directory and completes the remote central warehouse information configuration; (4) The Git synchronization module pulls the specified content from the remote central warehouse and temporarily stores it in the local cache directory. Then, according to the configured remote regional warehouse information, it pushes the local cache file to the remote regional warehouse; (5) If the synchronization data type is Harbor data, the Harbor synchronization module will be executed; (6) The Harbor synchronization module pulls the image file of the remote central warehouse and temporarily stores it in the local image library, then configures the tag of the remote regional warehouse, and then pushes the tag to the regional Harbor warehouse; (7) Close the synchronization thread and clean up the local cache files.