# Set the Primary Server

In mirror mode, when you are using the failover distribution method, the current child server that DAH sends actions to is the primary server. Similarly, in non-mirror mode, when you have child server groups set up to use the failover distribution method, the child server in each group that DAH sends actions to is the primary server.

By default, DAH selects the first child server listed in the configuration file (either the first `[DistributedEngineN]` section, or the first child server listed in the `Host` parameter for a server group). If this server stops responding, DAH switches to the next configured server, which becomes the primary server.

You can find the current primary server by sending an `EngineManagement` action. This action returns a `<primary_engine>` tag, which shows the ID of the current primary server. To find the primary server at any time, you can send the `EngineManagement` action with the `EngineAction` parameter set to `ShowStatus`.

When the first server comes online again, DAH does not automatically switch back. If the server was offline for some time, it might not contain the latest data, so you might want to wait for the server to catch up with indexing jobs. At this point, you can manually change the primary server, by using the `EngineManagement` action, with the `EngineAction` parameter set to `SetPrimaryEngine`.

- In mirror mode, you can specify the child server to use by adding the `EngineID` or `EngineName` parameter.

  For example:

      action=EngineManagement&EngineAction=SetPrimaryEngine&EngineID=0

  This action sets the child server with ID `0` as the primary server. The ID is the number of the child server as described in the `[DistributedEngineN]`, `[IDOLServerN]`, or `[DAHEngineN]` section.

- In non-mirror mode, you can specify the child server to use by adding the `PrimaryEngines` parameter. Specify each primary servers in the following format:

      LogicalServerNumber:ServerID

  where:

  - `LogicalServerNumber` is the ID of the server group. This value is the number of the configuration section that contains the details for this server group.

  - `ServerID` is the engine ID of the child server that you want to make the primary server of this group.

    You can find the current primary server, and the IDs of the servers that belong to each server group by sending an `EngineManagement` action. The `<logical_engines>` tag lists the child server IDs that correspond to each configured server group (logical engine).

  To set the primary server for multiple server groups, separate each `LogicalServerNumber:ServerID` pair with a comma.

  For example:

      action=EngineManagement&EngineAction=SetPrimaryEngine&PrimaryEngines=0:2,1:5

  This action sets the child server with ID `2` to be the primary server for the server group with configured ID `0`, and sets the child server with ID `5` to be the primary server for the server group with ID `1`.

_FT_HTML5_bannerTitle.htm