No connection could be made because the target machine actively refused it
-
11-12-2020 - |
Question
Good day,
I am trying to reset my Index because I am getting the "Unable to retrieve topology component health states. This may be because the admin component is not up and running." I've tried resetting from both my App server and web server. I also tried using powershell I get this error "Reset" with "2" argument(s): "Failed to connect to system"
Thanks in Advance!
Solution
When topology health start to look bad, and restarting servers doesn't help, I usually end up building a clone of the active failing one. You should try it in your acceptance test environment before making changes to production. Read the script from top to bottom, before you start working your way through it line by line.
Caution! This script shouldn't be run all at once. Edit in your parameters, and use it wisely.
<#
Links to technet articles
Get-SPEnterpriseSearchComponent
http://technet.microsoft.com/en-us/library/jj219773.aspx
Remove-SPEnterpriseSearchComponent
http://technet.microsoft.com/en-us/library/jj219790.aspx
New-SPEnterpriseSearchIndexComponent
http://technet.microsoft.com/en-us/library/jj219721.aspx
New-SPEnterpriseSearchQueryProcessingComponen
http://technet.microsoft.com/en-us/library/jj219575.aspx
New-SPEnterpriseSearchCrawlComponent
https://technet.microsoft.com/en-us/library/ff608011.aspx
New-SPEnterpriseSearchContentProcessingComponent
https://technet.microsoft.com/en-us/library/jj219679.aspx
New-SPEnterpriseSearchAnalyticsProcessingComponent
https://technet.microsoft.com/en-us/library/jj219743.aspx
Set-SPEnterpriseSearchTopology
http://technet.microsoft.com/en-us/library/jj219653.aspx
#>
if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null)
{
Add-PSSnapin "Microsoft.SharePoint.PowerShell"
}
$WFE1 = Get-SPEnterpriseSearchServiceInstance -Identity "WFE001"
$WFE2 = Get-SPEnterpriseSearchServiceInstance -Identity "WFE002"
$APP1 = Get-SPEnterpriseSearchServiceInstance -Identity "APP001"
$APP2 = Get-SPEnterpriseSearchServiceInstance -Identity "APP002"
# If the Search Service Instance isn't started, run the following command
<#
Start-SPEnterpriseSearchServiceInstance $WFE1
Start-SPEnterpriseSearchServiceInstance $WFE2
Start-SPEnterpriseSearchServiceInstance $APP1
Start-SPEnterpriseSearchServiceInstance $APP2
#>
# Wait for ONLINE status, check by using this
Get-SPEnterpriseSearchServiceInstance $WFE1
Get-SPEnterpriseSearchServiceInstance $WFE2
Get-SPEnterpriseSearchServiceInstance $APP1
Get-SPEnterpriseSearchServiceInstance $APP2
# When ONLINE, make a clone
$ssa = Get-SPEnterpriseSearchServiceApplication
$active = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone -SearchTopology $active
### INDEX COMPONENT
# Create a new Index Partition (0) - outputs IndexComponent2 (i.e a replica for fault tolerance).
# Creating a new partition will devide the index
#New-SPEnterpriseSearchIndexComponent -SearchTopology $clone -SearchServiceInstance $APP2 -IndexPartition 0 -RootDirectory \\APP002\D$\index
### QUERY PROCESSING COMPONENT
# Create a new Query Processing Component
#New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $clone -SearchServiceInstance $WFE1
#New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $clone -SearchServiceInstance $WFE2
### CRAWL COMPONENT
# Create a new Crawl Component
New-SPEnterpriseSearchCrawlComponent -SearchTopology $clone -SearchServiceInstance $APP1
#New-SPEnterpriseSearchCrawlComponent -SearchTopology $clone -SearchServiceInstance $APP2
### CONTENT PROCESSING COMPONENT
# Create a new Content Processing Component
#New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $clone -SearchServiceInstance $APP1
New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $clone -SearchServiceInstance $APP2
### ANALYTICS PROCESSING COMPONENT
# Create a new Analytics Processing Component
#New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $clone -SearchServiceInstance $APP1
New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $clone -SearchServiceInstance $APP2
### VERIFY RESULT
Get-SPEnterpriseSearchComponent -SearchTopology $clone
### REMOVE DUPLICATE COMPONENTS
# Remove the old Component. Get the name, and add it to the remove statement
Remove-SPEnterpriseSearchComponent -SearchTopology $clone -Identity IndexComponent1
Remove-SPEnterpriseSearchComponent -SearchTopology $clone -Identity AnalyticsProcessingComponent1
Remove-SPEnterpriseSearchComponent -SearchTopology $clone -Identity ContentProcessingComponent1
Remove-SPEnterpriseSearchComponent -SearchTopology $clone -Identity CrawlComponent0
Remove-SPEnterpriseSearchComponent -SearchTopology $clone -Identity QueryProcessingComponent2
# Verify your clone, that should just contain your new components
Get-SPEnterpriseSearchComponent -SearchTopology $clone
# Verify that the search service application is running False=Running, True=Paused
$ssa.IsPaused() –ne 0
# If not paused, pause it
# Update! Don't pause the damn thing, It'll never go online again.
# You need to restart Search Services on all servers!!!
#$ssa.PauseForIndexRepartitioning()
# Set the clone as the new topology (takes a while).
# If Index component is Degraded, this will run with no end
Set-SPEnterpriseSearchTopology -Identity $clone
# If the above doesn't activate the clone, run the following
# If Index component is Degraded, this will run with no end
$clone.Activate()
# Before activating?
#---------------------------------------------------------------------------
# In another Management Shell, check which partition is the primary one.
$ssa = Get-SPEnterpriseSearchServiceApplication
Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Text
# Check status
# No output, and we're OK
Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Healthreport -Component IndexComponent2 | ? { ($_.name -match "repart") -or ( $_.name -match "splitting") } | ft -AutoSize Name, Message
# Check status
Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Healthreport -Component IndexComponent2 | select Name
Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Healthreport -Component IndexComponent3 | select Name
# Monitor the progress of the distribution of the index
Get-SPEnterpriseSearchStatus -SearchApplication $ssa | ft -AutoSize Name, State, Details
#---------------------------------------------------------------------------
# If something goes wrong, go back and activate the previous topology
$inactive = Get-SPEnterpriseSearchServiceApplication | Get-SPEnterpriseSearchTopology |? {$_.State -eq "Inactive"}
$inactive
$reactivate = Get-SPEnterpriseSearchTopology -SearchApplication $ssa |? {$_.TopologyId -eq "e67eee2e-d0be-49b6-b389-ec819788113f"}
$reactivate
$reactivate.Activate()
Set-SPEnterpriseSearchTopology -Identity $reactivate
#---------------------------------------------------------------------------
#Remove Inactive topologies
$inactive = Get-SPEnterpriseSearchServiceApplication | Get-SPEnterpriseSearchTopology |? {$_.State -eq "Inactive"}
# Verify
$inactive
Get-SPEnterpriseSearchServiceApplication | Get-SPEnterpriseSearchTopology |? {$_.State -eq "Inactive"} |% { Remove-SPEnterpriseSearchTopology -Identity $_ -Confirm:$false};