March 9, 2017

Add/Move SharePoint 2013 farm Search Topology in Single or Multiple Search Servers using PowerShell

SharePoint 2013 farm provides Search Topology that comprises Admin, Crawler, Content Processing, Analytics Processing, Query Processing and Index Partition.

  • Search Administration Component administers new instances of Search components and Search processes.
  • Search Crawler enables us to crawl all the content in our site thereby allowing us to retrieve results via SharePoint Search. 
  • Search Content Processing allows us to process different types of contents and indexing them in a single index.
  • Search Analytics Processing component of Search topology deals with analytics related stuffs. It carries out search analytics and usage analytics.
  • Search Query Processing component handles incoming queries and returns suitable results.

Scenario 1: If you want to move SharePoint 2013 farm Search Topology from one server (e.g. Server1) to another (e.g. Server2), then follow below mentioned steps:

Prerequisites:
 - Search service application must be created and configured in the farm.
 - Search Topology must have been configured in Server1.
 - Server2 must be part of  SharePoint 2013 farm.
 - Ensure that no search crawl is running and search index is empty.

Connect to any of your SharePoint 2013 farm server and run SharePoint Management Shell as an Administrator. 

Run below given commands in SharePoint Management Shell one by one :

$hostA = Get-SPEnterpriseSearchServiceInstance -Identity "Server2"
# Note: "Server2" is new server name, where we want to move Search Topology.

Start-SPEnterpriseSearchServiceInstance -Identity $hostA
Get-SPEnterpriseSearchServiceInstance -Identity $hostA
$ssa = Get-SPEnterpriseSearchServiceApplication
$newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa
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
Set-SPEnterpriseSearchTopology -Identity $newTopology
Get-SPEnterpriseSearchTopology -SearchApplication $ssa
Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Text

Finally, Search Topology will be migrated from "Server1" to "Server2", and you will be able to see Search Topology components in "Server2".

*After moving Search Topology to new server, start full crawl to get search results.

Scenario 2: If you want to add an additional search server (e.g. Server2),  along with existing search server -- Server1, then follow below mentioned steps:

Prerequisites:
 - Search service application must be created and configured in the farm.
 - Search topology must have been configured in Server1.
 - Server2 must be part of  SharePoint 2013 farm.
 - Ensure that no search crawl is running and search index is empty.

Connect to any server of SharePoint 2013 farm and run SharePoint Management Shell as an Administrator. 
Run below given commands in management shell one by one :

$hostA = Get-SPEnterpriseSearchServiceInstance -Identity "Server2"
# Note: "Server2" is new server name, which we are going to add.

Start-SPEnterpriseSearchServiceInstance -Identity $hostA
Get-SPEnterpriseSearchServiceInstance -Identity $hostA
$ssa = Get-SPEnterpriseSearchServiceApplication
$newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa
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 1
# Note: For Adding second Search Server Topology, we must have to give -IndexPartition as 1. Because, "Server1" would already have 0 as IndexPartition.

Set-SPEnterpriseSearchTopology -Identity $newTopology
Get-SPEnterpriseSearchTopology -SearchApplication $ssa
Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Text

Finally, You will be able to see newly added search servers in SharePoint 2013 farm.

*After adding an additional search server in SharePoint 2013, start full crawl to get search results.

Scenario 3: If you want to add multiple search servers (e.g. Server1 and Server2) at a time, then follow below mentioned steps:

Prerequisites:
 - Search service application must be created and configured in the farm.
 - Server1 and Server2 must be part of  SharePoint 2013 farm.
 - Ensure that no search crawl is running and search index is empty.

Connect to any server of SharePoint 2013 farm and run SharePoint Management Shell as an Administrator. 

Run below given commands in management shell one by one :

$hostA = Get-SPEnterpriseSearchServiceInstance -Identity "Server1"
$hostB = Get-SPEnterpriseSearchServiceInstance -Identity "Server2"
# Note: "Server1" and "Server2" are new servers, which we are going to add.

Start-SPEnterpriseSearchServiceInstance -Identity $hostA
Start-SPEnterpriseSearchServiceInstance -Identity $hostB
Get-SPEnterpriseSearchServiceInstance -Identity $hostA
Get-SPEnterpriseSearchServiceInstance -Identity $hostB
$ssa = Get-SPEnterpriseSearchServiceApplication
$newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa
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 1
# Note: For adding an additional search server in farm, we must give -IndexPartition 1

Set-SPEnterpriseSearchTopology -Identity $newTopology
Get-SPEnterpriseSearchTopology -SearchApplication $ssa

Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Text

Finally, You will be able to see newly added search servers in SharePoint 2013 farm.

*After adding an additional search server in SharePoint 2013, start full crawl to get search results.

If you have any questions you can reach out our SharePoint Consulting team here.

No comments:

Post a Comment