Skip to content
Chimera readability score 0.5449 out of 100, reading level.

So much of what you interact with on GitHub depends on search—obviously the search bars and filtering experiences like the GitHub Issues page, but it is also the core of the releases page, projects page, the counts for issues and pull requests, and more. Given that search is such a core part of the GitHub platform, we’ve spent the last year making it even more durable. That means, less time spent managing GitHub Enterprise Server, and more time working on what your customers care most about.

In recent years, GitHub Enterprise Server administrators had to be especially careful with search indexes, the special database tables optimized for searching. If they didn’t follow maintenance or upgrade steps in exactly the right order, search indexes could become damaged and need repair, or they might get locked and cause problems during upgrades. Quick context if you’re not running High Availability (HA) setups, they’re designed to keep GitHub Enterprise Server running smoothly even if part of the system fails. You have a primary node that handles all the writes and traffic, and replica nodes that stay in sync and can take over if needed.

Much of this difficulty comes from how previous versions of Elasticsearch, our search database of choice, were integrated. HA GitHub Enterprise Server installations use a leader/follower pattern. The leader (primary server) receives all the writes, updates, and traffic. Followers (replicas) are designed to be read-only. This pattern is deeply ingrained into all of the operations of GitHub Enterprise Server.

This is where Elasticsearch started running into issues. Since it couldn’t support having a primary node and a replica node, GitHub engineering had to create an Elasticsearch cluster across the primary and replica nodes. This made replicating data straightforward and additionally gave some performance benefits, since each node could locally handle search requests.

Unfortunately, the problems of clustering across servers eventually began to outweigh the benefits. For example, at any point Elasticsearch could move a primary shard (responsible for receiving/validating writes) to a replica. If that replica was then taken down for maintenance, GitHub Enterprise Server could end up in a locked state. The replica would wait for Elasticsearch to be healthy before starting up, but Elasticsearch couldn’t become healthy until the replica rejoined.

For a number of GitHub Enterprise Server releases, engineers at GitHub tried to make this mode more stable. We implemented checks to ensure Elasticsearch was in a healthy state, as well as other processes to try and correct drifting states. We went as far as attempting to build a “search mirroring” system that would allow us to move away from the clustered mode. But database replication is incredibly challenging and these efforts needed consistency.

What changed?

After years of work, we’re now able to use Elasticsearch’s Cross Cluster Replication (CCR) feature to support HA GitHub Enterprise.

“But David,” you say, “That’s replication between clusters. How does that help here?”

I’m so glad you asked. With this mode, we’re moving to use several, “single-node” Elasticsearch clusters. Now each Enterprise server instance will operate as independent single node Elasticsearch clusters.

CCR lets us share the index data between nodes in a way that is carefully controlled and natively supported by Elasticsearch. It copies data once it’s been persisted to the Lucene segments (Elasticsearch’s underlying data store). This ensures we’re replicating data that has been durably persisted within the Elasticsearch cluster.

In other words, now that Elasticsearch supports a leader/follower pattern, GitHub Enterprise Server administrators will no longer be left in a state where critical data winds up on read-only nodes.

Under the hood

Elasticsearch has an auto-follow API, but it only applies to indexes created after the policy exists. GitHub Enterprise Server HA installations already have a long-lived set of indexes, so we need a bootstrap step that attaches followers to existing indexes, then enables auto-follow for anything created in the future.

Here’s a sample of what that workflow looks like:

function bootstrap_ccr(primary, replica):

Fetch the current indexes on each

primary_indexes = list_indexes(primary)

replica_indexes = list_indexes(replica)

Filter out the system indexes

managed = filter(primary_indexes, is_managed_ghe_index)

For indexes without follower patterns we need to

initialize that contract

for index in managed:

if index not in replica_indexes:

ensure_follower_index(replica, leader=primary, index=index)

else:

ensure_following(replica, leader=primary, index=index)

Finally we will setup auto-follower patterns

so new indexes are automatically followed

ensure_auto_follow_policy(

replica,

leader=primary,

patterns=[managed_index_patterns],

exclude=[system_index_patterns]

)

This is just one of the new workflows we’ve created to enable CCR in GitHub Enterprise Server. We’ve needed to engineer custom workflows for failover, index deletion, and upgrades. Elasticsearch only handles the document replication, and we’re responsible for the rest of the index’s lifecycle.

How to get started with CCR mode

To get started using the new CCR mode, reach out to support@github.com and let them know you’d like to use the new HA mode for GitHub Enterprise Server. They’ll set up your organization so that you can download the required license.

Once you’ve downloaded your new license, you’ll need to set `ghe-config app.elasticsearch.ccr true`. With that finished, administrators can run a `config-apply` or an upgrade on your cluster to move to 3.19.1, which is the first release to support this new architecture.

When your GitHub Enterprise Server restarts, Elasticsearch will migrate your installation to use the new replication method. This will consolidate all the data onto the primary nodes, break clustering across nodes, and restart replication using CCR. This update may take some time depending on the size of your GitHub Enterprise Server instance.

While the new HA method is optional for now, we’ll be making it our default over the next two years. We want to ensure there’s ample time for GitHub Enterprise administrators to get their feedback in, so now is the time to try it out.

We’re excited for you to start using the new HA mode for a more seamless experience managing GitHub Enterprise Server.

Want to get the most out of search on your High Availability GitHub Enterprise Server deployment? Reach out to support to get set up with our new search architecture!

GitHub Software Engineer. David is an expert in the area of search engineering. He covers all areas of information retrieval from infrastructure to relevance engineering within GitHub.

Learn how GitHub built an accessible, multi-terminal-safe ASCII animation for the Copilot CLI using custom tooling, ANSI color roles, and advanced terminal engineering.

Facts Only

GitHub Enterprise Server (GHES) search improvements are focused on durability and reducing management issues during upgrades or maintenance.
Elasticsearch's Cross Cluster Replication (CCR) feature is used to support High Availability (HA) GHES installations.
Single-node Elasticsearch clusters are now used, with data being carefully controlled replicated between nodes using CCR.
A bootstrap step and custom workflows for failover, index deletion, and upgrades have been created to enable CCR in GitHub Enterprise Server.
Users can contact GitHub support to switch to the new CCR mode after downloading a new license.

Executive Summary

GitHub, a platform for software development and collaboration, has made improvements to its search functionality, particularly on GitHub Enterprise Server (GHES). The changes aim to make the system more durable and less prone to issues during upgrades or maintenance. This is achieved by using Elasticsearch's Cross Cluster Replication (CCR) feature, which allows for multiple single-node Elasticsearch clusters, improving data replication and reducing potential locking problems. To start using this new CCR mode, users must contact GitHub support to obtain a new license and then configure their GHES appropriately.

Full Take

By implementing Elasticsearch's CCR feature, GitHub is addressing longstanding issues related to managing search indexes in GHES, particularly locking problems during upgrades or maintenance. This move signals an ongoing effort by the company to improve the platform's reliability and usability for administrators. However, it's important for users to understand the implications of these changes and follow proper procedures to ensure a smooth transition to the new CCR mode.
Patterns detected: none
Root cause: GitHub is addressing technical issues with its search infrastructure in GHES to improve reliability and reduce management overhead.
Implications: The changes could lead to improved performance, reduced downtime during maintenance or upgrades, and less time spent on managing the search indexes. However, users must carefully follow the transition process to avoid potential issues.
Bridge questions: How will these improvements impact the overall user experience on GHES? What additional features or optimizations might GitHub introduce in the future to further enhance the platform's search capabilities?

Sentinel — Human

Confidence

The text appears to be written by a human, demonstrating variation in sentence length, occasional hedging, clear argument structure with idiosyncratic emphasis, unique narrative flow without matching template patterns. It also contains usage of personal voice in first-person perspective and mentions a specific GitHub engineer's name and role.

Signals Detected
low severity: Variance in sentence length and occasional hedging
medium severity: Clear argument structure with idiosyncratic emphasis
low severity: Unique narrative flow without matching template patterns
Human Indicators
Usage of personal voice in first-person perspective
Mention of specific GitHub engineer's name and role
How we rebuilt the search architecture for high availability in GitHub Enterprise Server — Arc Codex