Showing posts with label Scale Out SharePoint Search. Show all posts
Showing posts with label Scale Out SharePoint Search. Show all posts

Wednesday, March 13, 2013

SharePoint 2013 Search: Moving the Query Component to a Web Front End

Introduction
When you first create the Search Service Application, the search topology by default has all components running on one server. I performed the SSA creation on our "Index" server and therefore all components are there accordingly. However, I want to scale out the SSA a bit and have at least the Query Components running on the web front ends. (This does require more resources as the query processing is much more robust than in previous versions). Therefore I used PowerShell commands as outlined in the Microsoft TechNet documentation. This post documents the script I created to perform the task. The full script is located at the end of the post.

Initial state of the Search Topology:




You may use the SharePoint 2013 Management Console, or use the PowerShell console issuing the SharePoint add-in:
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue


Step #1 - Clone the Active Search Topology

# Clone the active search topology
$ssa = Get-SPEnterpriseSearchServiceApplication
$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active


Step #2 - Add the New Search Component on the WFE
# Add New Search Component
$wfe = Get-SPEnterpriseSearchServiceInstance -Identity "<<web front end server name here>>"
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $clone -SearchServiceInstance $wfe


Step #3 - Start the Search Instance on the WFE# Start Instance On Different Server
Start-SPEnterpriseSearchServiceInstance -Identity $wfe


Step #4 - Activate the Cloned Search Topology
# Activate Search Topology
Set-SPEnterpriseSearchTopology -Identity $clone

 

At this point the Query Component should be running on the original location as well as the WFE:




So we need to remove it from the original server.

Step #5 - Clone the Search Topology Again
# Clone Again
$ssa = Get-SPEnterpriseSearchServiceApplication
$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active


At this point, you either need the ComponentID or the Name of the component you wish to remove. By default the first query component is named QueryProcessingComponent1 so the full script will work. However, if you issue the cmdlet statement  Get-SPEnterpriseSearchComponent -SearchTopology $clone you can identify both:


Step #6 - Get the ComponentID to Move
# Get the Search Component ID To Move
$queryComponentID = (Get-SPEnterpriseSearchComponent -SearchTopology $clone -Identity QueryProcessingComponent1).componentID


Step #7 - Remove the Search Component from the Original Server
# Remove Search Component
Remove-SPEnterpriseSearchComponent -Identity $queryComponentID.GUID -SearchTopology $clone -confirm:$false


Removing the search component from the original server may show a red x icon on the topology in Central Admin:



Step #8 - Activate the Search Topology Again
# Activate Search Topology Again
Set-SPEnterpriseSearchTopology -Identity $clone



Once the topology is reactivated, all is good:

 
The Query Processing component has now been moved to the web front end!!

It is recommended to also have the Index Partition (ala the Index Components) reside on the same server as the Query Components. Here is a post about also moving the Index Partition to the web front end.


Full Script


Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

# Clone the active search topology
$ssa = Get-SPEnterpriseSearchServiceApplication
$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active


# Add New Search Component
$wfe = Get-SPEnterpriseSearchServiceInstance -Identity "<<web front end server name here>>"
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $clone -SearchServiceInstance $wfe


# Start Instance On Different Server
Start-SPEnterpriseSearchServiceInstance -Identity $wfe


# Activate  Search Topology
Set-SPEnterpriseSearchTopology -Identity $clone


# Clone Again
$ssa = Get-SPEnterpriseSearchServiceApplication
$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active


# Get the Search Component ID To Move
$queryComponentID = (Get-SPEnterpriseSearchComponent -SearchTopology $clone -Identity QueryProcessingComponent1).componentID


# Remove Search Component
Remove-SPEnterpriseSearchComponent -Identity $queryComponentID.GUID  -SearchTopology $clone -confirm:$false


# Activate  Search Topology Again
Set-SPEnterpriseSearchTopology -Identity $clone


Matched Content