Skip to content

Instantly share code, notes, and snippets.

@fabianneve
Last active November 6, 2017 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabianneve/5379056442a9ed57a4648d0e94b5bcbd to your computer and use it in GitHub Desktop.
Save fabianneve/5379056442a9ed57a4648d0e94b5bcbd to your computer and use it in GitHub Desktop.
Create a SharePoint 2013/2016 Search Topology on 4 nodes
# Source https://technet.microsoft.com/en-us/library/jj862356.aspx
<# Specify the new servers you want to add search components to, start a search service instance (ssi) on these servers and
create references to the search service instances #>
$hostA = Get-SPEnterpriseSearchServiceInstance -Identity "PRDS0270"
$hostB = Get-SPEnterpriseSearchServiceInstance -Identity "PRDS0271"
$hostC = Get-SPEnterpriseSearchServiceInstance -Identity "PRDS0272"
$hostD = Get-SPEnterpriseSearchServiceInstance -Identity "PRDS0273"
Start-SPEnterpriseSearchServiceInstance -Identity $hostA
Start-SPEnterpriseSearchServiceInstance -Identity $hostB
Start-SPEnterpriseSearchServiceInstance -Identity $hostC
Start-SPEnterpriseSearchServiceInstance -Identity $hostD
# Wait until all the search service instances are running
Get-SPEnterpriseSearchServiceInstance -Identity $hostA
Get-SPEnterpriseSearchServiceInstance -Identity $hostB
Get-SPEnterpriseSearchServiceInstance -Identity $hostC
Get-SPEnterpriseSearchServiceInstance -Identity $hostD
# Create a new search topology and a reference to the new search topology
$ssa = Get-SPEnterpriseSearchServiceApplication
$newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa
<# Add all the search components to the new search topology.
The following Windows PowerShell commands will create the search components of the new topology and assign them
to the new servers. In this small enterprise search topology there is one index partition, index partition 0,
to cater for a maximum of ten million items. This is indicated with the parameter -IndexPartition in the command
New-SPEnterpriseSearchIndexComponent. The index partition has one index replica on virtual machine B and one index
replica on virtual machine D. Each index replica will contain the exact same search index and is hosted on a
different physical server to achieve fault tolerance. #>
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 $hostC
New-SPEnterpriseSearchIndexComponent -SearchTopology $newTopology -SearchServiceInstance $hostC -IndexPartition 0
New-SPEnterpriseSearchIndexComponent -SearchTopology $newTopology -SearchServiceInstance $hostC -IndexPartition 1
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 $hostD
New-SPEnterpriseSearchIndexComponent -SearchTopology $newTopology -SearchServiceInstance $hostD -IndexPartition 0
New-SPEnterpriseSearchIndexComponent -SearchTopology $newTopology -SearchServiceInstance $hostD -IndexPartition 1
# Activate the new search topology
Set-SPEnterpriseSearchTopology -Identity $newTopology
# Verify that the new search topology is active
Get-SPEnterpriseSearchTopology -SearchApplication $ssa
# Verify that all components of the new search topology are running correctly.
Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Text
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment