Thursday 3 August 2017

Create and Configure SharePoint 2013 Search service application

When you first create the Search Service Application, the search topology by default has all search components assigned to the server which is running the Central Administration. In multi servers farm scenario you need to change this topology using PowerShell.

Search architecture that you choose depends on how much content has to be searchable:
You can refer the below diagram to have better understanding for the topology that we are about to configure for 0-20 million items:
In this environment, we have five servers: two Front-Ends, two Application servers and one Index server.

Server Names:
  • CA1VMSPUATAPP01
  • CA1VMSPUATAPP02
  • CA1VMSPUATAPP03
  • CA1VMSPUATAPP04
Below are the steps that we are going to perform:
  • Create Search Service Application and Proxy
  • Add a New Index Component
  • Add a New Crawl Component
  • Add a New Content Processing Component
  • Add a New Analytics Component
  • Add a New Admin Component
We have assigned the following rules to each:
  • App01, App02 server are responsible for Query Processing and Index partitions.
  • App03, App04 has the Admin, Crawler, Content Processing and Analytics Processing roles.
#Load the SharePoint PowerShell snap-in or run these commands at the SharePoint Management Shell
Add-PSSnapin Microsoft.SharePoint.PowerShell -ErrorAction SilentlyContinue

#How to create a search service application.
$ssiAPP01 = "CA1VMSPUATAPP01"
$ssiAPP02 = "CA1VMSPUATAPP02"
$ssiAPP03 = "CA1VMSPUATAPP03"
$ssiAPP04 = "CA1VMSPUATAPP04"
$SearchAppPoolName = "Search_Service_AppPool"
#You’ll need to change the default content crawl account. By default Search uses the Farm account, which is a really bad idea. 
$SearchAppPoolAccountName = "corp\ca1_uat_searchpool"
$SearchServiceName = "Search Service Application"
$SearchServiceProxyName = "Search Service application proxy"
$DatabaseName = "SearchService_DB"

#Create a Search Service Application Pool
$spAppPool = New-SPServiceApplicationPool -Name $SearchAppPoolName -Account $SearchAppPoolAccountName -Verbose

#Start Search Service Instance on all Servers
Start-SPEnterpriseSearchServiceInstance $ssiAPP01 -ErrorAction SilentlyContinue
Start-SPEnterpriseSearchServiceInstance $ssiAPP02 -ErrorAction SilentlyContinue
Start-SPEnterpriseSearchServiceInstance $ssiAPP03 -ErrorAction SilentlyContinue
Start-SPEnterpriseSearchServiceInstance $ssiAPP04 -ErrorAction SilentlyContinue

#Create Search Service Application
$ServiceApplication = New-SPEnterpriseSearchServiceApplication -Partitioned -Name $SearchServiceName -ApplicationPool $spAppPool.Name -DatabaseName $DatabaseName 

#Create Search Service Proxy
New-SPEnterpriseSearchServiceApplicationProxy -Partitioned -Name $SearchServiceProxyName -SearchApplication $ServiceApplication

Search service application has been created. Now, we need to configure different search components as described above and then finalize the search topology.

#Clone the active search topology
The command creates a clone search topology that can be referenced with $clone if you continue to use the same SharePoint 2013 Management Shell to add or remove search components and to activate the search topology.

$clone = $ServiceApplication.ActiveTopology.Clone()

#Get Search Service Instance
$ssiapp01 = Get-SPEnterpriseSearchServiceInstance -Identity "CA1VMSPUATAPP01"
$ssiapp02 = Get-SPEnterpriseSearchServiceInstance -Identity "CA1VMSPUATAPP02"
$ssiapp03 = Get-SPEnterpriseSearchServiceInstance -Identity "CA1VMSPUATAPP03"
$ssiapp04 = Get-SPEnterpriseSearchServiceInstance -Identity "CA1VMSPUATAPP04"

#We need two admin components
New-SPEnterpriseSearchAdminComponent SearchTopology $clone -SearchServiceInstance $ssiapp03
New-SPEnterpriseSearchAdminComponent SearchTopology $clone -SearchServiceInstance $ssiapp04
 
#We need two content processing components for High Availability
New-SPEnterpriseSearchContentProcessingComponent SearchTopology $clone -SearchServiceInstance $ssiApp03
New-SPEnterpriseSearchContentProcessingComponent SearchTopology $clone -SearchServiceInstance $ssiApp04
 
#We need two analytics processing components for High Availability
New-SPEnterpriseSearchAnalyticsProcessingComponent SearchTopology $clone -SearchServiceInstance $ssiApp03
New-SPEnterpriseSearchAnalyticsProcessingComponent SearchTopology $clone -SearchServiceInstance $ssiApp04
 
#We need two crawl components for High Availability
New-SPEnterpriseSearchCrawlComponent SearchTopology $clone -SearchServiceInstance $ssiApp03
New-SPEnterpriseSearchCrawlComponent SearchTopology $clone -SearchServiceInstance $ssiApp04
 
#We need two query processing components for High Availability
New-SPEnterpriseSearchQueryProcessingComponent SearchTopology $clone -SearchServiceInstance $ssiApp01
New-SPEnterpriseSearchQueryProcessingComponent SearchTopology $clone -SearchServiceInstance $ssiApp02

As per the plan we have created all the search components.

Assuming that you do not have have index partition, and that partition has no replicas.  So let’s look first at adding a new search partition.

Note: To scale out the search index, you add a new index partition for each 10 million items.

To achieve fault tolerance for the search index, you add an index replica of an existing index partition to the search topology. Each index replica contains the same information.

#We need two index partitions 0,1 (0-20 million items)
#If you have 0-10 million items then 
New-SPEnterpriseSearchIndexComponent SearchTopology $clone -SearchServiceInstance $ssiApp01 -IndexPartition 0 -RootDirectory "E:\SPIndex"
New-SPEnterpriseSearchIndexComponent SearchTopology $clone -SearchServiceInstance $ssiApp02 -IndexPartition 1 -RootDirectory "E:\SPIndex"

#Activate the Topology
$clone.Activate()

# Verify the Topology 
$ssa = Get-SPEnterpriseSearchServiceApplication
Get-SPEnterpriseSearchTopology -Active -SearchApplication $ssa

# Verify the diagnostic information for all search components in the active topology of a Search Service Application.
Get-SPEnterpriseSearchStatus -Text -SearchApplication $ssa

That's it. Our search service application configuration completed and you need to run the full crawl after adding the content sources.

References..
https://www.microsoft.com/en-us/download/details.aspx?id=30374
https://technet.microsoft.com/en-us/library/jj219738.aspx
https://blogs.technet.microsoft.com/praveenh/2013/02/06/create-a-new-search-service-application-in-sharepoint-2013-using-powershell/
https://blogs.technet.microsoft.com/meamcs/2014/09/04/configuring-sharepoint-2013-search-topology/
http://stevemannspath.blogspot.in/2013/06/sharepoint-2013-scaling-out-enterprise.html

No comments:

Post a Comment