Azure Cache voor Redis beheren met Azure PowerShell

In dit artikel leest u hoe u uw Azure Cache voor Redis exemplaren kunt maken, bijwerken en schalen. In het artikel wordt ook beschreven hoe u toegangssleutels opnieuw genereert en hoe u informatie over uw caches kunt weergeven. Zie Azure Cache voor Redis cmdlets voor een volledige lijst met Azure Cache voor Redis PowerShell-cmdlets.

Notitie

Azure heeft twee verschillende implementatiemodellen die u kunt gebruiken om resources te maken en ermee te werken: Azure Resource Manager en klassiek. Dit artikel is van toepassing op het gebruik van het Resource Manager-implementatiemodel. We bevelen het Resource Manager-implementatiemodel voor de meeste nieuwe implementaties, in plaats van het klassieke implementatiemodel.

Zie Azure Resource Manager versus klassieke implementatie voor meer informatie over het klassieke implementatiemodel : Implementatiemodellen en de status van uw resources begrijpen.

Vereisten

Als u Azure PowerShell al hebt geïnstalleerd, moet u Azure PowerShell versie 1.0.0 of hoger hebben. U kunt de versie van Azure PowerShell controleren met deze opdracht via de Azure PowerShell-opdrachtprompt.

    Get-Module Az | format-table version

Eerst moet u zich met deze opdracht aanmelden bij Azure.

    Connect-AzAccount

Geef het e-mailadres van uw Azure-account en uw wachtwoord op in het aanmeldingsdialoogvenster van Microsoft Azure.

Als u meerdere Azure-abonnementen hebt, moet u vervolgens uw Azure-abonnement instellen. Voer deze opdracht uit om een lijst met uw huidige abonnementen weer te geven.

    Get-AzSubscription | sort SubscriptionName | Select SubscriptionName

Voer de volgende opdracht uit om het abonnement op te geven. In het volgende voorbeeld is ContosoSubscriptionde naam van het abonnement.

    Select-AzSubscription -SubscriptionName ContosoSubscription

Voordat u Windows PowerShell kunt gebruiken met Azure Resource Manager, moet u de configuratie controleren:

  • Windows PowerShell, versie 3.0 of 4.0. Als u de versie van Windows PowerShell wilt zoeken, typt u:$PSVersionTable en controleert u of de waarde PSVersion 3.0 of 4.0 is. Zie Windows Management Framework 3.0 als u een compatibele versie wilt installeren.

Gebruik de Cmdlet Get-Help om gedetailleerde hulp te krijgen voor alle cmdlets die u in deze zelfstudie ziet.

    Get-Help <cmdlet-name> -Detailed

Als u bijvoorbeeld hulp voor de New-AzRedisCache cmdlet wilt krijgen, typt u:

    Get-Help New-AzRedisCache -Detailed

Verbinding maken met andere clouds

Standaard is AzureCloudde Azure-omgeving, die het globale Azure-cloudexemplaren vertegenwoordigt. Als u verbinding wilt maken met een ander exemplaar, gebruikt u de opdracht met de Connect-AzAccount-Environment of-opdrachtregelswitchEnvironmentName met de gewenste omgevings- of omgevingsnaam.

Voer de Get-AzEnvironment cmdlet uit om de lijst met beschikbare omgevingen weer te geven.

Verbinding maken met de Azure Government Cloud

Gebruik een van de volgende opdrachten om verbinding te maken met de Azure Government Cloud.

    Connect-AzAccount -EnvironmentName AzureUSGovernment

Of

    Connect-AzAccount -Environment (Get-AzEnvironment -Name AzureUSGovernment)

Als u een cache wilt maken in de Azure Government Cloud, gebruikt u een van de volgende locaties.

  • USGov Virginia
  • USGov Iowa

Zie de ontwikkelaarshandleiding voor Microsoft Azure Government en Microsoft Azure Government voor meer informatie over de Azure Government-cloud.

Verbinding maken met Microsoft Azure beheerd door 21Vianet Cloud

Gebruik een van de volgende opdrachten om verbinding te maken met de Azure-cloud die wordt beheerd door 21Vianet.

    Connect-AzAccount -EnvironmentName AzureChinaCloud

Of

    Connect-AzAccount -Environment (Get-AzEnvironment -Name AzureChinaCloud)

Als u een cache wilt maken in Azure die wordt beheerd door 21Vianet Cloud, gebruikt u een van de volgende locaties.

  • China - oost
  • China - noord

Verbinding maken met Microsoft Azure Duitsland

Gebruik een van de volgende opdrachten om verbinding te maken met Microsoft Azure Duitsland.

    Connect-AzAccount -EnvironmentName AzureGermanCloud

Of

    Connect-AzAccount -Environment (Get-AzEnvironment -Name AzureGermanCloud)

Als u een cache wilt maken in Microsoft Azure Duitsland, gebruikt u een van de volgende locaties.

  • Duitsland - centraal
  • Duitsland - noordoost

