Az Azure Cache for Redis kezelése az Azure PowerShell-lel

Ez a cikk bemutatja, hogyan hozhat létre, frissíthet és skálázhat Azure Cache for Redis-példányokat. A cikk azt is bemutatja, hogyan hozhat létre újra hozzáférési kulcsokat, és hogyan tekintheti meg a gyorsítótárak adatait. Az Azure Cache for Redis PowerShell-parancsmagok teljes listájáért tekintse meg az Azure Cache for Redis parancsmagjait.

Feljegyzés

Az Azure két különböző üzemi modellel rendelkezik, amelyek segítségével erőforrásokat hozhat létre és használhat: az Azure Resource Managert és a klasszikust. Ez a cikk a Resource Manager-alapú üzemi modell használatát ismerteti. Javasoljuk, hogy a Resource Manager-alapú üzemi modellt a klasszikus üzemi modell helyett az új üzemelő példányokhoz használja.

A klasszikus üzemi modellről további információt az Azure Resource Manager és a klasszikus üzembe helyezés című témakörben talál : Az üzembehelyezési modellek és az erőforrások állapota.

Előfeltételek

Ha már telepítette az Azure PowerShellt, az Azure PowerShell 1.0.0-s vagy újabb verziójával kell rendelkeznie. Ezzel a paranccsal ellenőrizheti az Azure PowerShell verzióját az Azure PowerShell parancssorában.

    Get-Module Az | format-table version

Először is ezzel a paranccsal kell bejelentkeznie az Azure-ba.

    Connect-AzAccount

Adja meg az Azure-fiók e-mail-címét és jelszavát a Microsoft Azure bejelentkezési párbeszédpanelen.

Ezután, ha több Azure-előfizetéssel rendelkezik, be kell állítania az Azure-előfizetését. Az aktuális előfizetések listájának megtekintéséhez futtassa ezt a parancsot.

    Get-AzSubscription | sort SubscriptionName | Select SubscriptionName

Az előfizetés megadásához futtassa a következő parancsot. Az alábbi példában az előfizetés neve .ContosoSubscription

    Select-AzSubscription -SubscriptionName ContosoSubscription

Mielőtt használhatja a Windows PowerShellt az Azure Resource Managerrel, ellenőriznie kell a beállítását:

  • Windows PowerShell, 3.0-s vagy 4.0-s verzió. A Windows PowerShell verziójának megkereséséhez írja be a következőt,$PSVersionTable és ellenőrizze, hogy a 3.0-s vagy a 4.0-s érték PSVersion van-e megadva. Kompatibilis verzió telepítéséhez lásd: Windows Management Framework 3.0.

Ha részletes segítséget szeretne kapni az oktatóanyagban látható parancsmagokhoz, használja a Get-Help parancsmagot.

    Get-Help <cmdlet-name> -Detailed

Ha például segítségre van szüksége a parancsmaghoz, írja be a New-AzRedisCache következőt:

    Get-Help New-AzRedisCache -Detailed

Csatlakozás más felhőkhöz

Alapértelmezés szerint az Azure-környezet az AzureCloud, amely a globális Azure-felhőpéldányt jelöli. Ha másik példányhoz szeretne csatlakozni, használja a Connect-AzAccount parancsot a -Environment vagy –EnvironmentName parancssori kapcsolóval a kívánt környezettel vagy környezetnévvel.

Az elérhető környezetek listájának megtekintéséhez futtassa a Get-AzEnvironment parancsmagot.

Csatlakozás az Azure Government Cloudhoz

Az Azure Government Cloudhoz való csatlakozáshoz használja az alábbi parancsok egyikét.

    Connect-AzAccount -EnvironmentName AzureUSGovernment

Vagy

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

Ha gyorsítótárat szeretne létrehozni az Azure Government Cloudban, használja az alábbi helyek egyikét.

  • USGov Virginia
  • USGov Iowa

Az Azure Government Cloudról további információt a Microsoft Azure Government és a Microsoft Azure Government fejlesztői útmutatójában talál.

