Sharepoint 2013 : Configuring Enterprise Search (part 1) - Scaling Out Topology
Your search topology is created and configured from the point when you install SharePoint 2013, and then scaled out to improve performance and fault tolerance. You can think about the topology being created and modified in four distinct steps:
- Install initial farm — Your default topology is created when you install SharePoint and create the Search Service application. This topology may be good enough, but you will likely need to scale it out at some point.
- Create a new topology — This is accomplished with the new PowerShell cmdlet New-SPEnterpriseSearchTopology. You never modify the active topology. When you want to create a new topology, you create a clone of the active topology using New-SPEnterpriseSearchTopology -Clone, and then make changes to the clone.
- Add search components and assign servers — The search components
discussed previously are created and assigned to servers in the clone
topology. The following cmdlets are used to create the search
components:
- New-SPEnterpriseSearchAdminComponent
- New-SPEnterpriseSearchAnalyticsProcessingComponent
- New-SPEnterpriseSearchContentProcessingComponent
- New-SPEnterpriseSearchCrawlComponent
- New-SPEnterpriseSearchQueryProcessingComponent
- Activate the topology — The new topology is made the active topology by activating the clone using the following cmdlet:
Set-SPEnterpriseSearchTopology
Scaling Out Topology
SharePoint 2013 administration of the search topology is accomplished using PowerShell. The Central Administration web interface used in SharePoint 2010 has been deprecated. This section walks through the process of changing the default search topology. As a starting point, the discussion assumes the following:
- SharePoint Server 2013 is installed on a single server, and a Search Service application with a default search topology has been created .
- You are using an account with farm administrator permissions for the Search Service application.
- Use the Small Search Farm as your target topology. This topology
includes full search functionality with fault tolerance for up to 10
million items. The target topology is described in the document
“Enterprise Search Architectures for SharePoint Server 2013,” available
for download from http://go.microsoft.com/fwlink/p/?LinkId=258448.
NOTE The white paper, “Enterprise Search Architectures for SharePoint Server 2013,” also includes the topology for a medium and large search farm. The process we are going to use to create a small search farm can be applied to creating the larger farms. If you are creating a search farm to support a public Internet website, you should review the white paper, “Internet Sites Search Architectures for SharePoint Server 2013,” available for download fromhttp://go.microsoft.com/fwlink/?LinkId=263989&clcid=0x409.
- SharePoint 2013 is installed on all the application servers that will be hosting the search components, and they have been added to the farm .
The default search topology delivered by the install procedure is good for a development environment, and this is the topology discussed here. Because of the demands the search processes place on CPU and memory, administrators should familiarize themselves with the recommended hardware requirements necessary to support search, and the search topology limits and boundaries. These topics are discussed in detail in the references shown in Table 1. Some of this information is discussed throughout the section.
TABLE 1: Search Topology Limits and Boundaries
| INFORMATION | DESCRIPTION | REFERENCE |
| Search boundaries and limits | Search topology guidelines for the number of crawl databases, crawl components, index components, partitions and replicas, etc. | http://technet.microsoft.com/en-US/library/6a13cd9f-4b44-40d6-85aa-c70a8e5c34fe.aspx#Search |
| Scaling search for performance and availability | A summary of the hardware requirements for search topologies, and the corresponding scaling and redundancy considerations | http://technet.microsoft.com/en-US/library/jj219628.aspx |
Creating and Managing the Search Topology
The following steps will create a small enterprise search topology on multiple SharePoint 2013 application servers. You should download the document, “Enterprise Search Architectures for SharePoint Server 2013,” referenced earlier, and become familiar with the topology. The portion of the topology pertaining to the search components is shown in Table 2.
TABLE 2: Small Farm Search Topology
This topology uses virtual machines on physical application servers, but the use of virtual machines is not required. As you can see, the topology includes fault tolerance, which means that all search components and index partitions on Server1 and Server2 are duplicated to Server3 and Server4, with the latter servers deployed across a different physical host. This topology includes one index partition, and one index replica on Server2 and Server4. Each replica contains the same search index, and they are hosted on different physical servers to achieve fault tolerance. Note the following guidelines when assigning search components to the same server:
- Content processing and analytics should be together.
- Administration and crawl should be together.
- Index and query processing should be together.
The following steps will change the default search topology (with an empty search index) to what is referred to as a small search farm. You may recognize many of the PowerShell commands, but applied across multiple servers:
1. Open a SharePoint 2013 Management Shell with the Run as administrator option.
2. Start a new Search Service instance on the target servers, using the following PowerShell cmdlets. This must be completed before you can add any search components to the server, because this instance starts all the necessary Windows services:$host1 = Get-SPEnterpriseSearchServiceInstance -Identity "server1"
$host2 = Get-SPEnterpriseSearchServiceInstance -Identity "server2"
$host3 = Get-SPEnterpriseSearchServiceInstance -Identity "server3"
$host4 = Get-SPEnterpriseSearchServiceInstance -Identity "server4"
Start-SPEnterpriseSearchServiceInstance -Identity $host1
Start-SPEnterpriseSearchServiceInstance -Identity $host2
Start-SPEnterpriseSearchServiceInstance -Identity $host3
Start-SPEnterpriseSearchServiceInstance -Identity $host4
3. Before
adding the search components, you need to ensure that each of the
instances is running. To do so, execute the following command for each
server, and you should receive output similar to the following, with
status “Online” once the instances are running:
Get-SPEnterpriseSearchServiceInstance -Identity $host1
TypeName : SharePoint Server Search
Description : Index content and serve search queries
Id : 82ce8815-ecbd-4cf3-a98e-33f20bd86039
Server : SPServer Name=Server1
Service : SearchService Name=OSearch15
Role : None
Status : Online
4. Create a new search topology that is associated with the Search Service application:
$ssa = Get-SPEnterpriseSearchServiceApplication
$newSearchTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa
5. View the
active search topology of the Search Service application using the
following cmdlets, and you should receive similar output to that shown:
$ssa = Get-SPEnterpriseSearchServiceApplication
$activeTopology = Get-SPEnterpriseSearchTopology -Active -SearchApplication
$ssa
$activeTopology
TopologyId : fc35e4ad-df07-4c1e-8c03-46e0bb91180c
CreationDate : 12/20/2012 6:10:00 AM
State : Active
ComponentCount : 6
6. Create the search components and add them to the appropriate servers as specified in Table 2:
New-SPEnterpriseSearchAdminComponent -SearchTopology $newSearchTopology
-SearchServiceInstance $host1
New-SPEnterpriseSearchCrawlComponent -SearchTopology $newSearchTopology
-SearchServiceInstance $host1
New-SPEnterpriseSearchContentProcessingComponent -SearchTopology
$newSearchTopology
-SearchServiceInstance $host1
New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology
$newSearchTopology
-SearchServiceInstance $host1
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology
$newSearchTopology
-SearchServiceInstance $host2
New-SPEnterpriseSearchIndexComponent -SearchTopology $newSearchTopology
-SearchServiceInstance $host2 -IndexPartition 0
New-SPEnterpriseSearchAdminComponent -SearchTopology $newSearchTopology
-SearchServiceInstance $host3
New-SPEnterpriseSearchCrawlComponent -SearchTopology $newSearchTopology
-SearchServiceInstance $host3
New-SPEnterpriseSearchContentProcessingComponent -SearchTopology
$newSearchTopology
-SearchServiceInstance $host3
New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology
$newSearchTopology
-SearchServiceInstance $host3
New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology
$newSearchTopology
-SearchServiceInstance $host4
New-SPEnterpriseSearchIndexComponent -SearchTopology $newSearchTopology
-SearchServiceInstance $host4 -IndexPartition 0
7. The search
components for each of the servers can be viewed using the following
cmdlets. The output is sent to a text file, so that you have easy
access to the ComponentId of the search components. You use this in
step 11 when you remove a search component:
$file = "c:\componentinfo.txt
$ssa = Get-SPEnterpriseSearchServiceApplication
$activeTopology = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
Get-SPEnterpriseSearchComponent -SearchTopology $activeTopology | Out-File $file
8. Activate the search topology as follows:
Set-SPEnterpriseSearchTopology -Identity $newSearchTopology
9. The
following cmdlet verifies that the topology is active, an example
output is shown beneath the cmdlet. The default topology should be
listed first in the output, but with the State Inactive, and the new topology listed next, with ComponentCount 12.
This completes the creation of the small search topology. If you needed
to make changes to a topology, such as delete, add, or move a
component, the steps for these operations start with step 10:
Get-SPEnterpriseSearchTopology -SearchApplication $ssa
TopologyId : fc35e4ad-df07-4c1e-8c03-46e0bb91180c
CreationDate : 12/20/2012 6:10:00 AM
State : Inactive
ComponentCount : 6
TopologyId : b68d64b2-df38-42be-b7f3-9ababc483832
CreationDate : 12/20/2012 7:02:00 AM
State : Active
ComponentCount : 12
10. To remove
a search component, you must first create a clone of the topology,
because you cannot change the active topology. This process also
applies to making changes to a search topology that already has items
in the search index:
$ssa = Get-SPEnterpriseSearchServiceApplication
$activeTopology = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone
-SearchTopology $activeTopology
11. Use the
following cmdlet to remove the search component from the server of
interest. You need the ID of the search component you wish to remove,
called the ComponentId, which is part of the output from step 7:
Remove-SPEnterpriseSearchComponent -Identity <ComponentId>
-SearchTopology $clone
12. You can
also add any of the search components using the first set of cmdlets
that follows. Recall that these cmdlets were used previously in step 6.
The single cmdlet shown beneath the top five cmdlets adds the crawl
component to Server2, but using the clone topology. You can also verify
that the process was successful, just as you did in step 7.
# Cmdlets for creating new search components
New-SPEnterpriseSearchAdminComponent
New-SPEnterpriseSearchAnalyticsProcessingComponent
New-SPEnterpriseSearchContentProcessingComponent
New-SPEnterpriseSearchCrawlComponent
New-SPEnterpriseSearchQueryProcessingComponent
# Cmdlet to add the crawl component to Server2 in the clone topology
New-SPEnterpriseSearchCrawlComponent –SearchTopology $clone
-SearchServiceInstance $host2
# Verify component was added successfully
Get-SPEnterpriseSearchComponent -SearchTopology $clone
13. To move a search component to a different server, you create a clone topology, create the component on the server of interest using the clone, and then delete the desired component from the clone.
14. After you have made changes to the clone topology, you need to make the clone the active topology, as follows:Set-SPEnterpriseSearchTopology -Identity $clone
That completes this section on managing search topology. The next section focuses specifically on the index component of the search topology. Managing the index component is similar, and you will reuse much of what you have already learned from the discussion in this section.
Managing the Index Topology
The following discussion applies to adding a replica to an existing partition, adding a new partition, and deleting (also called removing) and moving an index component. The PowerShell cmdlet New-SPEnterpriseSearchIndexComponent is used to manage both index partitions and index replicas. An index component represents an index replica. As mentioned previously, the index is divided into discrete portions called partitions, with each partition stored as a set of files on a local disk. You manage more content by adding a new partition for each 10 million items. Replicas help manage query volume, and provide fault tolerance.
Removing an Index Component
This is accomplished using the same process described in step 7 of the previous section. To remove a search component, in this case the index replica on Server4, you would first create a clone of the topology, and remove the replica from the clone topology by using the ConponentId of the index component on Server4. You would then need to make the clone topology the active topology, just as you did before. This process works as long as you have more than one active index replica for an index partition. To remove all replicas for a partition, you need to remove and re-create the Search Service application, and then create the new topology.
Adding an Index Component
Just as you can remove a replica, as described in the previous section for the replica on Server4, now you can add it back, using the same process: Create a clone topology, add the index component, and finally activate the clone topology. The following cmdlets create an index replica on Server4 for the index partition on Server2, and monitor the status of updating the new index replica. During the update process, all components will have a State of Degraded until the process is complete, then the State will be Active. This takes only a few minutes in your development farm, but on a production farm this could take hours depending on the size of the index:
# Add the new index replica to existing partition
New-SPEnterpriseSearchIndexComponent –SearchTopology $clone
-SearchServiceInstance $host4 -IndexPartition 0
# Monitor status of updating new replica
Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Text
Moving an Index Component
To move the component, you need to add a new index component to the search topology, and then remove the old index component. The previous two sections explain how to add and remove an index component, and you can reuse the same logic in this section:
1. Clone the search topology and add a new index replica. After the index has replicated to the new index replica, activate the search topology.
2. Use the Get-EnterpriseSearchStatus cmdlet to determine when the new replica is Active, and clone the search topology once again.
3. Remove the unwanted index component, and activate the topology. Going through the process of making two clones helps to ensure fault tolerance while you are moving the index.
Adding a New Partition
You scale the search topology by adding a new index partition for each additional 10 million items. The new index component is added to the search topology and associated with a new partition number. For example, the small search farm scenario uses IndexPartition 0, so we would now be adding IndexPartition 1 to the topology. A new partition requires the search index to be repartitioned, as there is now more than one partition. Because there are two replicas for IndexPartition 0, you should also add two replicas for IndexPartition 1 to maintain fault tolerance. Before beginning the process, there are a few points you should consider:
- The repartitioning process can take several hours, and during this time the Search Service application is paused — and therefore unavailable for crawling, indexing, and responding to queries. You should not initiate other search topology changes during the repartitioning process.
- It is recommended that you make a backup of the Search Service application and the current index. This may sound a little paranoid, but the repartitioning process is a significant change to the index. If you are not sure how to create a backup, see http://technet.microsoft.com/en-us/library/ee748635.
- Ensure that you have sufficient disk space on the server that will host the new partition. For guidance on capacity planning, refer to http://technet.microsoft.com/en-us/library/jj219628, which is also referenced in Table 1.
Follow these steps to begin the process of adding a new partition to the small search farm scenario. You will add a second index partition, IndexPartition 1, to Server2 and Server4:
1. Check the status of the current search topology. The status can be viewed in the Search Administration page in Central Administration or run the PowerShell cmdlet Get-EnterpriseSearchStatus as you have done previously.
2. As before, create a clone of the topology prior to making changes:$ssa = Get-SPEnterpriseSearchServiceApplication
$activeTopology = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Active
$clone = New-SPEnterpriseSearchTopology -SearchApplication $ssa -Clone
-SearchTopology $activeTopology
3. Add a new
index partition by adding an index component to Server2 and Server4,
and associate them with the new index partition, IndexPartition 1:
New-SPEnterpriseSearchIndexComponent –SearchTopology $clone
-SearchServiceInstance $host2 -IndexPartition 1
New-SPEnterpriseSearchIndexComponent –SearchTopology $clone
-SearchServiceInstance $host4 -IndexPartition 1
4. Before you
make the clone topology the active topology, it is a good practice to
check the state of the Search Service application. To do so, execute
the following cmdlets. If the service is paused, check the ULS logs and
the SharePoint Health Analyzer alerts for a possible explanation. Fix
any errors, and restart the service, which can be done using a forced
resume if necessary using the cmdlet shown. As part of the
repartitioning process, you will pause the service, so this check is to
ensure that no other process has kick-started, such as backup, and
paused the service before you enter repartitioning:
# If IsPaused() returns False, the service is running
# If True, the service is paused
$ssa = Get-SPEnterpriseSearchServiceApplication
$ssa.IsPaused() –ne 0
# Force the service to resume
$ssa.ForceResume($ssa.IsPaused())
5. To start
the repartitioning, make the clone topology the active topology, which
as you know by now commits the changes to the search topology:
$ssa.PauseForIndexRepartitioning()
Set-SPEnterpriseSearchTopology -Identity $clone
The repartitioning process typically takes hours, but in your development environment with minimal content, this process should take less than 10 minutes, so grab a refill on the coffee and by the time you come back it should be complete.
6. You can monitor the progress of updating the index replicas just as you did before using the following cmdlet. Make sure you open a second instance of the PowerShell window when you run this cmdlet:# The newly added index replicas will show state Degraded
# until the process is complete
Get-SPEnterpriseSearchStatus -SearchApplication $ssa