Condividi tramite


Gestire il servizio cache distribuita in SharePoint Server

SI APPLICA A:yes-img-132013 yes-img-162016 yes-img-192019 yes-img-seSubscription Edition no-img-sopSharePoint in Microsoft 365

Per eseguire attività di gestione e operative sul servizio cache distribuita in SharePoint Server, un amministratore deve eseguire procedure specifiche in un ordine prestabilito. In questo articolo viene descritto come eseguire varia attività di gestione e operative sul servizio cache distribuita.

Importante

[!IMPORTANTE] È possibile che il servizio cache distribuita si ritrovi in uno stato non funzionante o irreversibile se le procedure descritte in questo articolo non vengono eseguite con precisione. In casi estremi, potrebbe risultare necessario ricreare la server farm. Per SharePoint Server 2019, 2016 e 2013, la cache distribuita dipende da Windows Server AppFabric come prerequisito. Non amministrare il Servizio di memorizzazione nella cache di AppFabric dalla finestra Servizi in Strumenti di amministrazione nel Pannello di controllo. Non utilizzare le applicazioni nella cartella denominata AppFabric per Windows Server nel menu Start. L'aggiunta di sicurezza per AppFabric con la cache distribuita di SharePoint non è supportata. Per SharePoint Server Subscription Edition, il prodotto AppFabric di Windows Server separato è stato deprecato e la tecnologia è stata integrata internamente in SharePoint.

Importante

Non usare nomi di account di servizio che contengono il simbolo $.

Elenco dei cmdlet di PowerShell per il servizio Cache distribuita

I cmdlet di PowerShell seguenti sono ora disponibili in SharePoint Server PowerShell.

SharePoint Server Subscription Edition Cmdlet APP Fabric Cmdlet Descrizione
New-SPCache New-Cache Crea una nuova cache denominata quando il cluster è in esecuzione.
Get-SPCache Get-Cache Elenca tutte le cache e le aree del cluster e l'host della cache in cui risiede ogni area. Senza parametri, vengono restituite tutte le cache del cluster e i relativi dettagli dell'area host. Con i parametri Hostname e CachePort forniti, le cache e i dettagli dell'area vengono restituiti solo per l'host specificato.
Get-SPCacheStatistics Get-CacheStatistics Restituisce le statistiche per una cache o per un host cache.
Get-SPCacheHost Get-CacheHost Elenca tutti i servizi host della cache che sono membri del cluster di cache.
Start-SPCacheCluster Start-CacheCluster Avvia il servizio di memorizzazione nella cache in tutti gli host della cache nel cluster. Gli host lead vengono avviati per primi.
Stop-SPCacheCluster Stop-CacheCluster Arresta i servizi di memorizzazione nella cache in tutti gli host della cache nel cluster.
Import-SPCacheClusterConfig Import-CacheClusterConfig Importa i dettagli di configurazione del cluster della cache da un file XML.
Export-SPCacheClusterConfig Export-CacheClusterConfig Esporta la configurazione del cluster della cache in un file XML.
Get-SPCacheClusterHealth Get-CacheClusterHealth Restituisce le statistiche di integrità per tutte le cache denominate nel cluster di cache. Sono inclusi quelli che non sono ancora stati allocati.
Use-SPCacheCluster Use-CacheCluster Imposta il contesto della sessione di PowerShell su un cluster di cache specifico.
Get-SPCacheHostConfig Get-CacheHostConfig Ottiene le informazioni di configurazione dell'host della cache nel cluster della cache.
Get-SPCacheClusterInfo Get-CacheClusterInfo Ottiene le informazioni sul cluster della cache nella farm.
Set-SPCacheClusterSecurity Set-CacheClusterSecurity Imposta le proprietà di sicurezza del cluster di cache.

Avviare e arrestare il servizio cache distribuita

Un amministratore che esegue attività di manutenzione e operative potrebbe avere la necessità di avviare e arrestare il servizio cache distribuita. Tra le attività necessarie vi sono le seguenti:

  • Modifica della configurazione predefinita della server farm al momento dell'installazione. Il servizio cache distribuita viene avviato in tutti i server SharePoint al momento dell'installazione. Un amministratore potrebbe avere la necessità di arrestare il servizio cache distribuita in alcuni server nella farm.

  • Aggiornamento del server quando è presente un solo server di cache distribuita nella farm di SharePoint Server.

L'arresto della cache comporta una perdita parziale di dati. La cache dei feed dipende dal servizio Cache distribuita. I tag e le attività del documento vengono salvati solo nella cache dei feed. I tag e le attività dei documenti non vengono salvati in modo permanente nei database del contenuto. Quando il servizio Cache distribuita viene arrestato, le attività di tag e documenti vanno perse. Quando viene avviato il servizio Cache distribuita, il ripopolamento si verifica quando viene eseguito il processo timer di ripopolamento della cache dei feed. Un modo per gestire le attività dei tag e dei documenti consiste nell'usare il metodo descritto in Eseguire un arresto normale del servizio Cache distribuita usando uno script di PowerShell più avanti in questo articolo. Quando viene usato l'arresto normale del metodo del servizio Cache distribuita, tutti i dati della cache vengono spostati da un server a un altro prima dell'arresto del servizio Cache distribuita.

Nota

Se gli host della cache fanno parte di un cluster di cache, non avviare o arrestare il servizio Cache distribuita come descritto qui. Vedere invece Aggiungere o rimuovere un server in un cluster di cache distribuita più avanti in questo articolo.

Per avviare e arrestare il servizio cache distribuita tramite Amministrazione centrale

  1. In Amministrazione centrale fare clic su Gestione applicazioni.

  2. In Applicazioni di servizio fare clic su Gestisci servizi nel server.

  3. Nella pagina Servizi nel server individuare il servizio Cache distribuita.

  4. Se il servizio cache distribuita è avviato e si desidera arrestarlo, fare clic su Arresta in Azione. Se il servizio cache distribuita è arrestato e si desidera avviarlo, fare clic su Avvia in Azione.

Per avviare il servizio Cache distribuita tramite SharePoint Management Shell

Al prompt dei comandi di SharePoint Management Shell eseguire il comando seguente:

$instanceName ="SPDistributedCacheService Name=SPCache"
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
$serviceInstance.Provision()

Per arrestare il servizio Cache distribuita tramite SharePoint Management Shell

Al prompt dei comandi di SharePoint Management Shell eseguire il comando seguente:

$instanceName ="SPDistributedCacheService Name=SPCache"
$serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
$serviceInstance.Unprovision()

Modificare l'allocazione di memoria del servizio cache distribuita

Al momento dell'installazione di SharePoint Server, al servizio cache distribuita viene assegnato il 10% della memoria fisica totale del server. Il servizio cache distribuita utilizza la metà della memoria allocata per l'archiviazione dei dati (nota anche come dimensioni della cache) e l'altra metà per l'overhead di gestione della memoria. Con l'aumento dei dati memorizzati nella cache, il servizio cache distribuita utilizza l'intero 10% della memoria allocata.

Negli scenari seguenti vengono descritti i casi in cui è consigliabile aumentare l'allocazione di memoria per il servizio cache distribuita:

  • Aggiunta di memoria fisica al server. Poiché il servizio cache distribuita non ricalcola automaticamente l'allocazione di memoria del 10%, quando si aumenta la memoria fisica totale del server, è necessario aumentare manualmente l'allocazione di memoria del servizio cache distribuita.

  • Disponibilità di un server di cache distribuita dedicato nella server farm. Utilizzare il metodo seguente per calcolare la quantità di memoria che è possibile assegnare al servizio cache distribuita:

    1. Determinare la memoria fisica totale nel server. In questo esempio, la memoria fisica totale disponibile nel server è pari a 16 GB.

    2. Riservare 2 GB di memoria ad altri processi e servizi in esecuzione nell'host della cache. Ad esempio, 16 GB - 2 GB = 14 GB. La memoria rimanente viene allocata al servizio cache distribuita.

    3. Convertire la metà della memoria rimanente in MB. Ad esempio, 14 GB/2 = 7 GB o 7168 MB. Queste sono le dimensioni della cache del servizio cache distribuita.

    4. Utilizzare la procedura seguente per aggiornare l'allocazione di memoria corrispondentemente.

Modificare l'allocazione di memoria della cache distribuita

Utilizzare questa procedura per riconfigurare l'allocazione di memoria delle dimensioni della cache per il servizio cache distribuita.

  1. (Facoltativo) Per verificare l'allocazione di memoria esistente per il servizio cache distribuita in un server, al prompt dei comandi di SharePoint Management Shell eseguire il comando seguente:

    Use-SPCacheCluster
    Get-SPCacheHostConfig -HostName $Env:ComputerName
    

    Dove:

    • ComputerName è il nome computer del server in cui viene eseguito il cmdlet di SharePoint Management Shell.
  2. Arrestare il servizio cache distribuita in tutti gli host della cache. A tale scopo, accedere a Servizi nel server in Amministrazione centrale e selezionare Interrompi per arrestare il servizio cache distribuita in tutti gli host della cache nella farm.

  3. Per riconfigurare le dimensioni della cache del servizio cache distribuita, al prompt dei comandi di SharePoint Management Shell eseguire il comando seguente una sola volta in un host della cache:

    Update-SPDistributedCacheSize -CacheSizeInMB CacheSize
    

    Dove:

    • CacheSize è l'assegnazione dell'allocazione di memoria delle dimensioni della cache in MB. Nell'esempio precedente sono state calcolate dimensioni della cache di 7168 MB per un server con 16 GB di memoria totale.
  4. Riavviare il servizio cache distribuita in tutti gli host della cache. A tale scopo, accedere a Servizi nel server in Amministrazione centrale e selezionare Avvia per avviare il servizio cache distribuita in tutti gli host della cache nella farm.