Csatlakozás a 21Vianet Cloud által üzemeltetett Microsoft Azure-hoz

A 21Vianet-felhő által üzemeltetett Azure-hoz való csatlakozáshoz használja az alábbi parancsok egyikét.

    Connect-AzAccount -EnvironmentName AzureChinaCloud

Vagy

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

Ha gyorsítótárat szeretne létrehozni a 21Vianet Cloud által üzemeltetett Azure-ban, használja az alábbi helyek egyikét.

  • Kelet-Kína
  • Észak-Kína

Csatlakozás a Microsoft Azure Germanyhez

A Microsoft Azure Germanyhez való csatlakozáshoz használja az alábbi parancsok egyikét.

    Connect-AzAccount -EnvironmentName AzureGermanCloud

Vagy

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

Ha gyorsítótárat szeretne létrehozni a Microsoft Azure Germany-ban, használja az alábbi helyek egyikét.

  • Közép-Németország
  • Északkelet-Németország

További információ a Microsoft Azure Germany szolgáltatásról: Microsoft Azure Germany.

Az Azure Cache for Redis PowerShellhez használt tulajdonságok

Az alábbi táblázat az Azure Cache for Redis-példányok létrehozásakor és kezelésekor gyakran használt paraméterek Azure PowerShell-tulajdonságait és leírását tartalmazza.

Paraméter Leírás Alapértelmezett
Név A gyorsítótár neve
Hely A gyorsítótár helye
ResourceGroupName Erőforráscsoport neve, amelyben létre kívánja hozni a gyorsítótárat
Méret A gyorsítótár mérete. Érvényes értékek: P1, P2, P3, P4, P5, C0, C1, C2, C3, C4, C5, C6, 250MB, 1GB, 2,5GB, 6GB, 13GB, 26GB, 53GB 1 GB
ShardCount A prémium szintű gyorsítótárak létrehozásakor létrehozandó szegmensek száma, amelyeken engedélyezve van a fürtözés. Érvényes értékek: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
Termékváltozat Megadja a gyorsítótár termékváltozatát. Érvényes értékek: Alapszintű, Standard, Prémium Standard
RedisConfiguration Megadja a Redis konfigurációs beállításait. Az egyes beállításokat a következő RedisConfiguration tulajdonságtáblában találja.
EnableNonSslPort Azt jelzi, hogy engedélyezve van-e a nem SSL-port. Hamis
MaxMemoryPolicy Ez a paraméter elavult – használja helyette a RedisConfiguration parancsot.
StaticIP Ha a gyorsítótárat virtuális hálózaton üzemelteti, a gyorsítótár alhálózatában egy egyedi IP-címet ad meg. Ha nincs megadva, a rendszer kiválaszt egyet az alhálózatból.
Alhálózat Ha a gyorsítótárat egy virtuális hálózaton üzemelteti, megadja annak az alhálózatnak a nevét, amelyben üzembe kívánja helyezni a gyorsítótárat.
VirtualNetwork Ha a gyorsítótárat egy virtuális hálózaton üzemelteti, megadja annak a virtuális hálózatnak az erőforrás-azonosítóját, amelyben a gyorsítótár üzembe helyezhető.
KeyType Megadja, hogy a hozzáférési kulcsok megújításakor melyik hozzáférési kulcs legyen újragenerálva. Az érvényes értékek a következők: Elsődleges, Másodlagos

RedisConfiguration tulajdonságai

