Sub topic 11
Gateway clusters and high availability
This chapter assumes you can install and register a standard-mode gateway, add a gateway data source, and map a dataset to it. These steps are covered in earlier chapters. Here you add redundancy so that one failed machine does not stop your refreshes.
Why a single gateway is a risk
A gateway is a Windows service running on one machine. If that machine reboots for patching, loses its network, or crashes, every dataset that depends on it fails to refresh. DirectQuery and live connection reports that use the gateway fail as well, and in that case users see errors immediately instead of stale data.
A gateway cluster removes this single point of failure. It is a group of gateway installations that act as one logical gateway.
What a cluster is
A cluster has a primary gateway and zero or more secondary gateways. The first gateway you register creates the cluster and becomes the primary. Each gateway you add later joins that cluster as a secondary member.
From the Power BI service, the cluster appears as one gateway entry. You add data sources to the cluster, not to individual members. You map datasets to the cluster's data sources. Each member runs the same service and can reach the same sources.
The following table summarizes the terms.
| Term | Meaning |
|---|---|
| Cluster | A group of gateway installations that appear as one gateway in the service |
| Primary member | The first gateway registered. The service tries it first. |
| Secondary member | A gateway that joined the cluster later. It is used when the primary is unavailable. |
| Gateway data source | A connection definition stored on the cluster and shared by all members |
How requests are routed
When a refresh or query needs the gateway, the service sends it to the cluster. By default, the service tries the primary member first. If the primary is offline or does not respond, the service tries the next member in the list, and so on. If no member responds, the refresh fails.
This is failover, not load balancing, unless you turn on load balancing as described below. During normal operation the primary does the work and the secondaries wait.
Load balancing
Gateway cluster settings in the service include an option to distribute requests across members. When you enable it, the service spreads requests among members at random, or according to throttling limits you set on CPU and memory. Use it when one gateway cannot handle the volume of concurrent refreshes and queries.
The options differ in purpose.
- Failover only (default): the primary handles requests, and the others are standby.
- Random distribution: requests go to any available member, which spreads the load.
- Resource throttling: a member stops accepting new requests when its CPU or memory crosses a limit, and the service sends them to another member.
Resource limits are set per member in that member's gateway configuration file. If you enable load balancing, every member must be able to take any request, so the previous requirements about identical configuration apply even more strongly.
Requirements for cluster members
Members of a cluster must be interchangeable. Check these points before you add a machine.
- Same data source access. Every member must reach every data source in the cluster over the network, with the same drivers installed. A member that cannot see the SQL Server fails requests it receives, even though the cluster looks healthy.
- Same custom connectors and drivers. If a dataset uses an ODBC or other driver, install the same driver and version on each member. Custom connectors must be present on each machine in the same configured folder.
- Standard mode only. Personal mode gateways cannot be clustered.
- Same outbound connectivity. Each machine needs the outbound ports and addresses covered in the networking chapter.
- Same tenant and region. Members join a cluster by using the recovery key and are tied to the cluster's region.
- Credentials work from every member. Credentials for the data source are stored encrypted on the cluster and decrypted by each member. Windows authentication to a source depends on the member's own network position and the account the service runs as. Test it from each machine.
Adding a member to an existing cluster
Use the same installer as for the first gateway. During registration, choose the option to add the gateway to an existing cluster, and select the cluster from the list. You must supply the recovery key that was created when the cluster was first registered.
Follow this procedure.
- Install the gateway on a second machine, using the same standard mode installer.
- Sign in with an account that has permission to administer the cluster.
- On the registration page, choose to add to an existing gateway cluster.
- Select the cluster that you want to join.
- Enter the recovery key for that cluster.
- Finish registration. The new gateway now appears as a member of the cluster in the service.
Because the recovery key is required to add members, store it in a secure place such as a password manager or vault. If you lose it, you cannot add members to that cluster. You would need to set up a new cluster and re-create the data sources and dataset mappings. Chapter on gateway maintenance covers the recovery key in more detail.
Verifying a cluster
After you add a member, verify the setup instead of assuming it works.
- In the Power BI service, open Manage connections and gateways. The cluster should list all members, and each should show a status of online.
- Check each member's own gateway app. It should show that the gateway is online and ready to use.
- Test each data source in the cluster. The connection test runs through the cluster, so it may not reveal a problem with one specific member.
- To test a secondary, stop the gateway service on the primary for a short time, then trigger a refresh. A successful refresh shows that failover works. Restart the primary afterward.
Run the outbound connectivity check from every member:
Test-NetConnection -ComputerName watchdog.servicebus.windows.net -Port 9350A result with TcpTestSucceeded : True means this machine can reach that Azure Service Bus endpoint. Run it on each member, not only on the primary.
Capacity planning and placement
Redundancy depends on independent failure. Two gateways on the same virtual machine host, the same power circuit, or the same patch group can fail together.
- Place members on different hosts. Where possible, put them in different racks or availability zones.
- Stagger patching so that members are not all restarted at once.
- Size each member to carry the full workload alone, since a failover may leave a single member serving everything.
- Keep members close to the data source on the network. A gateway in a distant datacenter adds latency to every query.
A cluster does not make the data source itself redundant. If the SQL Server is down, all members fail the same way. Plan database availability separately.
Common problems
- A member shows offline. Check that the Windows service is running, that the machine has outbound access, and that the account running the service can sign in.
- Refresh works on the primary and fails after failover. Compare drivers, connectors, and network rules between members.
- Credentials error only on one member. For Windows authentication, check the service account and domain permissions on that machine.
- Data source changes do not appear to apply. Changes are made once on the cluster. Wait a moment, then retry before you suspect a member.
- Cannot find the cluster during registration. Confirm you are signed in to the right tenant and have admin rights on the cluster.
Summary
A gateway cluster is a set of standard-mode gateways that the service treats as one. The service tries the primary first and falls back to other members. Optional load balancing spreads requests across members. Members must be equivalent in drivers, connectors, and network access, and joining requires the recovery key. Test every member, place members on independent infrastructure, and remember that the data source remains a separate point of failure.
Exercise
Your cluster has a primary and a secondary gateway. Refreshes succeed normally, but after the primary was rebooted for patching, a nightly refresh failed with a driver error. What is the most likely cause, and what do you do to fix it and confirm the fix?
Show answer
The service failed over to the secondary, and the secondary lacks a driver (or the same driver version) that the dataset needs. Install the same driver and version on the secondary. Then confirm by stopping the gateway service on the primary, triggering a refresh, and checking that it succeeds in the refresh history. Restart the primary afterward.
Exercise
A colleague wants to add a third gateway to the cluster but cannot find the recovery key from the original registration. What are the consequences?
Show answer
Without the recovery key, the new gateway cannot join the existing cluster. The only option is to register a new cluster, then re-create its data sources, credentials, and dataset mappings. This is why the recovery key should be stored securely when the cluster is first created.