Wednesday, June 5, 2013

SharePoint 2013 Search: Adding a New Index Component to a Search Server

This blog is part of my Scaling Out Search Series and describes the processes for adding a new index component to a new search server:

Get Search Service Instance and Start on New Index Server$ssi = Get-SPEnterpriseSearchServiceInstance -Identity "<<new index server>>"
Start-SPEnterpriseSearchServiceInstance -Identity $ssi


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


(The full script contains a loop that waits for the service to come online)

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


Create New Index Component for Index Partition 0
New-SPEnterpriseSearchIndexComponent –SearchTopology $clone -SearchServiceInstance $ssi -IndexPartition 0 -RootDirectory "<<server index location>>"


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


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


Monitor Distribution of Index
Get-SPEnterpriseSearchStatus -SearchApplication $ssa

The new index component will be "Degraded" until the index is fully synced. Use the -text parameter to retrieve more detailed information:

 
 
(The full script contains a loop that waits for the index component to be Active)





 
 
 
Once all components are activated, reviewing the Search Application Topology in Central Admin shows the following:
 


NEXT, I created a New Crawl Component.
 

FULL SCRIPT

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#Get Search Service Instance and Start on New Index Server
$ssi = Get-SPEnterpriseSearchServiceInstance -Identity "<<new index server>>"
Start-SPEnterpriseSearchServiceInstance -Identity $ssi


#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


#Create New Index Component for Index Partition 0
New-SPEnterpriseSearchIndexComponent –SearchTopology $clone -SearchServiceInstance $ssi -IndexPartition 0 -RootDirectory "<<server index location>>"


#Activate the Cloned 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")

 

6 comments:

  1. Hi Steve Mann,

    I got below error message when i ran this command:
    --------------------------------------------------
    PS C:\Users\spadmin.TEST> New-SPEnterpriseSearchIndexComponent -SearchTopology $
    clone -SearchServiceInstance $ssi -IndexPartition 0 -RootDirectory "C:\INDEX"
    New-SPEnterpriseSearchIndexComponent : Cannot bind parameter 'RootDirectory'
    to the target. Exception setting "RootDirectory": "New index location must be
    empty"
    At line:1 char:122
    + ... -RootDirectory "C:\INDEX"
    + ~~~~~~~~~~
    + CategoryInfo : WriteError: (:) [New-SPEnterpriseSearchIndexComp
    onent], ParameterBindingException
    + FullyQualifiedErrorId : ParameterBindingFailed,Microsoft.Office.Server.S
    earch.Cmdlet.NewSearchIndexComponent
    -----------------------------------------------
    I already have index partition 0 with 1 replica, now I want to add 1 more replica to this index partition.
    I ran your command on the current index replica server, not on the new index replica server.

    ReplyDelete
    Replies
    1. Here are the steps:
      https://technet.microsoft.com/en-us/library/jj862355.aspx

      Delete
  2. Hi,

    Please Help.

    I am unable to scale out Query Processing and Index Partition 0 to my WFE server. I have a Red X for both components in that server. Also, If I do:

    Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa

    Name State
    ---- -----
    IndexComponent1 Active
    Cell:IndexComponent1-SPcacc574b17feI.0.0 Active
    Partition:0 Active
    AdminComponent1 Active
    QueryProcessingComponent1 Active
    ContentProcessingComponent1 Active
    AnalyticsProcessingComponent1 Active
    QueryProcessingComponent2 Unknown
    IndexComponent2 Unknown
    CrawlComponent0 Active

    I have ran the Wizard, Reboot, recreated the Search Service App. I have both servers running the Search Windows Services with the same account.

    This is the code I ran:

    $ssi = Get-SPEnterpriseSearchServiceInstance -Identity "servername"

    Start-SPEnterpriseSearchServiceInstance -Identity $ssi

    Get-SPEnterpriseSearchServiceInstance -Identity $ssi

    do {$online = Get-SPEnterpriseSearchServiceInstance -Identity $ssi; Write-Host "Waiting for service: " $online.Status} until ($online.Status -eq "Online")

    $ssa = Get-SPEnterpriseSearchServiceApplication

    $active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active

    $clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active

    New-SPEnterpriseSearchIndexComponent –SearchTopology $clone -SearchServiceInstance $ssi -IndexPartition 0 -RootDirectory "E:\SPIndex"

    Set-SPEnterpriseSearchTopology -Identity $clone

    Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa

    Get-SPEnterpriseSearchStatus -SearchApplication $ssa

    What else can I do?

    Thanks a lot for all your help.

    ReplyDelete
    Replies
    1. That should have done it. Is there enough space on your drives? I have seen problems with disk space.

      Delete
    2. That should have done it. Is there enough space on your drives? I have seen problems with disk space.

      Delete