Tulajdonság Leírás Tarifacsomagok
rdb-backup-enabled Engedélyezve van-e a Redis-adatmegőrzés Csak prémium szintű
rdb-storage-connection-string A Redis-adatmegőrzés tárfiókjának kapcsolati sztring Csak prémium szintű
rdb-backup-frequency A Redis-adatmegőrzés biztonsági mentési gyakorisága Csak prémium szintű
maxmemory-reserved Konfigurálja a nem gyorsítótárazott folyamatok számára fenntartott memóriát Standard és Prémium
maxmemory-policy Konfigurálja a gyorsítótár kiürítési szabályzatát Minden tarifacsomag
notify-keyspace-events Kulcstérértesítések konfigurálása Standard és Prémium
hash-max-ziplist-entries Memóriaoptimalizálás konfigurálása kis összesített adattípusokhoz Standard és Prémium
hash-max-ziplist-value Memóriaoptimalizálás konfigurálása kis összesített adattípusokhoz Standard és Prémium
set-max-intset-entries Memóriaoptimalizálás konfigurálása kis összesített adattípusokhoz Standard és Prémium
zset-max-ziplist-entries Memóriaoptimalizálás konfigurálása kis összesített adattípusokhoz Standard és Prémium
zset-max-ziplist-value Memóriaoptimalizálás konfigurálása kis összesített adattípusokhoz Standard és Prémium
adatbázisokban Az adatbázisok számát konfigurálja. Ez a tulajdonság csak a gyorsítótár létrehozásakor konfigurálható. Standard és Prémium

Azure Cache for Redis létrehozása

Az új Azure Cache for Redis-példányok a New-AzRedisCache parancsmaggal jönnek létre.

Fontos

Amikor először hoz létre Azure Cache for Redist egy előfizetésben az Azure Portal használatával, a portál regisztrálja az Microsoft.Cache előfizetés névterét. Ha powershell-lel próbálja létrehozni az első Azure Cache for Redist egy előfizetésben, először regisztrálnia kell ezt a névteret a következő paranccsal; egyéb parancsmagok, például New-AzRedisCache és Get-AzRedisCache sikertelenek.

Register-AzResourceProvider -ProviderNamespace "Microsoft.Cache"

Az elérhető paraméterek és azok leírásának megtekintéséhez New-AzRedisCachefuttassa az alábbi parancsot.

    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).

Ha alapértelmezett paraméterekkel rendelkező gyorsítótárat szeretne létrehozni, futtassa a következő parancsot.

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

ResourceGroupName, Nameés Location kötelező paraméterek, de a többi nem kötelező, és alapértelmezett értékekkel rendelkezik. Az előző parancs futtatása létrehoz egy Standard SKU Azure Cache for Redis-példányt a megadott névvel, helytel és erőforráscsoporttal. A példány mérete 1 GB, és a nem SSL-port le van tiltva.

Prémium szintű gyorsítótár létrehozásához adja meg a P1 (6 GB – 60 GB), a P2 (13 GB – 130 GB), a P3 (26 GB – 260 GB) vagy a P4 (53 GB – 530 GB) méretét. A fürtözés engedélyezéséhez adjon meg egy szegmensszámot a ShardCount paraméterrel. Az alábbi példa egy P1 prémium szintű gyorsítótárat hoz létre három szegmensből. A P1 prémium szintű gyorsítótár mérete 6 GB, és mivel három szegmenst határoztunk meg, a teljes méret 18 GB (3 x 6 GB).

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

A paraméter értékeinek megadásához RedisConfiguration az értékeket {} kulcs/érték párokként, például @{"maxmemory-policy" = "allkeys-random", "notify-keyspace-events" = "KEA"}kulcs/érték párokként kell tartalmaznia. Az alábbi példa egy szabványos 1 GB-os gyorsítótárat hoz létre a maxmemory szabályzattal allkeys-random és a keyspace értesítésekkel KEAkonfigurálva. További információ: Keyspace-értesítések (speciális beállítások) és memóriaszabályzatok.

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

Az adatbázisok beállításának konfigurálása a gyorsítótár létrehozása során

A databases beállítás csak a gyorsítótár létrehozása során konfigurálható. Az alábbi példa egy 26 GB-os prémium szintű P3-gyorsítótárat hoz létre 48 adatbázissal a New-AzRedisCache parancsmaggal.

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