Aggiungere o rimuovere un server in un cluster di cache distribuita

Un amministratore può aggiungere o rimuovere un server in un cluster della cache o potrebbe voler rimuovere un server dal cluster della cache, eseguire alcune attività operative o di manutenzione nel server e quindi ricongiungersi o aggiungere il server al cluster di cache. Quando si rimuove il server, il servizio Cache distribuita viene arrestato, quindi viene annullata la registrazione dal server. L'annullamento della registrazione del servizio Cache distribuita significa che un amministratore non visualizzerà il servizio Cache distribuita elencato nella pagina Servizi nel server in Amministrazione centrale. Analogamente, quando viene aggiunto un server, il servizio Cache distribuita viene registrato e quindi avviato nel server. La registrazione del servizio Cache distribuita significa che un amministratore visualizzerà il servizio Cache distribuita elencato nella pagina Servizi nel server in Amministrazione centrale.

Usare le procedure seguenti per aggiungere e rimuovere un server da un cluster di cache. Questi cmdlet di SharePoint Management Shell vengono eseguiti nel server che deve essere aggiunto o rimosso.

Nota

[!NOTA] Prima di eseguire le procedure descritte di seguito, verificare che il firewall consenta il traffico ICMP (ICMPv4) in entrata. Per ulteriori informazioni, vedere Considerazioni sulla configurazione del firewall.

Aggiungere un server al cluster di cache e avviare il servizio Cache distribuita tramite SharePoint Management Shell

Al prompt dei comandi di SharePoint Management Shell eseguire il comando seguente:

Add-SPDistributedCacheServiceInstance

Rimuovere un server dal cluster della cache usando SharePoint Management Shell

Al prompt dei comandi di SharePoint Management Shell eseguire il comando seguente:

Remove-SPDistributedCacheServiceInstance

Importante

[!IMPORTANTE] Questa procedura arresterà il servizio cache, e i dati memorizzati nella cache non salvati in modo permanente andranno perduti. Se si desidera mantenerli, utilizzare la procedura di arresto normale descritta nella sezione successiva.

Eseguire un arresto normale del servizio di cache distribuita tramite uno script di PowerShell

In una farm di SharePoint Server esiste un cluster di cache quando uno o più host della cache eseguono il servizio Cache distribuita. In una farm di SharePoint Server esiste una cache e la cache si estende nel cluster della cache. Per un amministratore potrebbe essere necessario spostare i contenuti memorizzati nella cache in un altro host della cache quando si applicano gli aggiornamenti al server. Per evitare la perdita di dati associata allo spostamento del contenuto memorizzato nella cache, è necessario eseguire un arresto normale del server usando lo script di PowerShell nella procedura seguente. La procedura di arresto normale consente di trasferire tutti i dati memorizzati nella cache dall'host in cui viene eseguita tale procedura a un altro host nella farm. L'esecuzione del processo di trasferimento richiede 15 minuti o più, a seconda del numero di elementi esistenti nella cache.

Per eseguire un arresto normale del servizio cache distribuita tramite uno script di PowerShell

Utilizzare il seguente script di PowerShell per eseguire l'arresto normale del server di cache distribuita al fine di spostare i contenuti memorizzati nella cache in un altro host della cache. Assicurarsi di specificare il nodo corretto per arrestare e modificare lo script in base alle esigenze per assegnare un nome ai parametri corretti per l'organizzazione.

Nota

[!NOTA] Non è necessario rimuovere l'host della cache da un cluster di cache se si usa lo script di PowerShell nella procedura seguente per eseguire l'arresto normale.

Nota