Zie Microsoft Azure Duitsland voor meer informatie over Microsoft Azure Duitsland.

Eigenschappen die worden gebruikt voor Azure Cache voor Redis PowerShell

De volgende tabel bevat Azure PowerShell-eigenschappen en -beschrijvingen voor algemene parameters bij het maken en beheren van uw Azure Cache voor Redis-exemplaren.

Parameter Description Standaard
Naam Naam van de cache
Locatie Locatie van de cache
ResourceGroupName Naam van resourcegroep waarin de cache moet worden gemaakt
Tekengrootte De grootte van de cache. Geldige waarden zijn: P1, P2, P3, P4, P5, C0, C1, C2, C3, C4, C5, C6, 250 MB, 1 GB, 2,5 GB, 6 GB, 13 GB, 26 GB, 53 GB 1 GB
ShardCount Het aantal shards dat moet worden gemaakt bij het maken van een Premium-cache waarvoor clustering is ingeschakeld. Geldige waarden zijn: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
SKU Hiermee geeft u de SKU van de cache. Geldige waarden zijn: Basic, Standard, Premium Standaard
RedisConfiguration Hiermee geeft u Redis-configuratie-instellingen. Zie de volgende eigenschappentabel voor RedisConfiguration voor meer informatie over elke instelling.
EnableNonSslPort Geeft aan of de niet-SSL-poort is ingeschakeld. Onwaar
MaxMemoryPolicy Deze parameter is afgeschaft. Gebruik in plaats daarvan RedisConfiguration.
StaticIP Wanneer u uw cache host in een VNET, geeft u een uniek IP-adres op in het subnet voor de cache. Indien niet opgegeven, wordt er een voor u gekozen vanuit het subnet.
Subnet Wanneer u uw cache host in een VNET, geeft u de naam op van het subnet waarin de cache moet worden geïmplementeerd.
VirtualNetwork Wanneer u uw cache host in een VNET, geeft u de resource-id op van het VNET waarin de cache moet worden geïmplementeerd.
Keytype Hiermee geeft u op welke toegangssleutel opnieuw moet worden gegenereerd bij het vernieuwen van toegangssleutels. Geldige waarden zijn: Primair, Secundair

Eigenschappen van RedisConfiguration

Eigenschappen Beschrijving Prijscategorieën
rdb-backup ingeschakeld Of Redis-gegevenspersistentie is ingeschakeld Alleen Premium
rdb-storage-connection-string De verbindingsreeks naar het opslagaccount voor Redis-gegevenspersistentie Alleen Premium
rdb-backup-frequency De back-upfrequentie voor Redis-gegevenspersistentie Alleen Premium
maxmemory-reserved Hiermee configureert u het geheugen dat is gereserveerd voor niet-cacheprocessen Standard en Premium
maxmemory-policy Hiermee configureert u het verwijderingsbeleid voor de cache Alle prijscategorieën
notify-keyspace-events Keyspace-meldingen configureren Standard en Premium
hash-max-ziplist-vermeldingen Hiermee configureert u geheugenoptimalisatie voor kleine geaggregeerde gegevenstypen Standard en Premium
hash-max-ziplist-value Hiermee configureert u geheugenoptimalisatie voor kleine geaggregeerde gegevenstypen Standard en Premium
set-max-intset-entries Hiermee configureert u geheugenoptimalisatie voor kleine geaggregeerde gegevenstypen Standard en Premium
zset-max-ziplist-entries Hiermee configureert u geheugenoptimalisatie voor kleine geaggregeerde gegevenstypen Standard en Premium
zset-max-ziplist-value Hiermee configureert u geheugenoptimalisatie voor kleine geaggregeerde gegevenstypen Standard en Premium
databases Hiermee configureert u het aantal databases. Deze eigenschap kan alleen worden geconfigureerd bij het maken van de cache. Standard en Premium

Een Azure Cache voor Redis maken

Nieuwe Azure Cache voor Redis-exemplaren worden gemaakt met behulp van de cmdlet New-AzRedisCache.

Belangrijk

De eerste keer dat u een Azure Cache voor Redis maakt in een abonnement met behulp van Azure Portal, registreert de portal de Microsoft.Cache naamruimte voor dat abonnement. Als u probeert de eerste Azure Cache voor Redis te maken in een abonnement met behulp van PowerShell, moet u die naamruimte eerst registreren met behulp van de volgende opdracht; anders mislukken cmdlets zoals New-AzRedisCache en Get-AzRedisCache mislukken.

Register-AzResourceProvider -ProviderNamespace "Microsoft.Cache"

Voer de volgende opdracht uit om een lijst met beschikbare parameters en de bijbehorende beschrijvingen weer New-AzRedisCachete geven.

    PS C:\> Get-Help New-AzRedisCache -detailed

    NAME
        New-AzRedisCache

    SYNOPSIS
        Creates a new Azure Cache for Redis.


    SYNTAX
        New-AzRedisCache -Name <String> -ResourceGroupName <String> -Location <String> [-RedisVersion <String>]
        [-Size <String>] [-Sku <String>] [-MaxMemoryPolicy <String>] [-RedisConfiguration <Hashtable>] [-EnableNonSslPort
        <Boolean>] [-ShardCount <Integer>] [-VirtualNetwork <String>] [-Subnet <String>] [-StaticIP <String>]
        [<CommonParameters>]


    DESCRIPTION
        The New-AzRedisCache cmdlet creates a new Azure Cache for Redis.


    PARAMETERS
        -Name <String>
            Name of the Azure Cache for Redis to create.

        -ResourceGroupName <String>
            Name of resource group in which to create the Azure Cache for Redis.

        -Location <String>
            Location in which to create the Azure Cache for Redis.

        -RedisVersion <String>
            RedisVersion is deprecated and will be removed in future release.

        -Size <String>
            Size of the Azure Cache for Redis. The default value is 1GB or C1. Possible values are P1, P2, P3, P4, C0, C1, C2, C3,
            C4, C5, C6, 250MB, 1GB, 2.5GB, 6GB, 13GB, 26GB, 53GB.

        -Sku <String>
            Sku of Azure Cache for Redis. The default value is Standard. Possible values are Basic, Standard and Premium.

        -MaxMemoryPolicy <String>
            The 'MaxMemoryPolicy' setting has been deprecated. Please use 'RedisConfiguration' setting to set
            MaxMemoryPolicy. e.g. -RedisConfiguration @{"maxmemory-policy" = "allkeys-lru"}

        -RedisConfiguration <Hashtable>
            All Redis Configuration Settings. Few possible keys: rdb-backup-enabled, rdb-storage-connection-string,
            rdb-backup-frequency, maxmemory-reserved, maxmemory-policy, notify-keyspace-events, hash-max-ziplist-entries,
            hash-max-ziplist-value, set-max-intset-entries, zset-max-ziplist-entries, zset-max-ziplist-value, databases.

        -EnableNonSslPort <Boolean>
            EnableNonSslPort is used by Azure Cache for Redis. If no value is provided, the default value is false and the
            non-SSL port will be disabled. Possible values are true and false.

        -ShardCount <Integer>
            The number of shards to create on a Premium Cluster Cache.

        -VirtualNetwork <String>
            The exact ARM resource ID of the virtual network to deploy the Azure Cache for Redis in. Example format: /subscriptions/{
            subid}/resourceGroups/{resourceGroupName}/providers/Microsoft.ClassicNetwork/VirtualNetworks/{vnetName}

        -Subnet <String>
            Required when deploying an Azure Cache for Redis inside an existing Azure Virtual Network.

        -StaticIP <String>
            Required when deploying an Azure Cache for Redis inside an existing Azure Virtual Network.

        <CommonParameters>
            This cmdlet supports the common parameters: Verbose, Debug,
            ErrorAction, ErrorVariable, WarningAction, WarningVariable,
            OutBuffer, PipelineVariable, and OutVariable. For more information, see
            about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).

Voer de volgende opdracht uit om een cache met standaardparameters te maken.

    New-AzRedisCache -ResourceGroupName myGroup -Name mycache -Location "North Central US"

ResourceGroupName, Nameen Location zijn vereiste parameters, maar de resten zijn optioneel en hebben standaardwaarden. Als u de vorige opdracht uitvoert, maakt u een standard-SKU Azure Cache voor Redis exemplaar met de opgegeven naam, locatie en resourcegroep. Het exemplaar is 1 GB groot, waarbij de niet-SSL-poort is uitgeschakeld.

Als u een Premium-cache wilt maken, geeft u een grootte op van P1 (6 GB - 60 GB), P2 (13 GB - 130 GB), P3 (26 GB - 260 GB) of P4 (53 GB - 530 GB). Als u clustering wilt inschakelen, geeft u een aantal shards op met behulp van de ShardCount parameter. In het volgende voorbeeld wordt een P1 Premium-cache gemaakt met drie shards. Een P1 Premium-cache is 6 GB groot en omdat we drie shards hebben opgegeven, is de totale grootte 18 GB (3 x 6 GB).

    New-AzRedisCache -ResourceGroupName myGroup -Name mycache -Location "North Central US" -Sku Premium -Size P1 -ShardCount 3

Als u waarden voor de RedisConfiguration parameter wilt opgeven, plaatst u de waarden in {} als sleutel-/waardeparen, zoals @{"maxmemory-policy" = "allkeys-random", "notify-keyspace-events" = "KEA"}. In het volgende voorbeeld wordt een standaard cache van 1 GB gemaakt met allkeys-random maxmemory-beleid en keyspace-meldingen geconfigureerd met KEA. Zie Keyspace-meldingen (geavanceerde instellingen) en geheugenbeleid voor meer informatie.

    New-AzRedisCache -ResourceGroupName myGroup -Name mycache -Location "North Central US" -RedisConfiguration @{"maxmemory-policy" = "allkeys-random", "notify-keyspace-events" = "KEA"}