A tulajdonságról további információt az databases Alapértelmezett Azure Cache for Redis-kiszolgálókonfiguráció című témakörben talál. A New-AzRedisCache parancsmaggal történő gyorsítótár-létrehozásról az előző Azure Cache for Redis-szakasz nyújt további információt.

Azure Cache for Redis frissítése

Az Azure Cache for Redis-példányok a Set-AzRedisCache parancsmaggal frissülnek.

Az elérhető paraméterek és azok leírásának megtekintéséhez Set-AzRedisCachefuttassa az alábbi parancsot.

    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).

A Set-AzRedisCache parancsmag olyan tulajdonságok frissítésére használható, mint Sizea , Sku, EnableNonSslPortés az RedisConfiguration értékek.

Az alábbi parancs frissíti a myCache nevű Azure Cache for Redis maxmemory-szabályzatát.

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

Azure Cache for Redis skálázása

Set-AzRedisCache Az Azure Cache for Redis-példány skálázására használható a Size, Skuvagy ShardCount tulajdonságok módosításakor.

Feljegyzés

A gyorsítótár PowerShell-lel történő skálázására ugyanazok a korlátozások és irányelvek vonatkoznak, mint a gyorsítótár Azure Portalról történő skálázására. Az alábbi korlátozásokkal skálázhat másik tarifacsomagra.

  • Nem skálázható magasabb tarifacsomagról alacsonyabb tarifacsomagra.
  • Prémium szintű gyorsítótárból nem skálázható le standard vagy alapszintű gyorsítótárra.
  • Standard gyorsítótárból nem skálázható le alapszintű gyorsítótárra.
  • Az alapszintű gyorsítótárról a Standard gyorsítótárra skálázhat, de a méretet egyszerre nem módosíthatja. Ha más méretre van szüksége, egy későbbi skálázási műveletet is elvégezhet a kívánt méretre.
  • Alapszintű gyorsítótárból nem skálázhat közvetlenül prémium szintű gyorsítótárba. Egy skálázási műveletben az Alapszintűről a Standardra, majd a Standardról a Premiumra kell skáláznia egy későbbi skálázási műveletben.
  • Nagyobb méretről a C0 (250 MB) méretre nem skálázható.

További információ: Az Azure Cache for Redis méretezése.

Az alábbi példa bemutatja, hogyan méretezhet 2,5 GB-os gyorsítótárra egy gyorsítótárat myCache . Ez a parancs alapszintű vagy standard gyorsítótárban is működik.

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

A parancs kiadása után a rendszer visszaadja a gyorsítótár állapotát---a híváshoz Get-AzRedisCachehasonló módon. A ProvisioningState beállítás értéke .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         :

Ha a skálázási művelet befejeződött, a módosítások a ProvisioningState következőre módosulnak Succeeded: . Ha egy másik skálázási műveletet kell végrehajtania--- például alapszintűről standardra kell váltania, majd módosítania kell a méretet--- meg kell várnia, amíg az előző művelet befejeződik, vagy az alábbihoz hasonló hibaüzenet jelenik meg.

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

Az Azure Cache for Redis adatainak lekérése

A Get-AzRedisCache parancsmaggal információkat kérhet le a gyorsítótárról.

Az elérhető paraméterek és azok leírásának megtekintéséhez Get-AzRedisCachefuttassa az alábbi parancsot.

    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).

Ha az aktuális előfizetés összes gyorsítótárával kapcsolatos információt szeretne visszaadni, futtassa Get-AzRedisCache paraméterek nélkül.

    Get-AzRedisCache

Ha egy adott erőforráscsoport összes gyorsítótárára vonatkozó információt szeretne visszaadni, futtassa Get-AzRedisCache a ResourceGroupName paraméterrel.

    Get-AzRedisCache -ResourceGroupName myGroup

Ha egy adott gyorsítótárra vonatkozó információkat szeretne visszaadni, futtassa Get-AzRedisCache a Name gyorsítótár nevét tartalmazó paraméterrel és a ResourceGroupName gyorsítótárat tartalmazó erőforráscsoporttal rendelkező paraméterrel.

    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         :

