Showing posts with label Query Component. Show all posts
Showing posts with label Query Component. Show all posts

Thursday, May 30, 2013

SharePoint 2013 Search: Add a Query Component to a New Web Front End

I previously moved the query component to my single web front end server (WFE) and then moved the index partition . Now I have a second WFE provisioned and I wanted to create a query and an index component on that server as well. This post outlines the steps for the query component. The index component was next and those steps are outlined here.


Get Search Service Instance and Start on New WFE Server
$ssi = Get-SPEnterpriseSearchServiceInstance -Identity "<<NEW WFE SERVER NAME>>"
Start-SPEnterpriseSearchServiceInstance -Identity $ssi

Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance -Identity "<<NEW WFE SERVER NAME>>"


Wait for Search Service Instance to come online
Get-SPEnterpriseSearchServiceInstance -Identity $ssi

In the full script I have a loop that waits for the service to become online.
 

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





Add the New Query Processing Component
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $clone -SearchServiceInstance $ssi


Activate  the Cloned Search Topology
Set-SPEnterpriseSearchTopology -Identity $clone

Optionally Review new topology
Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa

Monitor/Verify the Search Status
Get-SPEnterpriseSearchStatus -SearchApplication $ssa

In the full script I have a loop that waits for the index component to become active. If you have two index components, one usually needs to be re-synced.

You may use the -text parameter to get additional information about the search component statuses:

Get-SPEnterpriseSearchStatus -SearchApplication $ssa -text


I now have a Query Processing component on two web front ends:

{click image to see larger view}

Next I wanted to expand the index partition across the two WFEs and so I added a new Index Component to WFE2.


FULL SCRIPT (with loops)
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Get Search Service Instance and Start on New WFE Server
$ssi = Get-SPEnterpriseSearchServiceInstance -Identity "<<NEW WFE SERVER NAME>>"
Start-SPEnterpriseSearchServiceInstance -Identity $ssi

Start-SPEnterpriseSearchQueryAndSiteSettingsServiceInstance -Identity "<<NEW WFE SERVER NAME>>"

#Wait for Search Service Instance to come online
do {$online = Get-SPEnterpriseSearchServiceInstance -Identity $ssi; Write-Host "Waiting for service: " $online.Status}
until ($online.Status -eq "Online")


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


# Add New Search Component
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $clone -SearchServiceInstance $ssi


# Activate  Search Topology
Set-SPEnterpriseSearchTopology -Identity $clone


#Review new topology
Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa


#Monitor Distribution of Index
do {$activeState = Get-SPEnterpriseSearchStatus -SearchApplication $ssa | Where-Object {$_.Name -eq "IndexComponent2"}; Write-Host "Waiting for active distribution: " $activeState.State}
until ($activeState.State -eq "Active")

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