De instelling voor databases configureren tijdens het maken van de cache

De instelling kan alleen worden geconfigureerd tijdens het databases maken van de cache. In het volgende voorbeeld wordt een premium P3-cache (26 GB) gemaakt met 48 databases met behulp van de cmdlet New-AzRedisCache .

    New-AzRedisCache -ResourceGroupName myGroup -Name mycache -Location "North Central US" -Sku Premium -Size P3 -RedisConfiguration @{"databases" = "48"}

Zie De standaardconfiguratie van Azure Cache voor Redis server voor meer informatie over de databases eigenschap. Zie de vorige sectie Een Azure Cache voor Redis maken voor meer informatie over het maken van een cache met de cmdlet New-AzRedisCache.

Een Azure Cache voor Redis bijwerken

Azure Cache voor Redis exemplaren worden bijgewerkt met behulp van de Set-AzRedisCache-cmdlet.

Voer de volgende opdracht uit om een lijst met beschikbare parameters en de bijbehorende beschrijvingen weer Set-AzRedisCachete geven.

    PS C:\> Get-Help Set-AzRedisCache -detailed

    NAME
        Set-AzRedisCache

    SYNOPSIS
        Set Azure Cache for Redis updatable parameters.

    SYNTAX
        Set-AzRedisCache -Name <String> -ResourceGroupName <String> [-Size <String>] [-Sku <String>]
        [-MaxMemoryPolicy <String>] [-RedisConfiguration <Hashtable>] [-EnableNonSslPort <Boolean>] [-ShardCount
        <Integer>] [<CommonParameters>]

    DESCRIPTION
        The Set-AzRedisCache cmdlet sets Azure Cache for Redis parameters.

    PARAMETERS
        -Name <String>
            Name of the Azure Cache for Redis to update.

        -ResourceGroupName <String>
            Name of the resource group for the cache.

        -Size <String>
            Size of the Azure Cache for Redis. The default value is 1GB or C1. Possible values are P1, P2, P3, P4, C0, C1, C2, C3,
            C4, C5, C6, 250MB, 1GB, 2.5GB, 6GB, 13GB, 26GB, 53GB.

        -Sku <String>
            Sku of Azure Cache for Redis. The default value is Standard. Possible values are Basic, Standard and Premium.

        -MaxMemoryPolicy <String>
            The 'MaxMemoryPolicy' setting has been deprecated. Please use 'RedisConfiguration' setting to set
            MaxMemoryPolicy. e.g. -RedisConfiguration @{"maxmemory-policy" = "allkeys-lru"}

        -RedisConfiguration <Hashtable>
            All Redis Configuration Settings. Few possible keys: rdb-backup-enabled, rdb-storage-connection-string,
            rdb-backup-frequency, maxmemory-reserved, maxmemory-policy, notify-keyspace-events, hash-max-ziplist-entries,
            hash-max-ziplist-value, set-max-intset-entries, zset-max-ziplist-entries, zset-max-ziplist-value.

        -EnableNonSslPort <Boolean>
            EnableNonSslPort is used by Azure Cache for Redis. The default value is null and no change will be made to the
            currently configured value. Possible values are true and false.

        -ShardCount <Integer>
            The number of shards to create on a Premium Cluster Cache.

        <CommonParameters>
            This cmdlet supports the common parameters: Verbose, Debug,
            ErrorAction, ErrorVariable, WarningAction, WarningVariable,
            OutBuffer, PipelineVariable, and OutVariable. For more information, see
            about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).

De Set-AzRedisCache cmdlet kan worden gebruikt om eigenschappen zoals Size, Skuen EnableNonSslPortde RedisConfiguration waarden bij te werken.

Met de volgende opdracht wordt het maxmemory-beleid bijgewerkt voor de Azure Cache voor Redis met de naam myCache.

    Set-AzRedisCache -ResourceGroupName "myGroup" -Name "myCache" -RedisConfiguration @{"maxmemory-policy" = "allkeys-random"}

Een Azure Cache voor Redis schalen

Set-AzRedisCachekan worden gebruikt om een Azure Cache voor Redis exemplaar te schalen wanneer de Size, Skuof ShardCount eigenschappen worden gewijzigd.

Notitie

