Monday, March 25, 2013

SharePoint 2013 Search: Fixing an Orphaned Search Component

Problem/Scenario
You previously moved a search component (e.g. Query Processing Component) to a web front end (WFE). For other issue resolutions, you needed to disconnect and then reconnect the WFE server to the SharePoint Farm. In reviewing the current Search Topology, there is an issue with the Query Processing Component:


Resolution

Run PowerShell as Administrator and load the SharePoint snap-in
(or run SharePoint 2013 Management Shell as Administrator):

Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

Get the Search Service Application and clone the search topology:

# Clone the active search topology
$ssa = Get-SPEnterpriseSearchServiceApplication
$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone –SearchTopology $active


Issue the following to review the cloned topology:

Get-SPEnterpriseSearchComponent -SearchTopology $clone

Locate the search component (e.g. QueryProcessingComponent) entry with the missing ServerName and copy the ComponentId:


 
 
Remove the component by using the ComponentId above as the -Identity value in the following:
# Remove Orphaned Component
Remove-SPEnterpriseSearchComponent -Identity d8450c12-09a8-4aa4-b824-b709a7a852e0 -SearchTopology $clone -confirm:$false
 
 
Add a new search component component using the respective cmdlet:
# Add New Search Component
$wfe = Get-SPEnterpriseSearchServiceInstance -Identity "<<wfe name here>>"
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $clone -SearchServiceInstance $wfe
 
 
Activate the search topology:
# Activate  Search Topology
Set-SPEnterpriseSearchTopology -Identity $clone
 
 
That's it! Refresh the search service application page and life is back to good:


23 comments:

  1. Regarding the "For other issue resolutions, you needed to disconnect and then reconnect the WFE server to the SharePoint Farm"...

    I just offer a forewarning that all components on that server will be busted once the server is re-joined to the farm. In a nutshell, each component references a SPServer by that server's name and [SPServer] ID. When you remove the server and re-join, the SPServer object will be assigned a new ID. However, the search component's reference to the server will not be updated... and that's where the problems can get REALLY ugly.

    ReplyDelete
    Replies
    1. Thanks Brian! Yes my Query Component was busted. I needed to remove and recreate.

      Delete
    2. Which commands did you use to remove and recreate it?

      Delete
    3. See the "Add a new search component..." part of this post. Each component has it's own cmdlet so you need to use the correct one.

      Delete
  2. Thanks so much! Exactly what I was searching for!

    ReplyDelete
  3. Steve, I have the same issue with red X, tried the above solution did not work, in my case it was not orphaned, either way, I removed and recreated it, still the same issue, any ideas and suggestions

    ReplyDelete
    Replies
    1. If you removed and recreated and still have the red X, there must be something wrong with that particular server. Is there enough memory? Enough free drive space? Also, sometimes running the product configuration wizard and/or rebooting the server makes things automagically work.

      Delete
    2. Steve, I tried all options still have the same issue

      Delete
    3. Check the services and make sure the sharepoint search service and timer job service are running.

      Delete
  4. I like how neatly you described this, but in my case I had a faulty Admin component in a server farm - which of course complicates things because the admin component is the one you use to manage the other components.

    Ended up having to replace the faulty server and SSA anyway, but lesson learned: always plan redundancy for the admin component.

    ReplyDelete
  5. Is it possible to use this solution to fix the admin component? actually I re-joined the search server to the farm which seems to broke my SSA and display this meesage: "The search service is not able to connect to the machine that host the administration component. Verify that the administration component 'e1774de7-741c-94f0-83g7-733bf9c7c38e' in search application "search application" is in a good state and try again. When I get the topology using powershell it shows that the admin component is in '1204258f-rfbb-378f-08d7-f981ef26d4c' which is different of the one that sharepoint is looking for.

    ReplyDelete
    Replies
    1. I would make sure you have another server running the Admin component first. Use PowerShell to make the good Admin server the primary search server.

      Delete
    2. Hi Steve,

      Thanks for your answer. As for your suggestion, I used the command "Get-SPEnterpriseSearchComponent" in powershell, which display all the information but the ServerName, that is really weird, I mean there's an active search topology without any server hosting the components....
      I looked for the SearchAdmin.svc in all servers in farm, but none of them has it.
      I tried to create and use a new topology but since the search service cant connect to the Admin component, it wont let me. Is there anything else I can do or should I just create a new search service?

      Thanks beforehand for your answer

      Delete
    3. If you did not customize search then it probably would be easier just to create a new search service.

      Delete
    4. The problem is when we don't have another server running the Admin component...

      Delete
  6. Hi,
    Great post.
    I have tried to move the Query Processing and Index 0 to the WFE. In the WFE the services are running under the same account as in the APP server. I ran the wizard in both servers and reboot both. I have 8 GB RAM servers for this enviroment. Do you think that could be the reason to have both components in red and with status unknown?

    ReplyDelete
    Replies
    1. Sounds like the new components haven't been created properly. I would remove and recreate.

      Delete
    2. Sounds like the new components haven't been created properly. I would remove and recreate.

      Delete
  7. Hi,

    Thanks.

    I tried that. Recreate the Search Service App? What will be the best way to scale that component out? Even the Index component get the same results. It's say status unknown

    ReplyDelete
    Replies
    1. Here are the recommended scale out architectures:

      https://www.microsoft.com/en-us/download/details.aspx?id=30383

      Delete
  8. Hi Steve,
    I deleted the Search Service Application from the Manage Service Application screen in CA. It removed the databases as desired and completed successfully, except that the Services on Server show the SharePoint Server Search as Started. When I click Stop it pops up a message and says to use the search administration, which is no longer around. Any idea on how to stop this service?

    ReplyDelete
    Replies
    1. You can stop it from Services within the Administrative tools of the server. You may also run the following at a command prompt:

      net stop osearch15

      Delete

Matched Content