In SharePoint Server Subscription Edition non eseguire ps script per l'arresto normale. Eseguire invece Stop-SPDistributedCacheServiceInstance con -Graceful il parametro per eseguirla.

  1. Verificare che siano soddisfatti i requisiti minimi seguenti:

  2. Copiare le seguenti dichiarazioni di variabili e incollarle in un editor di testo come Blocco note. Impostare valori dei parametri specifici della propria organizzazione. Salvare il file e denominarlo GracefulShutdown.ps1.

    Nota

    È possibile usare un nome di file diverso, ma è necessario salvare il file come file di testo con codifica ANSI con l'estensione .ps1.

    ## Settings you may want to change for your scenario ##
    $startTime = Get-Date
    $currentTime = $startTime
    $elapsedTime = $currentTime - $startTime
    $timeOut = 900
    Use-CacheCluster
    try
    {
        Write-Host "Shutting down distributed cache host."
     $hostInfo = Stop-CacheHost -Graceful -CachePort 22233 -ComputerName sp2016App.contoso.com
     while($elapsedTime.TotalSeconds -le $timeOut-and $hostInfo.Status -ne 'Down')
     {
         Write-Host "Host Status : [$($hostInfo.Status)]"
         Start-Sleep(5)
         $currentTime = Get-Date
         $elapsedTime = $currentTime - $startTime
         $hostInfo = Get-CacheHost -HostName SP2016app.contoso.com -CachePort 22233
     }
     Write-Host "Stopping distributed cache host was successful. Updating Service status in SharePoint."
     Stop-SPDistributedCacheServiceInstance
     Write-Host "To start service, please use Central Administration site."
    }
    catch [System.Exception]
    {
     Write-Host "Unable to stop cache host within 15 minutes." 
    }
    

    Dove sp2016App.contoso.com è il nome di dominio del computer del server cache distribuita usato.

  3. Aprire SharePoint Management Shell.

  4. Passare alla directory in cui è stato salvato il file.

  5. Al prompt dei comandi di PowerShell digitare il comando seguente:

    ./GracefulShutdown.ps1
    

    Per altre informazioni su script e .ps1 file di PowerShell, vedere Esecuzione di script di Windows PowerShell.

Modificare l'account di servizio

Quando la server farm viene configurata per la prima volta, l'account della server farm viene impostato come account del servizio di memorizzazione nella cache appFabric/servizio di memorizzazione nella cache di SharePoint. Il servizio Cache distribuita dipende dal servizio di memorizzazione nella cache appFabric o dal servizio di memorizzazione nella cache di SharePoint. Per modificare l'account del servizio di memorizzazione nella cache di AppFabric/Servizio di memorizzazione nella cache di SharePoint in un account gestito:

Selezionare il servizio per modificare l'account del servizio.

  1. Creare un account gestito.

  2. Impostare l'account gestito come account del servizio nel servizio di memorizzazione nella cache di SharePoint. Al prompt dei comandi di SharePoint Management Shell eseguire il comando seguente:

    $farm = Get-SPFarm
    $cacheService = $farm.Services | where {$_.Name -eq "SPCache"}
    $accnt = Get-SPManagedAccount -Identity domain_name\user_name
    $cacheService.ProcessIdentity.CurrentIdentityType = "SpecificUser"
    $cacheService.ProcessIdentity.ManagedAccount = $accnt
    $cacheService.ProcessIdentity.Update() 
    $cacheService.ProcessIdentity.Deploy()
    

    Dove Domain_name\user_name è il nome di dominio e il nome utente dell'account gestito di SharePoint.

Perfezionare il servizio cache distribuita tramite uno script di PowerShell

Monitoraggio

È possibile monitorare i contatori delle prestazioni nei server cache distribuita per comprendere meglio i problemi di prestazioni della cache. Alcuni dei contatori che sono in genere utili per risolvere i problemi includono:

  1. %cpu utilizzata dal servizio cache.

  2. %time spent in GC dal servizio cache.

  3. Totale mancati riscontri nella cache/sec: un valore elevato può indicare che le prestazioni dell'applicazione potrebbero subire problemi perché non è in grado di recuperare i dati dalla cache. Le possibili cause includono lo sfratto e/o la scadenza degli elementi dalla cache.

  4. Total object count ( Conteggio totale oggetti): fornisce un'idea del numero di elementi presenti nella cache. Un calo significativo del numero di oggetti potrebbe significare lo sfratto o la scadenza.

  5. Totale richieste client/sec: questo contatore è utile per dare un'idea del carico generato nei server della cache dall'applicazione. Un valore basso in questo caso indica in genere una sorta di collo di bottiglia al di fuori del server della cache (ad esempio nell'applicazione o nella rete) e quindi un carico ridotto viene inserito nei server della cache.

  6. Oggetti eliminati totali: se i server della cache eliminano costantemente gli elementi per fare spazio agli oggetti più recenti nella cache, in genere è una buona indicazione che sarà necessaria più memoria nei server della cache per contenere il set di dati per l'applicazione.

  7. Eccezioni di errore totali/sec e Eccezioni per tentativi totali/sec.

L'impostazione del servizio di cache distribuita per MaxConnectionsToServer viene spesso ottimizzata in base al numero di CPU utilizzate nel computer host. Se, ad esempio, si usano più core e quindi si imposta l'impostazione MaxConnectionsToServer sullo stesso numero di CPU, il computer usa spesso troppa memoria e si blocca. Problemi simili si verificano quando si regolano le impostazioni DistributedLogonTokenCache e DistributedViewStateCache. L'impostazione predefinita è 20 ms, ma spesso vengono rilevate eccezioni quando la memorizzazione nella cache dei token non viene eseguita nell'impostazione 20 ms. Usare gli script di PowerShell seguenti per modificare le impostazioni per il numero massimo di connessioni e timeout in SharePoint Server 2016 e SharePoint Server 2013.

Per ottimizzare il servizio cache distribuita tramite uno script di PowerShell

  1. Verificare che siano soddisfatti i requisiti minimi seguenti:

  2. Copiare le seguenti dichiarazioni di variabili e incollarle in un editor di testo come Blocco note. Impostare valori dei parametri specifici della propria organizzazione. Salvare il file e denominarlo MaxConnections.ps1.

    Nota

    È possibile usare un nome di file diverso, ma è necessario salvare il file come file di testo con codifica ANSI con l'estensione .ps1.

    SharePoint Server Subscription Edition e SharePoint Server 2019 PowerShell Script

    Add-PSSnapin Microsoft.Sharepoint.Powershell -ea 0
    
    #DistributedLogonTokenCache
    $DLTC = Get-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache
    $DLTC.MaxConnectionsToServer = 1
    $DLTC.requestTimeout = "3000"
    $DLTC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache $DLTC
    
    #DistributedViewStateCache
    $DVSC = Get-SPDistributedCacheClientSetting -ContainerType DistributedViewStateCache
    $DVSC.MaxConnectionsToServer = 1
    $DVSC.requestTimeout = "3000"
    $DVSC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedViewStateCache $DVSC
    
    #DistributedAccessCache
    $DAC = Get-SPDistributedCacheClientSetting -ContainerType DistributedAccessCache
    $DAC.MaxConnectionsToServer = 1
    $DAC.requestTimeout = "3000"
    $DAC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedAccessCache $DAC
    
    #DistributedActivityFeedCache
    $DAF = Get-SPDistributedCacheClientSetting -ContainerType DistributedActivityFeedCache
    $DAF.MaxConnectionsToServer = 1
    $DAF.requestTimeout = "3000"
    $DAF.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedActivityFeedCache $DAF
    
    #DistributedActivityFeedLMTCache
    $DAFC = Get-SPDistributedCacheClientSetting -ContainerType DistributedActivityFeedLMTCache
    $DAFC.MaxConnectionsToServer = 1
    $DAFC.requestTimeout = "3000"
    $DAFC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedActivityFeedLMTCache $DAFC
    
    #DistributedBouncerCache
    $DBC = Get-SPDistributedCacheClientSetting -ContainerType DistributedBouncerCache
    $DBC.MaxConnectionsToServer = 1
    $DBC.requestTimeout = "3000"
    $DBC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedBouncerCache $DBC
    
    #DistributedDefaultCache
    $DDC = Get-SPDistributedCacheClientSetting -ContainerType DistributedDefaultCache
    $DDC.MaxConnectionsToServer = 1
    $DDC.requestTimeout = "3000"
    $DDC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedDefaultCache $DDC
    
    #DistributedSearchCache
    $DSC = Get-SPDistributedCacheClientSetting -ContainerType DistributedSearchCache
    $DSC.MaxConnectionsToServer = 1
    $DSC.requestTimeout = "3000"
    $DSC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedSearchCache $DSC
    
    #DistributedSecurityTrimmingCache
    $DTC = Get-SPDistributedCacheClientSetting -ContainerType DistributedSecurityTrimmingCache
    $DTC.MaxConnectionsToServer = 1
    $DTC.requestTimeout = "3000"
    $DTC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedSecurityTrimmingCache $DTC
    
    #DistributedServerToAppServerAccessTokenCache
    $DSTAC = Get-SPDistributedCacheClientSetting -ContainerType DistributedServerToAppServerAccessTokenCache
    $DSTAC.MaxConnectionsToServer = 1
    $DSTAC.requestTimeout = "3000"
    $DSTAC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedServerToAppServerAccessTokenCache $DSTAC
    
    #DistributedFileLockThrottlerCache
    $DFLTC = Get-SPDistributedCacheClientSetting -ContainerType DistributedFileLockThrottlerCache
    $DFLTC.MaxConnectionsToServer = 1
    $DFLTC.requestTimeout = "3000"
    $DFLTC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedFileLockThrottlerCache $DFLTC
    
    #DistributedSharedWithUserCache
    $DSWUC = Get-SPDistributedCacheClientSetting -ContainerType DistributedSharedWithUserCache
    $DSWUC.MaxConnectionsToServer = 1
    $DSWUC.requestTimeout = "3000"
    $DSWUC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedSharedWithUserCache $DSWUC
    
    #DistributedUnifiedGroupsCache
    $DUGC = Get-SPDistributedCacheClientSetting -ContainerType DistributedUnifiedGroupsCache
    $DUGC.MaxConnectionsToServer = 1
    $DUGC.requestTimeout = "3000"
    $DUGC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedUnifiedGroupsCache $DUGC 
    
    #DistributedResourceTallyCache
    $DRTC = Get-SPDistributedCacheClientSetting -ContainerType DistributedResourceTallyCache
    $DRTC.MaxConnectionsToServer = 1
    $DRTC.requestTimeout = "3000"
    $DRTC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedResourceTallyCache $DRTC
    
    #DistributedHealthScoreCache
    $DHSC = Get-SPDistributedCacheClientSetting -ContainerType DistributedHealthScoreCache
    $DHSC.MaxConnectionsToServer = 1
    $DHSC.requestTimeout = "3000"
    $DHSC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedHealthScoreCache $DHSC  
    
    #DistributedDbLevelFailoverCache
    $DDBFC = Get-SPDistributedCacheClientSetting -ContainerType DistributedDbLevelFailoverCache
    $DDBFC.MaxConnectionsToServer = 1
    $DDBFC.requestTimeout = "3000"
    $DDBFC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedDbLevelFailoverCache $DDBFC
    
    #DistributedEdgeHeaderCache
    $DEHC = Get-SPDistributedCacheClientSetting -ContainerType DistributedEdgeHeaderCache
    $DEHC.MaxConnectionsToServer = 1
    $DEHC.requestTimeout = "3000"
    $DEHC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedEdgeHeaderCache $DEHC
    
    #DistributedFileStorePerformanceTraceCache
    $DFSPTC = Get-SPDistributedCacheClientSetting -ContainerType DistributedFileStorePerformanceTraceCache
    $DFSPTC.MaxConnectionsToServer = 1
    $DFSPTC.requestTimeout = "3000"
    $DFSPTC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedFileStorePerformanceTraceCache $DFSPTC
    
    #DistributedSPAbsBlobCache
    $DSPABSC = Get-SPDistributedCacheClientSetting -ContainerType DistributedSPAbsBlobCache
    $DSPABSC.MaxConnectionsToServer = 1
    $DSPABSC.requestTimeout = "3000"
    $DSPABSC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedSPAbsBlobCache $DSPABSC
    
    #DistributedSPCertificateValidatorCache
    $DSPCVC = Get-SPDistributedCacheClientSetting -ContainerType DistributedSPCertificateValidatorCache
    $DSPCVC.MaxConnectionsToServer = 1
    $DSPCVC.requestTimeout = "3000"
    $DSPCVC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedSPCertificateValidatorCache $DSPCVC
    
    #DistributedSPOAuthTokenCache
    $DSPOATC = Get-SPDistributedCacheClientSetting -ContainerType DistributedSPOAuthTokenCache
    $DSPOATC.MaxConnectionsToServer = 1
    $DSPOATC.requestTimeout = "3000"
    $DSPOATC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedSPOAuthTokenCache $DSPOATC
    
    #DistributedStopgapCache
    $DSGC = Get-SPDistributedCacheClientSetting -ContainerType DistributedStopgapCache
    $DSGC.MaxConnectionsToServer = 1
    $DSGC.requestTimeout = "3000"
    $DSGC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedStopgapCache $DSGC
    
    #DistributedUnifiedAppsCache
    $DUAC = Get-SPDistributedCacheClientSetting -ContainerType DistributedUnifiedAppsCache
    $DUAC.MaxConnectionsToServer = 1
    $DUAC.requestTimeout = "3000"
    $DUAC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedUnifiedAppsCache $DUAC
    
    #DistributedUnifiedAuditCache
    $DUAuC = Get-SPDistributedCacheClientSetting -ContainerType DistributedUnifiedAuditCache
    $DUAuC.MaxConnectionsToServer = 1
    $DUAuC.requestTimeout = "3000"
    $DUAuC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedUnifiedAuditCache $DUAuC
    

    Script di PowerShell per SharePoint Server 2016

    Add-PSSnapin Microsoft.Sharepoint.Powershell -ea 0
    
    #DistributedLogonTokenCache
    $DLTC = Get-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache
    $DLTC.MaxConnectionsToServer = 1
    $DLTC.requestTimeout = "3000"
    $DLTC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache $DLTC
    
    #DistributedViewStateCache
    $DVSC = Get-SPDistributedCacheClientSetting -ContainerType DistributedViewStateCache
    $DVSC.MaxConnectionsToServer = 1
    $DVSC.requestTimeout = "3000"
    $DVSC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedViewStateCache $DVSC
    
    #DistributedAccessCache
    $DAC = Get-SPDistributedCacheClientSetting -ContainerType DistributedAccessCache
    $DAC.MaxConnectionsToServer = 1
    $DAC.requestTimeout = "3000"
    $DAC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedAccessCache $DAC
    
    #DistributedActivityFeedCache
    $DAF = Get-SPDistributedCacheClientSetting -ContainerType DistributedActivityFeedCache
    $DAF.MaxConnectionsToServer = 1
    $DAF.requestTimeout = "3000"
    $DAF.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedActivityFeedCache $DAF
    
    #DistributedActivityFeedLMTCache
    $DAFC = Get-SPDistributedCacheClientSetting -ContainerType DistributedActivityFeedLMTCache
    $DAFC.MaxConnectionsToServer = 1
    $DAFC.requestTimeout = "3000"
    $DAFC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedActivityFeedLMTCache $DAFC
    
    #DistributedBouncerCache
    $DBC = Get-SPDistributedCacheClientSetting -ContainerType DistributedBouncerCache
    $DBC.MaxConnectionsToServer = 1
    $DBC.requestTimeout = "3000"
    $DBC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedBouncerCache $DBC
    
    #DistributedDefaultCache
    $DDC = Get-SPDistributedCacheClientSetting -ContainerType DistributedDefaultCache
    $DDC.MaxConnectionsToServer = 1
    $DDC.requestTimeout = "3000"
    $DDC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedDefaultCache $DDC
    
    #DistributedSearchCache
    $DSC = Get-SPDistributedCacheClientSetting -ContainerType DistributedSearchCache
    $DSC.MaxConnectionsToServer = 1
    $DSC.requestTimeout = "3000"
    $DSC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedSearchCache $DSC
    
    #DistributedSecurityTrimmingCache
    $DTC = Get-SPDistributedCacheClientSetting -ContainerType DistributedSecurityTrimmingCache
    $DTC.MaxConnectionsToServer = 1
    $DTC.requestTimeout = "3000"
    $DTC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedSecurityTrimmingCache $DTC
    
    #DistributedServerToAppServerAccessTokenCache
    $DSTAC = Get-SPDistributedCacheClientSetting -ContainerType DistributedServerToAppServerAccessTokenCache
    $DSTAC.MaxConnectionsToServer = 1
    $DSTAC.requestTimeout = "3000"
    $DSTAC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedServerToAppServerAccessTokenCache $DSTAC
    
    #DistributedFileLockThrottlerCache
    $DFLTC = Get-SPDistributedCacheClientSetting -ContainerType DistributedFileLockThrottlerCache
    $DFLTC.MaxConnectionsToServer = 1
    $DFLTC.requestTimeout = "3000"
    $DFLTC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedFileLockThrottlerCache $DFLTC
    
    #DistributedSharedWithUserCache
    $DSWUC = Get-SPDistributedCacheClientSetting -ContainerType DistributedSharedWithUserCache
    $DSWUC.MaxConnectionsToServer = 1
    $DSWUC.requestTimeout = "3000"
    $DSWUC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedSharedWithUserCache $DSWUC
    
    #DistributedUnifiedGroupsCache
    $DUGC = Get-SPDistributedCacheClientSetting -ContainerType DistributedUnifiedGroupsCache
    $DUGC.MaxConnectionsToServer = 1
    $DUGC.requestTimeout = "3000"
    $DUGC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedUnifiedGroupsCache $DUGC 
    
    #DistributedResourceTallyCache
    $DRTC = Get-SPDistributedCacheClientSetting -ContainerType DistributedResourceTallyCache
    $DRTC.MaxConnectionsToServer = 1
    $DRTC.requestTimeout = "3000"
    $DRTC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedResourceTallyCache $DRTC
    
    #DistributedHealthScoreCache
    $DHSC = Get-SPDistributedCacheClientSetting -ContainerType DistributedHealthScoreCache
    $DHSC.MaxConnectionsToServer = 1
    $DHSC.requestTimeout = "3000"
    $DHSC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedHealthScoreCache $DHSC  
    

    Script di PowerShell per SharePoint Server 2013

    Add-PSSnapin Microsoft.Sharepoint.Powershell -ea 0
    
    #DistributedLogonTokenCache
    $DLTC = Get-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache
    $DLTC.MaxConnectionsToServer = 1
    $DLTC.requestTimeout = "3000"
    $DLTC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedLogonTokenCache $DLTC
    
    #DistributedViewStateCache
    $DVSC = Get-SPDistributedCacheClientSetting -ContainerType DistributedViewStateCache
    $DVSC.MaxConnectionsToServer = 1
    $DVSC.requestTimeout = "3000"
    $DVSC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedViewStateCache $DVSC
    
    #DistributedAccessCache
    $DAC = Get-SPDistributedCacheClientSetting -ContainerType DistributedAccessCache
    $DAC.MaxConnectionsToServer = 1
    $DAC.requestTimeout = "3000"
    $DAC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedAccessCache $DAC
    
    #DistributedActivityFeedCache
    $DAF = Get-SPDistributedCacheClientSetting -ContainerType DistributedActivityFeedCache
    $DAF.MaxConnectionsToServer = 1
    $DAF.requestTimeout = "3000"
    $DAF.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedActivityFeedCache $DAF
    
    #DistributedActivityFeedLMTCache
    $DAFC = Get-SPDistributedCacheClientSetting -ContainerType DistributedActivityFeedLMTCache
    $DAFC.MaxConnectionsToServer = 1
    $DAFC.requestTimeout = "3000"
    $DAFC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedActivityFeedLMTCache $DAFC
    
    #DistributedBouncerCache
    $DBC = Get-SPDistributedCacheClientSetting -ContainerType DistributedBouncerCache
    $DBC.MaxConnectionsToServer = 1
    $DBC.requestTimeout = "3000"
    $DBC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedBouncerCache $DBC
    
    #DistributedDefaultCache
    $DDC = Get-SPDistributedCacheClientSetting -ContainerType DistributedDefaultCache
    $DDC.MaxConnectionsToServer = 1
    $DDC.requestTimeout = "3000"
    $DDC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedDefaultCache $DDC
    
    #DistributedSearchCache
    $DSC = Get-SPDistributedCacheClientSetting -ContainerType DistributedSearchCache
    $DSC.MaxConnectionsToServer = 1
    $DSC.requestTimeout = "3000"
    $DSC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedSearchCache $DSC
    
    #DistributedSecurityTrimmingCache
    $DTC = Get-SPDistributedCacheClientSetting -ContainerType DistributedSecurityTrimmingCache
    $DTC.MaxConnectionsToServer = 1
    $DTC.requestTimeout = "3000"
    $DTC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedSecurityTrimmingCache $DTC
    
    #DistributedServerToAppServerAccessTokenCache
    $DSTAC = Get-SPDistributedCacheClientSetting -ContainerType DistributedServerToAppServerAccessTokenCache
    $DSTAC.MaxConnectionsToServer = 1
    $DSTAC.requestTimeout = "3000"
    $DSTAC.channelOpenTimeOut = "3000"
    Set-SPDistributedCacheClientSetting -ContainerType DistributedServerToAppServerAccessTokenCache $DSTAC
    
  3. Aprire SharePoint Management Shell.

  4. Passare alla directory in cui è stato salvato il file.

  5. Al prompt dei comandi di PowerShell digitare il comando seguente:

    ./MaxConnections.ps1
    

Per altre informazioni, vedere Impostazioni di configurazione dell'applicazione (Memorizzazione nella cache di Windows Server AppFabric). Per altre informazioni su script e .ps1 file di Windows PowerShell, vedere Esecuzione di script di Windows PowerShell.

Ripristinare un host della cache

Durante le attività di installazione, configurazione o gestione, è possibile che per il servizio cache distribuita si attivi uno stato di non funzionamento. L'indicazione di un servizio cache distribuita che non funziona correttamente risulterà nelle regole di analisi dell'integrità in Amministrazione centrale o durante l'uso di funzionalità di SharePoint Server che si basano sulla cache distribuita. Il newsfeed nel Sito personale di un utente ad esempio inizierà a segnalare errori. Gli amministratori inoltre potrebbero ricevere il messaggio di errore "cacheHostInfo è null " quando eseguono i cmdlet di SharePoint Management Shell per gestire il servizio cache distribuita.

Sono disponibili due passaggi per ripristinare un host della cache.

Nell'host della cache distribuita non funzionante, utilizzare la procedura seguente per ripristinare un host della cache distribuita.

  1. Nel prompt dei comandi di SharePoint Management Shell eseguire il cmdlet Remove-SPDistributedCacheServiceInstance.

  2. Nel prompt dei comandi di SharePoint Management Shell eseguire il cmdlet Add-SPDistributedCacheServiceInstance.

    Nota

    [!NOTA] Se il passaggio 1 non riesce, rimuovere manualmente il servizio Cache distribuita utilizzando la procedura seguente.

    • Nel prompt dei comandi SharePoint Management Shell, digitare la seguente sintassi.

      $instanceName ="SPDistributedCacheService Name=SPCache"
      
      $serviceInstance = Get-SPServiceInstance | ? {($_.service.tostring()) -eq $instanceName -and ($_.server.name) -eq $env:computername}
      
      If($serviceInstance -ne $null)
      {
      $serviceInstance.Delete()
      }
      
      
    • Dopo che il servizio Cache distribuita è stato eliminato manualmente, eseguire nuovamente il passaggio 2.

Vedere anche

Concetti

Pianificare i feed e il servizio cache distribuita in SharePoint Server