Het schalen van een cache met Behulp van PowerShell is onderhevig aan dezelfde limieten en richtlijnen als het schalen van een cache vanuit Azure Portal. U kunt schalen naar een andere prijscategorie met de volgende beperkingen.

  • U kunt niet schalen van een hogere prijscategorie naar een lagere prijscategorie.
  • U kunt niet schalen van een Premium-cache naar een Standard - of Basic-cache .
  • U kunt niet schalen vanuit een Standard-cache naar een Basic-cache .
  • U kunt schalen van een Basic-cache naar een Standard-cache , maar u kunt de grootte niet tegelijkertijd wijzigen. Als u een andere grootte nodig hebt, kunt u een volgende schaalbewerking uitvoeren naar de gewenste grootte.
  • U kunt niet rechtstreeks schalen van een Basic-cache naar een Premium-cache . U moet schalen van Basic naar Standard in één schaalbewerking en vervolgens van Standard naar Premium in een volgende schaalbewerking.
  • U kunt niet schalen van een grotere grootte naar de grootte C0 (250 MB).

Zie Azure Cache voor Redis schalen voor meer informatie.

In het volgende voorbeeld ziet u hoe u een cache met de naam myCache kunt schalen naar een cache van 2,5 GB. Deze opdracht werkt voor zowel een Basic- als een Standard-cache.

    Set-AzRedisCache -ResourceGroupName myGroup -Name myCache -Size 2.5GB

Nadat deze opdracht is uitgegeven, wordt de status van de cache geretourneerd---similar om aan te roepen Get-AzRedisCache. De ProvisioningState is ingesteld op Scaling.

    PS C:\> Set-AzRedisCache -Name myCache -ResourceGroupName myGroup -Size 2.5GB


    Name               : mycache
    Id                 : /subscriptions/12ad12bd-abdc-2231-a2ed-a2b8b246bbad4/resourceGroups/mygroup/providers/Mi
                         crosoft.Cache/Redis/mycache
    Location           : South Central US
    Type               : Microsoft.Cache/Redis
    HostName           : mycache.redis.cache.windows.net
    Port               : 6379
    ProvisioningState  : Scaling
    SslPort            : 6380
    RedisConfiguration : {[maxmemory-policy, volatile-lru], [maxmemory-reserved, 150], [notify-keyspace-events, KEA],
                         [maxmemory-delta, 150]...}
    EnableNonSslPort   : False
    RedisVersion       : 3.0
    Size               : 1GB
    Sku                : Standard
    ResourceGroupName  : mygroup
    PrimaryKey         : ....
    SecondaryKey       : ....
    VirtualNetwork     :
    Subnet             :
    StaticIP           :
    TenantSettings     : {}
    ShardCount         :

Wanneer de schaalbewerking is voltooid, worden de ProvisioningState wijzigingen gewijzigd in Succeeded. Als u een andere schaalbewerking wilt maken--- bijvoorbeeld van Basic naar Standard wijzigen en vervolgens de grootte wijzigen--- moet u wachten totdat de vorige bewerking is voltooid of krijgt u een foutmelding die er ongeveer als volgt uitziet.

    Set-AzRedisCache : Conflict: The resource '...' is not in a stable state, and is currently unable to accept the update request.

Informatie over een Azure Cache voor Redis

U kunt informatie over een cache ophalen met behulp van de cmdlet Get-AzRedisCache .

Voer de volgende opdracht uit om een lijst met beschikbare parameters en de bijbehorende beschrijvingen weer Get-AzRedisCachete geven.

    PS C:\> Get-Help Get-AzRedisCache -detailed

    NAME
        Get-AzRedisCache

    SYNOPSIS
        Gets details about a single cache or all caches in the specified resource group or all caches in the current
        subscription.

    SYNTAX
        Get-AzRedisCache [-Name <String>] [-ResourceGroupName <String>] [<CommonParameters>]

    DESCRIPTION
        The Get-AzRedisCache cmdlet gets the details about a cache or caches depending on input parameters. If both
        ResourceGroupName and Name parameters are provided then Get-AzRedisCache will return details about the
        specific cache name provided.

        If only ResourceGroupName is provided than it will return details about all caches in the specified resource group.

        If no parameters are given than it will return details about all caches the current subscription.

    PARAMETERS
        -Name <String>
            The name of the cache. When this parameter is provided along with ResourceGroupName, Get-AzRedisCache
            returns the details for the cache.

        -ResourceGroupName <String>
            The name of the resource group that contains the cache or caches. If ResourceGroupName is provided with Name
            then Get-AzRedisCache returns the details of the cache specified by Name. If only the ResourceGroup
            parameter is provided, then details for all caches in the resource group are returned.

        <CommonParameters>
            This cmdlet supports the common parameters: Verbose, Debug,
            ErrorAction, ErrorVariable, WarningAction, WarningVariable,
            OutBuffer, PipelineVariable, and OutVariable. For more information, see
            about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).

Als u informatie wilt retourneren over alle caches in het huidige abonnement, voert u deze uit Get-AzRedisCache zonder parameters.

    Get-AzRedisCache

Als u informatie wilt retourneren over alle caches in een specifieke resourcegroep, voert u deze uit Get-AzRedisCache met de ResourceGroupName parameter.

    Get-AzRedisCache -ResourceGroupName myGroup

