There are many differences between SharePoint 2010 and SharePoint 2013, not only an end user perspective, but also from administrator and developer perspectives as well. Let’s focus on one important administrative difference: Search Service Application.
So, for all of you SharePoint Administrators out there, we all know that Search is very simple – doesn’t use a lot of resources and once it’s provisioned, it just works, right? WRONG! Search is a beast; we all know that. But it gives us all job security, and if money wasn’t an issue, even the smallest organizations would have multiple servers just running Search.
Now, assume you have multiple application servers to run your Search Service Application. How do you move the search components to the application server(s)? With SharePoint 2010, you could do it through the Central Administration GUI. In SharePoint 2013? Not so much.
How do you modify the Search topology in SharePoint 2013?
Now, you now must use PowerShell. You can either use the SharePoint Management Shell or ISE. I prefer to use PowerShell ISE. It’s more colorful and much easier on the eyes. I’m going to walk you through the entire process.
The first thing I do is make sure the Index location is on the correct drive. It is always best practice to place the SharePoint bits, log files, and index files on a separate partition from the Operating System.
Step 1: Check Index File Location
- From the server that is currently running the Search Service, open PowerShell ISE.
- First and foremost, add the SharePoint Snapin in order to run the proper cmdlets. From the command line in ISE, type the following command. Press Enter.
- Now, we can properly run the following commands using the script window in ISE. Type the following command, and click Run Script, as shown below.
$ssi = Get-SPEnterpriseSearchServiceInstance
- This will display the following data. Note that both locations are located on the “S” drive, which is NOT the same drive that contains the Operating System.
Before we can start modifying the topology, we need to ensure that the Search Index is empty and that no crawls are currently running or scheduled to run during our modifications.
Step 2: Ensure Search Index is Empty and No Crawls are Running
- From the server that is currently running the Search Service, browse to Central Administration.
- From the Application Management section, click Manage Service Applications.
- Locate and click the Search Service Application.
- From the Search Service Application: Search Administration page, ensure that the Searchable Items shows “0”
- Next, while still on the Search Administration page, select Content Sources from the Crawling section in the quick launch area.
- On the Manage Content Sources page, verify that the status shows “Idle” and no crawls are scheduled to run in the near future.
Now we can finally begin modifying the topology of the Search Service Application.
Step 3: Modify Search Topology
As stated above, you can either use PowerShell ISE, or the SharePoint Management Shell to perform the below functions. I prefer to use PowerShell ISE, so the screenshots shown below will be taken from it.
- From the server that is currently running the Search Service Application, open PowerShell ISE.
- The first thing we need to do is add a few variables in PowerShell. Use the following commands to specify each server you would like to add search components to. In this particular scenario, I have two Web Front End Servers and two Application servers. I will choose to run the Search components on both Application Servers. If you have more than two servers, the below script can be modified to add additional hosts.
$hostA = Get-SPEnterpriseSearchServiceInstance -Identity "Server1"
$hostB = Get-SPEnterpriseSearchServiceInstance -Identity "Server2"
Start-SPEnterpriseSearchServiceInstance -Identity $hostA
Start-SPEnterpriseSearchServiceInstance -Identity $hostB
- Once the above commands are ready (don’t forget to change the server names), select Run Script to input those variables.
- These commands will also start the SharePoint Server Search and Search Host Controller Service on each server you added. You need to ensure these services are Started before continuing. You can check by browsing to Central Administration > System Settings > Manage Services on Server. Be sure to have the correct server selected at the top of the page.
- You can also use the following commands and keep running them until each host Status displays “Online”.
Get-SPEnterpriseSearchServiceInstance -Identity $hostA
Get-SPEnterpriseSearchServiceInstance -Identity $hostB
- I prefer to keep all my commands on the page while performing this work. If you do the same, you will need to highlight the two new commands and use the Run Selection button instead of the Run Script button, as shown below.
- Running the two above commands will display the following. Continue to run this command until all servers show “Status: Online”.
- You will now need to create an entirely new Search Topology. Using PowerShell ISE, type and run the following commands:
$ssa = Get-SPEnterpriseSearchServiceApplication
$newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa
- Now it is time to choose which search components you want to run on what servers. In this example, as I only have two application servers, I am going to split each component and have each server run all components. As you can see in the following commands, each server will host the same six components.
New-SPEnterpriseSearchAdminComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchCrawlComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostA
New-SPEnterpriseSearchIndexComponent -SearchTopology $newTopology -SearchServiceInstance $hostA -IndexPartition 0
New-SPEnterpriseSearchAdminComponent -SearchTopology $newTopology -SearchServiceInstance $hostB
New-SPEnterpriseSearchCrawlComponent -SearchTopology $newTopology -SearchServiceInstance $hostB
New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostB
New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostB
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $newTopology -SearchServiceInstance $hostB
New-SPEnterpriseSearchIndexComponent -SearchTopology $newTopology -SearchServiceInstance $hostB -IndexPartition 0
- The above command essentially created the new topology. Now that it is created, we must activate this topology for the farm to use. Run the following command to active the topology.
Set-SPEnterpriseSearchTopology -Identity $newTopology
This command could take a few minutes to run. The best way to tell when the command is complete is by watching the tool bar at the top. The red square indicates the command is still running. When the arrow switches back to green, the command has completed. Now that the new topology is activated, we can verify.
- Run the following command to verify the active topology.
Get-SPEnterpriseSearchTopology -SearchApplication $ssa
- Use the command output to verify that the new topology is the active one. It should be the one with the most recent Creation Date, but you can also verify by using the Topology ID and match it up with the command output from step 9 above.
- The following command can be used to verify each component of the search topology.
Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Text
Your output should be similar to the following:
And there you have it! Your SharePoint’s Search Service topology is now configured in the proper way. Note that all the server names above contain the letters “AP” which refer to the Application Servers. No search component is running on either of the Web Front Ends.