Friday, March 15, 2013

CONFIGURATION DE LA TOPOLOGIE DE RECHERCHE SHAREPOINT 2013

Les GEDs SharePoint dépassent couramment le million de documents. Dans ce contexte, il faut créer (au moins) deux indexeurs en équilibre de charge, ce qui nous permettra en plus d’offrir de la tolérance de panne. 1. Préambule La source d’info : On retrouve logiquement une grande partie du paramétrage de fast sur http://technet.microsoft.com/fr-fr/library/jj219705.aspx Les prérequis : Pas de tests en prod ! - Deux serveurs SharePoint 2013 sur lesquels on n’a pas encore crée de service de recherche (de toute façons, vous ne voulez pas du wizard pour une install en production ;) o Le service de recherche ne doit pas être démarré sur les autres nœuds. Si oui, il faut faire un STOP service( ?) - Un répertoire local de stockage sur chaque serveur ou (mieux) plusieurs répertoires sur un espace partagé. Ils doivent exister et êtres vides. o Sur ces répertoires, le compte de ferme doit avoir le contrôle. Ceci se fait en accordant une permission au groupe local WSS_ADMIN_WPG qui le contient. o Un bug fait que les répertoires sont testés localement sur le serveur ou on lance le script. Ils doivent donc être tous être crées sur ce nœud si le stockage est local. - Classiquement : o Ouvrir une session avec le compte d’Install de la ferme o Lancer Powershell en mode administrateur Si vous avez créé un service de recherche avec une topologie incorrecte, ou que le script échoue, une chance, dropper un service applicatif prend deux lignes  $spapp = Get-SPServiceApplication -Name "Search Service Application" Remove-SPServiceApplication $spapp -RemoveData A faire avant chaque tentative. Gardez aussi à l’esprit que l’ordonnanceur interne de SharePoint n’est pas en temps réel, il vaut mieux donc attendre 5 mn avant de relancer le script au cas où un job serait encore dans la file du SPTIMER. 2. Les rôles On doit répartir les rôles query, admin, stats et content sur nos deux nœuds. Dans mon exemple, je suivrais la matrice suivante : ROLE SPIDX1 (Principal) SPIDX2 (Backup) CRAWL X X ADMIN X CONTENT X X STATS X QUERY X X 3. Les partitions - Le minimum pour l’équilibrage est deux partitions (0/1) - Le minimum pour la tolérance de panne est de découper en un maitre et un replica pour chaque partition (0/1 répliqué en 1/0) On aura donc quatre composants Index. 4. Le script Partant de cette configuration, on peut commencer à écrire le script : J’ai utilisé la nomenclature du technet. # RAZ! # Supprime le service applicatif et les BDD existantes $spapp = Get-SPServiceApplication -Name "Search Service Application" Remove-SPServiceApplication $spapp -RemoveData #============================================================== #Configuration Search Service Application (SSA) #============================================================== $SearchApplicationPoolName = "SearchAdminApplicationPool" $SearchApplicationPoolAccountName = "SP2013\SP_SEARCH" $SearchServiceApplicationName = "Search Service Application" $SearchServiceApplicationProxyName = "Search Service Application Proxy" $DatabaseInstance = "SQL2012\SPSQL2013" $DatabaseName = "Sharepoint2013_SearchService" #Nom des serveurs d’index $App1 = “SPIDX1” $App2 = "SPIDX2" #Reps Exemples. Attention à mettre deux reps differents en Stockage partagé! $IndexLocationServer1 = "D:\IDX_HostA" $IndexLocationServer2 = "D:\IDX_HostB" # Création des reps (avec le bug local) New-Item -Path "\\SPIDX1\d$\IDX_HOSTA" -type directory -force New-Item -Path "\\SPIDX1\d$\IDX_HOSTB" -type directory -force New-Item -Path "\\SPIDX2\d$\IDX_HOSTB" -type directory -force   #============================================================== # Création du Pool s’il n’existe pas #============================================================== Write-Host -ForegroundColor DarkGray "Test – Pool SSA" $SPServiceApplicationPool = Get-SPServiceApplicationPool -Identity $SearchApplicationPoolName -ErrorAction SilentlyContinue if (!$SPServiceApplicationPool) { Write-Host -ForegroundColor Yellow "Création – Pool SSA" $SPServiceApplicationPool = New-SPServiceApplicationPool -Name $SearchApplicationPoolName -Account $SearchApplicationPoolAccountName -Verbose } #============================================================== #Search Service Application #============================================================== Write-Host -ForegroundColor DarkGray "Test - SSA" $SearchServiceApplication = Get-SPEnterpriseSearchServiceApplication -Identity $SearchServiceApplicationName -ErrorAction SilentlyContinue if (!$SearchServiceApplication) { Write-Host -ForegroundColor Yellow "Création - SSA" $SearchServiceApplication = New-SPEnterpriseSearchServiceApplication -Name $SearchServiceApplicationName -ApplicationPool $SPServiceApplicationPool.Name -DatabaseServer $DatabaseInstance -DatabaseName $DatabaseName } Write-Host -ForegroundColor DarkGray "Test - SSA Proxy" $SearchServiceApplicationProxy = Get-SPEnterpriseSearchServiceApplicationProxy -Identity $SearchServiceApplicationProxyName -ErrorAction SilentlyContinue if (!$SearchServiceApplicationProxy) { Write-Host -ForegroundColor Yellow "Création - SSA Proxy" New-SPEnterpriseSearchServiceApplicationProxy -Name $SearchServiceApplicationProxyName -SearchApplication $SearchServiceApplicationName } #============================================================== # Démarrer le service – IDX1 #============================================================== $HostA = Get-SPEnterpriseSearchServiceInstance -Identity $App1 Write-Host -ForegroundColor DarkGray "Test – SSI 1" if($HostA.Status -ne "Online") { Write-Host -ForegroundColor Yellow "Démarrage – SSI 1" Start-SPEnterpriseSearchServiceInstance -Identity $HostA While ($HostA.Status -eq "Online") { Start-Sleep -s 5 } Write-Host -ForegroundColor Yellow "SSI 1 Démarré" } #============================================================== # Démarrer le service – IDX2 #============================================================== $HostB = Get-SPEnterpriseSearchServiceInstance -Identity $App2 Write-Host -ForegroundColor DarkGray " Test – SSI 2" if($HostB.Status -ne "Online") { Write-Host -ForegroundColor Yellow " Démarrage– SSI 2" Start-SPEnterpriseSearchServiceInstance -Identity $HostB While ($HostB.Status -eq "Online") { Start-Sleep -s 5 } Write-Host -ForegroundColor Yellow "SSI 2 Démarré" } #============================================================== # Créer une nouvelle topologie vide pour pouvoir la modifier, et la remplir. #============================================================== $InitialSearchTopology = $SearchServiceApplication | Get-SPEnterpriseSearchTopology -Active $NewSearchTopology = $SearchServiceApplication | New-SPEnterpriseSearchTopology #============================================================== # Composants IDX1 : Stats, Index, Crawl, Admin, Query #============================================================== New-SPEnterpriseSearchAnalyticsProcessingComponent -SearchTopology $NewSearchTopology -SearchServiceInstance $HostA New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $NewSearchTopology -SearchServiceInstance $HostA New-SPEnterpriseSearchCrawlComponent -SearchTopology $NewSearchTopology -SearchServiceInstance $HostA New-SPEnterpriseSearchAdminComponent -SearchTopology $NewSearchTopology -SearchServiceInstance $HostA New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $NewSearchTopology -SearchServiceInstance $HostA #============================================================== # Composants IDX2: Index, Crawl, Query (noeud de backup) #============================================================== New-SPEnterpriseSearchContentProcessingComponent -SearchTopology $NewSearchTopology -SearchServiceInstance $HostB New-SPEnterpriseSearchCrawlComponent -SearchTopology $NewSearchTopology -SearchServiceInstance $HostB New-SPEnterpriseSearchQueryProcessingComponent -SearchTopology $NewSearchTopology -SearchServiceInstance $HostB #============================================================== # Création de deux indexs, deux partitions = 4 replicas # spécifier les répertoires permet d'éviter de le stocker dans "Office Servers..." # A = 0/1 B= 1/0 #============================================================== New-SPEnterpriseSearchIndexComponent -SearchTopology $NewSearchTopology -SearchServiceInstance $HostA -IndexPartition 0 -RootDirectory $IndexLocationServer1 New-SPEnterpriseSearchIndexComponent -SearchTopology $NewSearchTopology -SearchServiceInstance $HostB -IndexPartition 1 -RootDirectory $IndexLocationServer2 New-SPEnterpriseSearchIndexComponent -SearchTopology $NewSearchTopology -SearchServiceInstance $HostA -IndexPartition 1 -RootDirectory $IndexLocationServer1 New-SPEnterpriseSearchIndexComponent -SearchTopology $NewSearchTopology -SearchServiceInstance $HostB -IndexPartition 0 -RootDirectory $IndexLocationServer2 #============================================================== # Enregistrement de la topologie #============================================================== Write-Host -ForegroundColor Yellow "Enregistrement tolologie" Set-SPEnterpriseSearchTopology -Identity $NewSearchTopology #============================================================== # Suppression de l’ancienne #============================================================== Write-Host -ForegroundColor DarkGray "Suppression tolologie.old" Remove-SPEnterpriseSearchTopology -Identity $InitialSearchTopology -Confirm:$false Write-Host -ForegroundColor Yellow "Supprimée" #============================================================== #Check Search Topology #============================================================== Get-SPEnterpriseSearchStatus -SearchApplication $SearchServiceApplication -Text Write-Host -ForegroundColor Yellow "Topologie configurée!" 5. Résultat attendu : On peut aussi tester en ligne de commande par, par exemple, Get-SPEnterpriseSearchStatus –SearchApplication « Serch Service Application" Emmanuel ISSALY Architecte Infrastructure Sharepoint MCNEXT

No comments: