GitLab GEO 异地主副服务器同步--文档翻译
? gitlab ?    2019-01-11 16:22:44    1515    0    2
gua_l   ? gitlab ?

 

GitLab Geo  , replica server for gitlab

https://about.gitlab.com/solutions/geo/

https://docs.gitlab.com/ee/administration/geo/replication/index.html

 


 

How it works
GitLab Geo is included in GitLab Enterprise Edition Premium.
GitLab Geo allows for read-only mirrors of your GitLab instance.
Project repositories and the database including user accounts, issues, merge requests, groups, project data, etc., are replicated on your secondary instance.
With read-only mirrors, your team can fetch projects and read data much faster while still pushing all changes to the primary server.
All replication operations are asynchronous and are queued to be dispatched as soon as they happen.


GitLab Geo包含在GitLab企业版中。
GitLab Geo允许GitLab实例的只读镜像。
项目存储库和数据库(包括用户帐户、问题、合并请求、组、项目数据等)在辅助实例上复制。
使用只读镜像,您的团队可以更快地获取项目和读取数据,同时仍然将所有更改推送到主服务器。
所有复制操作都是异步的,一旦发生就排队等待分派。


 Features
Read-only secondaries: Maintain one primary GitLab instance while still enabling a read-only secondary instance for each of your distributed teams.
Authentication system hooks: The secondary instance receives all authentication data, like user accounts and logins, from the primary instance.accustomed to. However, there are visual notifications that block write operations and make it clear that a user is on a secondary instance.


只读辅助实例:维护一个主要的GitLab实例,同时仍然为每个分布式团队启用只读辅助实例。
身份验证系统挂钩:辅助实例从主实例接收所有身份验证数据,如用户帐户和登录。
直观UI:辅助方使用与您的团队已经习惯的相同的网络接口。然而,存在阻塞写操作并明确用户在辅助实例上的可视通知。

 


Benefits

  • Time: Reduce the time it takes your distributed developers to clone and fetch large repos and projects from minutes to seconds.
  • Collaboration: Enable all of your developers to contribute ideas and work in parallel from each of their respective geographies.
  • Scale: Balance the load between your primary and secondary instance or offload your automated tests to the Geo secondary node.

效益
时间:减少分布式开发人员从几分钟到几秒钟克隆和获取大型回购和项目所需的时间。
协作:使您的所有开发人员能够贡献思想,并从各自的地理位置并行工作。
规模:平衡主实例和辅助实例之间的负载,或者将自动化测试卸载到Geo辅助节点。


 

Architecture

The following diagram illustrates the underlying architecture of Geo.


 

Requirements for running Geo
The following are required to run Geo:
An operating system that supports OpenSSH 6.9+ (needed for fast lookup of authorized SSH keys in the database) The following operating systems are known to ship with a current version of OpenSSH:


CentOS 7.4+
Ubuntu 16.04+
PostgreSQL 9.6+ with FDW support and Streaming Replication
Git 2.9+


Firewall rules

The following table lists basic ports that must be open between the primary and secondary nodes for Geo.

Primary serverServer secondaryProtocol
8080HTTP
443443TCP or HTTPS
2222TCP
5432 PostgreSQL



Using Omnibus GitLab

If you installed GitLab using the Omnibus packages (highly recommended):

  1. Install GitLab Enterprise Edition on the server that will serve as the secondary node. Do not create an account or log in to the newsecondary node.
  2. Upload the GitLab License on the primary node to unlock Geo. The license must be for GitLab Premium or higher.
  3. Set up the database replication (primary (read-write) <-> secondary (read-only) topology).
  4. Configure fast lookup of authorized SSH keys in the database. This step is required and needs to be done on both the primary andsecondary nodes.
  5. Configure GitLab to set the primary and secondary nodes.
  6. Optional: Configure a secondary LDAP server for the secondary node. See notes on LDAP.
  7. Follow the “Using a Geo Server” guide

https://docs.gitlab.com/ee/administration/geo/replication/index.html#current-limitations

GEO 同步的内容和目前暂未纳入同步的内容:

有限的同步内容

Limitations on replication

Only the following items are replicated to the secondary node:

  • All database content. For example, snippets, epics, issues, merge requests, groups, and project metadata.
  • Project repositories.
  • Project wiki repositories.
  • User uploads. For example, attachments to issues, merge requests, epics, and avatars.
  • CI job artifacts and traces.
DANGER Data not on this list is unavailable on the secondary node. Failing over without manually replicating data not on this list will cause the data to be lost.

目前暂未纳入同步的内容

Examples of data not replicated

Take special note that these examples of GitLab features are both:

  • Commonly used.
  • Not replicated by Geo at present.

Examples include:

Caution: If you wish to use them on a secondary node, or to execute a failover successfully, you will need to replicate their data using some other means.

 


When Geo is enabled, the:

  • Original instance is known as the primary node.
  • Replicated read-only nodes are known as secondary nodes.

当GEO 启用时, 源实例称为主节点,只读的同步节点称为辅助节点。

Keep in mind that:

  • Secondary nodes talk to the primary node to: 副节点向主节点通信
    • Get user data for logins (API).  获取用户登录信息
    • Replicate repositories, LFS Objects, and Attachments (HTTPS + JWT).  --同步的内容
  • Since GitLab Premium 10.0, the primary node no longer talks to secondary nodes to notify for changes (API). 从V 10.0 版本开始,主节点不再向辅助节点通知更改。??
  • Pushing directly to a secondary node (for both HTTP and SSH, including git-lfs) was introduced in GitLab Premium 11.3.  从11.3 版本开始,可以直接向辅助节点推送 。--与只读数据库的理解??
  • There are limitations in the current implementation.

gitlab-GEO 实际运用补充理解:


1. 使用副节点(即官方文档中所言的second node)的链接进行登录,当填完用户名密码之后点击确认,实际是跳转到主节点(master)服务器 去验证帐户,验证通过之后,链接会跳转回副节点的已登录页面。


2.如果本地访问pc 登录副节点时,登录失败并停留在master 的链接上,显示找不到网址,则需要查找一下是否本地与主服务器无法连通(无法跳转验证)


3.官网所言的只读数据库可以理解为:所有推送到second-node 的请求和修改,会由second-node 转发并提交到master 服务器,second-node 的数据库无法直接修改,只能通过从master 的同步来获得这些变更。


4. 一个master 服务器,可以拥有多个second - node , 在这里second 的意思应该是副。可以把这些node 理解为同步服务器。与Accurev 的master 与replica server 的关系一致。其中同步服务器只能从master 同步数据,无法进行主动变更,皆为只读数据库。



Pre: mount/nfs 共享目录

Next: linux shell 不同进制转换解析与示例

1515
Sign in to leave a comment.
No Leanote account? Sign up now.
2 comments
Table of content