Als u informatie over een specifieke cache wilt retourneren, voert u deze uit Get-AzRedisCache met de Name parameter die de naam van de cache bevat en de ResourceGroupName parameter met de resourcegroep die die cache bevat.

    PS C:\> Get-AzRedisCache -Name myCache -ResourceGroupName myGroup

    Name               : mycache
    Id                 : /subscriptions/12ad12bd-abdc-2231-a2ed-a2b8b246bbad4/resourceGroups/myGroup/providers/Mi
                         crosoft.Cache/Redis/mycache
    Location           : South Central US
    Type               : Microsoft.Cache/Redis
    HostName           : mycache.redis.cache.windows.net
    Port               : 6379
    ProvisioningState  : Succeeded
    SslPort            : 6380
    RedisConfiguration : {[maxmemory-policy, volatile-lru], [maxmemory-reserved, 62], [notify-keyspace-events, KEA],
                         [maxclients, 1000]...}
    EnableNonSslPort   : False
    RedisVersion       : 3.0
    Size               : 1GB
    Sku                : Standard
    ResourceGroupName  : myGroup
    VirtualNetwork     :
    Subnet             :
    StaticIP           :
    TenantSettings     : {}
    ShardCount         :

De toegangssleutels voor een Azure Cache voor Redis ophalen

Als u de toegangssleutels voor uw cache wilt ophalen, kunt u de cmdlet Get-AzRedisCacheKey gebruiken.

Voer de volgende opdracht uit om een lijst met beschikbare parameters en de bijbehorende beschrijvingen weer Get-AzRedisCacheKeyte geven.

    PS C:\> Get-Help Get-AzRedisCacheKey -detailed

    NAME
        Get-AzRedisCacheKey

    SYNOPSIS
        Gets the accesskeys for the specified Azure Cache for Redis.


    SYNTAX
        Get-AzRedisCacheKey -Name <String> -ResourceGroupName <String> [<CommonParameters>]

    DESCRIPTION
        The Get-AzRedisCacheKey cmdlet gets the access keys for the specified cache.

    PARAMETERS
        -Name <String>
            Name of the Azure Cache for Redis.

        -ResourceGroupName <String>
            Name of the resource group for the cache.

        <CommonParameters>
            This cmdlet supports the common parameters: Verbose, Debug,
            ErrorAction, ErrorVariable, WarningAction, WarningVariable,
            OutBuffer, PipelineVariable, and OutVariable. For more information, see
            about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).

Als u de sleutels voor uw cache wilt ophalen, roept u de Get-AzRedisCacheKey cmdlet aan en geeft u de naam van de cache door aan de naam van de resourcegroep die de cache bevat.

    PS C:\> Get-AzRedisCacheKey -Name myCache -ResourceGroupName myGroup

    PrimaryKey   : b2wdt43sfetlju4hfbryfnregrd9wgIcc6IA3zAO1lY=
    SecondaryKey : ABhfB757JgjIgt785JgKH9865eifmekfnn649303JKL=

Toegangssleutels voor uw Azure Cache voor Redis opnieuw genereren

Als u de toegangssleutels voor uw cache opnieuw wilt genereren, kunt u de cmdlet New-AzRedisCacheKey gebruiken.

Voer de volgende opdracht uit om een lijst met beschikbare parameters en de bijbehorende beschrijvingen weer New-AzRedisCacheKeyte geven.

    PS C:\> Get-Help New-AzRedisCacheKey -detailed

    NAME
        New-AzRedisCacheKey

    SYNOPSIS
        Regenerates the access key of an Azure Cache for Redis.

    SYNTAX
        New-AzRedisCacheKey -Name <String> -ResourceGroupName <String> -KeyType <String> [-Force] [<CommonParameters>]

    DESCRIPTION
        The New-AzRedisCacheKey cmdlet regenerate the access key of an Azure Cache for Redis.

    PARAMETERS
        -Name <String>
            Name of the Azure Cache for Redis.

        -ResourceGroupName <String>
            Name of the resource group for the cache.

        -KeyType <String>
            Specifies whether to regenerate the primary or secondary access key. Possible values are Primary or Secondary.

        -Force
            When the Force parameter is provided, the specified access key is regenerated without any confirmation prompts.

        <CommonParameters>
            This cmdlet supports the common parameters: Verbose, Debug,
            ErrorAction, ErrorVariable, WarningAction, WarningVariable,
            OutBuffer, PipelineVariable, and OutVariable. For more information, see
            about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).

