笔者亲自测试通过的修改SharePoint 2013的Topology脚本记录

#2013-08-26 更新

#Author: ZhongDaoXueYou

#Copyright: 反正也是抄微软的, 大家随便用.



#Routine Starts Here

if ((Get-PSSnapin "Microsoft.SharePoint.PowerShell" -ErrorAction SilentlyContinue) -eq $null) 

{

    Add-PSSnapin "Microsoft.SharePoint.PowerShell"

}





$hostA = Get-SPEnterpriseSearchServiceInstance -Identity "APP1-SPS2013"

$hostB = Get-SPEnterpriseSearchServiceInstance -Identity "APP2-SPS2013"

Start-SPEnterpriseSearchServiceInstance -Identity $hostA

Start-SPEnterpriseSearchServiceInstance -Identity $hostB



#Wait until all the search service instances are running

#Commands below should return "Online" for both servers.

Get-SPEnterpriseSearchServiceInstance -Identity $hostA

Get-SPEnterpriseSearchServiceInstance -Identity $hostB





$ssa = Get-SPEnterpriseSearchServiceApplication

$newTopology = New-SPEnterpriseSearchTopology -SearchApplication $ssa



#Topology:

#APP1: AdminComponent, CrawlComponent, ContentProcessingComponent,AnalyticsProcessingComponent

#APP2: QueryProcessingComponent, IndexComponent

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 $hostB

New-SPEnterpriseSearchIndexComponent -SearchTopology $newTopology -SearchServiceInstance $hostB -IndexPartition 0



#To prevent error message "Topology activation failed. Each partition must have at least one index component..."

#"...from the previous topology in the new topology.",

#You may need to reset index in your test environment before you move on.



#Activate the new search topology

Set-SPEnterpriseSearchTopology -Identity $newTopology



#Verify that the new search topology is active, and get the old topology's ID

Get-SPEnterpriseSearchTopology -SearchApplication $ssa



#Remove the old topology object. Replace the ID with your own

$oldTopology = Get-SPEnterpriseSearchTopology -SearchApplication $ssa -Identity 35ef8906-b5f2-48bf-a3e5-8b53bdcb69ea

Remove-SPEnterpriseSearchTopology -Identity $oldTopology



#Verify that all components of the new search topology are running correctly

Get-SPEnterpriseSearchStatus -SearchApplication $ssa -Text 

 

运行结果

image

 

2013-08-26 更新 运行完脚本后, 可能会发现有些component(比如Index component需要拷贝索引, Admin component需要一些额外的配置)的状态是黄色的三角叹号, 不用担心, 等一下就会变为正常的绿色小勾了.

如果长时间保持黄色的叹号图标, 请检查你的index分区是否还有足够空间. 如果还不行, 就得查看SharePoint 日志排错了.

 

参考资料

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

Add Microsoft.SharePoint.PowerShell Snap-In to All PowerShell Windows

http://blogs.msdn.com/b/kaevans/archive/2011/11/14/add-microsoft-sharepoint-powershell-snap-in-to-all-powershell-windows.aspx

Change the default search topology in SharePoint Server 2013

http://technet.microsoft.com/en-us/library/jj862356.aspx

你可能感兴趣的:(SharePoint)