Az Azure Cache for Redis hozzáférési kulcsainak lekérése

A gyorsítótár hozzáférési kulcsainak lekéréséhez használhatja a Get-AzRedisCacheKey parancsmagot.

Az elérhető paraméterek és azok leírásának megtekintéséhez Get-AzRedisCacheKeyfuttassa az alábbi parancsot.

    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).

A gyorsítótár kulcsainak lekéréséhez hívja meg a Get-AzRedisCacheKey parancsmagot, és adja meg a gyorsítótár nevének a gyorsítótárat tartalmazó erőforráscsoport nevét.

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

    PrimaryKey   : b2wdt43sfetlju4hfbryfnregrd9wgIcc6IA3zAO1lY=
    SecondaryKey : ABhfB757JgjIgt785JgKH9865eifmekfnn649303JKL=

Az Azure Cache for Redis hozzáférési kulcsainak újragenerálása

A gyorsítótár hozzáférési kulcsainak újragenerálásához használja a New-AzRedisCacheKey parancsmagot.

Az elérhető paraméterek és azok leírásának megtekintéséhez New-AzRedisCacheKeyfuttassa az alábbi parancsot.

    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).

A gyorsítótár elsődleges vagy másodlagos kulcsának újragenerálásához hívja meg a New-AzRedisCacheKey parancsmagot, és adja meg a nevet, az erőforráscsoportot, és adja meg vagy PrimarySecondary adja meg a KeyType paramétert. Az alábbi példában a gyorsítótár másodlagos hozzáférési kulcsát újrageneráljuk.

    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=

Azure Cache for Redis törlése

Az Azure Cache for Redis törléséhez használja a Remove-AzRedisCache parancsmagot.

Az elérhető paraméterek és azok leírásának megtekintéséhez Remove-AzRedisCachefuttassa az alábbi parancsot.

    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).

Az alábbi példában a gyorsítótár neve myCache el lesz távolítva.

    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

Azure Cache for Redis importálása

A parancsmaggal Import-AzRedisCache adatokat importálhat egy Azure Cache for Redis-példányba.

Fontos

Az importálás/exportálás csak prémium szintű gyorsítótárakhoz érhető el. További információ az importálásról/exportálásról: Adatok importálása és exportálása az Azure Cache for Redisben.

Az elérhető paraméterek és azok leírásának megtekintéséhez Import-AzRedisCachefuttassa az alábbi parancsot.

    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).

Az alábbi parancs adatokat importál az SAS uri által megadott blobból az Azure Cache for Redisbe.

    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

Azure Cache for Redis exportálása

A parancsmaggal Export-AzRedisCache adatokat exportálhat egy Azure Cache for Redis-példányból.

Fontos

Az importálás/exportálás csak prémium szintű gyorsítótárakhoz érhető el. További információ az importálásról/exportálásról: Adatok importálása és exportálása az Azure Cache for Redisben.

Az elérhető paraméterek és azok leírásának megtekintéséhez Export-AzRedisCachefuttassa az alábbi parancsot.

    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).

Az alábbi parancs adatokat exportál egy Azure Cache for Redis-példányból az SAS uri által megadott tárolóba.

    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"

Azure Cache for Redis újraindítása

A parancsmaggal újraindíthatja az Reset-AzRedisCache Azure Cache for Redis-példányt.

Fontos

Az újraindítás csak alapszintű, standard és prémium szintű gyorsítótárakhoz érhető el. A gyorsítótár újraindításáról további információt a Gyorsítótár felügyelete – újraindítás című témakörben talál.

Az elérhető paraméterek és azok leírásának megtekintéséhez Reset-AzRedisCachefuttassa az alábbi parancsot.

    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).

Az alábbi parancs újraindítja a megadott gyorsítótár mindkét csomópontját.

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

Következő lépések

A Windows PowerShell azure-ral való használatáról az alábbi forrásokban olvashat bővebben: