Modify search topology in SharePoint 2013

Tanmoy Das 806 Reputation points
2021-07-15T01:40:23.037+00:00

Hi All,

I have 4 web servers as query/index components. I want to remove the query and index role from all of them, there are other servers with query and index roles.

Can this be done using PowerShell?

Is there any risk associated with it?

Do I need to reset the index first and then perform this? I prefer not to reset the index.

Microsoft 365 and Office | SharePoint Server | For business
0 comments No comments
{count} votes

Accepted answer
  1. Echo Du_MSFT 17,316 Reputation points
    2021-07-15T06:38:07.637+00:00

    Hi anonymous user ,

    You needn't reset the search index. But before we can start modifying the search topology, we need to ensure that the Search Index is empty and that no crawls are currently running or scheduled to run during our modifications.

    Please following step:

    Step 1: Check Index File Location

    Run the below PowerShell script as an admin:

    ADD-PSSNAPIN MICROSOFT.SHAREPOINT.POWERSHELL  
    $SSI = GET-SPENTERPRISESEARCHSERVICEINSTANCE  
    $SSI.COMPONENTS  
    

    114922-step1.png

    Step 2: Ensure Search Index is Empty and No Crawls are Running

    1. Browse to SharePoint Central Administration >> Application Management >> Manage Service Applications >> Search Service Application
    2. From the Search Service Application: Search Administration page, ensure that the Searchable Items shows “0”
      114854-step2.png
      1. Next, while still on the Search Administration page, select Content Sources from the Crawling section in the quick launch area.
      2. On the Manage Content Sources page, verify that the status shows “Idle” and no crawls are scheduled to run in the near future.
        114780-step2-1.png

    Step 3: Modify Search Topology

    In my test, I have two Web Front End Servers and two Application servers. I will choose to run the Search components on both Application Servers. If you have more than two servers, the below script can be modified to add additional hosts.

    $HOSTA = GET-SPENTERPRISESEARCHSERVICEINSTANCE -IDENTITY "SERVER1"  
    $HOSTB = GET-SPENTERPRISESEARCHSERVICEINSTANCE -IDENTITY "SERVER2"  
    START-SPENTERPRISESEARCHSERVICEINSTANCE -IDENTITY $HOSTA  
    START-SPENTERPRISESEARCHSERVICEINSTANCE -IDENTITY $HOSTB  
    

    Wait until all the search service instances are running. At the Windows PowerShell command prompt, type the following commands until the commands return the state "Online" for each of the search service instances:

    GET-SPENTERPRISESEARCHSERVICEINSTANCE -IDENTITY $HOSTA  
    GET-SPENTERPRISESEARCHSERVICEINSTANCE -IDENTITY $HOSTB  
    

    You will now need to create an entirely new Search Topology. Using PowerShell ISE, type and run the following commands:

    $SSA = GET-SPENTERPRISESEARCHSERVICEAPPLICATION  
    $NEWTOPOLOGY = NEW-SPENTERPRISESEARCHTOPOLOGY -SEARCHAPPLICATION $SSA  
    

    Now it is time to choose which search components you want to run on what servers. In this example, as I only have two application servers, I am going to split each component and have each server run all components. As you can see in the following commands, each server will host the same six components.

    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 0  
    

    Now activate the new search topology. Run the following command to active the topology. (PS: This command could take a few minutes to run)

    SET-SPENTERPRISESEARCHTOPOLOGY -IDENTITY $NEWTOPOLOGY  
    

    Verify that the new search topology is active:

    GET-SPENTERPRISESEARCHTOPOLOGY -SEARCHAPPLICATION $SSA  
    

    The following command can be used to verify each component of the search topology.

    • GET-SPENTERPRISESEARCHSTATUS -SEARCHAPPLICATION $SSA -TEXT

    Reference:

    Thanks,
    Echo Du

    ======================================

    If an Answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.