Als u de primaire of secundaire sleutel voor uw cache opnieuw wilt genereren, roept u de New-AzRedisCacheKey cmdlet aan en geeft u de naam, resourcegroep door en geeft u Primary de KeyType parameter opSecondary. In het volgende voorbeeld wordt de secundaire toegangssleutel voor een cache opnieuw gegenereerd.

    PS C:\> New-AzRedisCacheKey -Name myCache -ResourceGroupName myGroup -KeyType Secondary

    Confirm
    Are you sure you want to regenerate Secondary key for Azure Cache for Redis 'myCache'?
    [Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y


    PrimaryKey   : b2wdt43sfetlju4hfbryfnregrd9wgIcc6IA3zAO1lY=
    SecondaryKey : c53hj3kh4jhHjPJk8l0jji785JgKH9865eifmekfnn6=

Een Azure Cache voor Redis verwijderen

Als u een Azure Cache voor Redis wilt verwijderen, gebruikt u de cmdlet Remove-AzRedisCache.

Voer de volgende opdracht uit om een lijst met beschikbare parameters en de bijbehorende beschrijvingen weer Remove-AzRedisCachete geven.

    PS C:\> Get-Help Remove-AzRedisCache -detailed

    NAME
        Remove-AzRedisCache

    SYNOPSIS
        Remove Azure Cache for Redis if exists.

    SYNTAX
        Remove-AzRedisCache -Name <String> -ResourceGroupName <String> [-Force] [-PassThru] [<CommonParameters>

    DESCRIPTION
        The Remove-AzRedisCache cmdlet removes an Azure Cache for Redis if it exists.

    PARAMETERS
        -Name <String>
            Name of the Azure Cache for Redis to remove.

        -ResourceGroupName <String>
            Name of the resource group of the cache to remove.

        -Force
            When the Force parameter is provided, the cache is removed without any confirmation prompts.

        -PassThru
            By default Remove-AzRedisCache removes the cache and does not return any value. If the PassThru par
            is provided then Remove-AzRedisCache returns a boolean value indicating the success of the operatio

        <CommonParameters>
            This cmdlet supports the common parameters: Verbose, Debug,
            ErrorAction, ErrorVariable, WarningAction, WarningVariable,
            OutBuffer, PipelineVariable, and OutVariable. For more information, see
            about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).

In het volgende voorbeeld wordt de benoemde myCache cache verwijderd.

    PS C:\> Remove-AzRedisCache -Name myCache -ResourceGroupName myGroup

    Confirm
    Are you sure you want to remove Azure Cache for Redis 'myCache'?
    [Y] Yes  [N] No  [S] Suspend  [?] Help (default is "Y"): Y

Een Azure Cache voor Redis importeren

U kunt gegevens importeren in een Azure Cache voor Redis exemplaar met behulp van de Import-AzRedisCache cmdlet.

Belangrijk

Importeren/exporteren is alleen beschikbaar voor Caches in de Premium-laag . Zie Gegevens importeren en exporteren in Azure Cache voor Redis voor meer informatie over Importeren/exporteren.

Voer de volgende opdracht uit om een lijst met beschikbare parameters en de bijbehorende beschrijvingen weer Import-AzRedisCachete geven.

    PS C:\> Get-Help Import-AzRedisCache -detailed

    NAME
        Import-AzRedisCache

    SYNOPSIS
        Import data from blobs to Azure Cache for Redis.


    SYNTAX
        Import-AzRedisCache -Name <String> -ResourceGroupName <String> -Files <String[]> [-Format <String>] [-Force]
        [-PassThru] [<CommonParameters>]


    DESCRIPTION
        The Import-AzRedisCache cmdlet imports data from the specified blobs into Azure Cache for Redis.


    PARAMETERS
        -Name <String>
            The name of the cache.

        -ResourceGroupName <String>
            The name of the resource group that contains the cache.

        -Files <String[]>
            SAS urls of blobs whose content should be imported into the cache.

        -Format <String>
            Format for the blob.  Currently "rdb" is the only supported, with other formats expected in the future.

        -Force
            When the Force parameter is provided, import will be performed without any confirmation prompts.

        -PassThru
            By default Import-AzRedisCache imports data in cache and does not return any value. If the PassThru
            parameter is provided then Import-AzRedisCache returns a boolean value indicating the success of the
            operation.

        <CommonParameters>
            This cmdlet supports the common parameters: Verbose, Debug,
            ErrorAction, ErrorVariable, WarningAction, WarningVariable,
            OutBuffer, PipelineVariable, and OutVariable. For more information, see
            about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).

Met de volgende opdracht importeert u gegevens uit de blob die is opgegeven door de SAS-URI in Azure Cache voor Redis.

    PS C:\>Import-AzRedisCache -ResourceGroupName "resourceGroupName" -Name "cacheName" -Files @("https://mystorageaccount.blob.core.windows.net/mycontainername/blobname?sv=2015-04-05&sr=b&sig=caIwutG2uDa0NZ8mjdNJdgOY8%2F8mhwRuGNdICU%2B0pI4%3D&st=2016-05-27T00%3A00%3A00Z&se=2016-05-28T00%3A00%3A00Z&sp=rwd") -Force

Een Azure Cache voor Redis exporteren

U kunt gegevens exporteren uit een Azure Cache voor Redis exemplaar met behulp van de Export-AzRedisCache cmdlet.

Belangrijk

Importeren/exporteren is alleen beschikbaar voor Caches in de Premium-laag . Zie Gegevens importeren en exporteren in Azure Cache voor Redis voor meer informatie over Importeren/exporteren.

Voer de volgende opdracht uit om een lijst met beschikbare parameters en de bijbehorende beschrijvingen weer Export-AzRedisCachete geven.

    PS C:\> Get-Help Export-AzRedisCache -detailed

    NAME
        Export-AzRedisCache

    SYNOPSIS
        Exports data from Azure Cache for Redis to a specified container.


    SYNTAX
        Export-AzRedisCache -Name <String> -ResourceGroupName <String> -Prefix <String> -Container <String> [-Format
        <String>] [-PassThru] [<CommonParameters>]


    DESCRIPTION
        The Export-AzRedisCache cmdlet exports data from Azure Cache for Redis to a specified container.


    PARAMETERS
        -Name <String>
            The name of the cache.

        -ResourceGroupName <String>
            The name of the resource group that contains the cache.

        -Prefix <String>
            Prefix to use for blob names.

        -Container <String>
            SAS url of container where data should be exported.

        -Format <String>
            Format for the blob.  Currently "rdb" is the only supported, with other formats expected in the future.

        -PassThru
            By default Export-AzRedisCache does not return any value. If the PassThru parameter is provided
            then Export-AzRedisCache returns a boolean value indicating the success of the operation.

        <CommonParameters>
            This cmdlet supports the common parameters: Verbose, Debug,
            ErrorAction, ErrorVariable, WarningAction, WarningVariable,
            OutBuffer, PipelineVariable, and OutVariable. For more information, see
            about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).

Met de volgende opdracht worden gegevens uit een Azure Cache voor Redis exemplaar geëxporteerd naar de container die is opgegeven door de SAS-URI.

    PS C:\>Export-AzRedisCache -ResourceGroupName "resourceGroupName" -Name "cacheName" -Prefix "blobprefix"
    -Container "https://mystorageaccount.blob.core.windows.net/mycontainer?sv=2015-04-05&sr=c&sig=HezZtBZ3DURmEGDduauE7
    pvETY4kqlPI8JCNa8ATmaw%3D&st=2016-05-27T00%3A00%3A00Z&se=2016-05-28T00%3A00%3A00Z&sp=rwdl"

Een Azure Cache voor Redis opnieuw opstarten

U kunt uw Azure Cache voor Redis-exemplaar opnieuw opstarten met behulp van de Reset-AzRedisCache cmdlet.

Belangrijk

Opnieuw opstarten is alleen beschikbaar voor caches in de Basic-, Standard- en Premium-laag . Zie Cachebeheer - opnieuw opstarten voor meer informatie over het opnieuw opstarten van uw cache.

Voer de volgende opdracht uit om een lijst met beschikbare parameters en de bijbehorende beschrijvingen weer Reset-AzRedisCachete geven.

    PS C:\> Get-Help Reset-AzRedisCache -detailed

    NAME
        Reset-AzRedisCache

    SYNOPSIS
        Reboot specified node(s) of an Azure Cache for Redis instance.


    SYNTAX
        Reset-AzRedisCache -Name <String> -ResourceGroupName <String> -RebootType <String> [-ShardId <Integer>]
        [-Force] [-PassThru] [<CommonParameters>]


    DESCRIPTION
        The Reset-AzRedisCache cmdlet reboots the specified node(s) of an Azure Cache for Redis instance.


    PARAMETERS
        -Name <String>
            The name of the cache.

        -ResourceGroupName <String>
            The name of the resource group that contains the cache.

        -RebootType <String>
            Which node to reboot. Possible values are "PrimaryNode", "SecondaryNode", "AllNodes".

        -ShardId <Integer>
            Which shard to reboot when rebooting a premium cache with clustering enabled.

        -Force
            When the Force parameter is provided, reset will be performed without any confirmation prompts.

        -PassThru
            By default Reset-AzRedisCache does not return any value. If the PassThru parameter is provided
            then Reset-AzRedisCache returns a boolean value indicating the success of the operation.

        <CommonParameters>
            This cmdlet supports the common parameters: Verbose, Debug,
            ErrorAction, ErrorVariable, WarningAction, WarningVariable,
            OutBuffer, PipelineVariable, and OutVariable. For more information, see
            about_CommonParameters (https://go.microsoft.com/fwlink/?LinkID=113216).

Met de volgende opdracht worden beide knooppunten van de opgegeven cache opnieuw opgestart.

    PS C:\>Reset-AzRedisCache -ResourceGroupName "resourceGroupName" -Name "cacheName" -RebootType "AllNodes"
    -Force

Volgende stappen

Zie de volgende bronnen voor meer informatie over het gebruik van Windows PowerShell met Azure: