إدارة ذاكرة التخزين المؤقت Azure لـRedis باستخدام Azure PowerShell

هذه المقالة توضح لك كيفية إنشاء وتحديث وتوسيع نطاق ذاكرة التخزين المؤقت Azure لمثيلات Redis. كما توضح المقالة كيفية إعادة إنشاء مفاتيح الوصول، وكيفية عرض معلومات حول ذاكرة التخزين المؤقت. للحصول على قائمة كاملة لـ Azure Cache لـ Redis PowerShell cmdlets، راجع Azure Cache لـ Redis cmdlets.

إشعار

يحتوي Azure على نموذجين مختلفين للتوزيع يمكنك استخدامهما لإنشاء الموارد والعمل معها وهما: نموذج Azure Resource Manager والنموذج الكلاسيكي. تتناول هذه المقالة استخدام نموذج توزيع Azure Resource Manager. نوصي باستخدام نموذج توزيع Resource Manager لعمليات التوزيع الجديدة بدلاً من نموذج التوزيع الكلاسيكي.

لمزيد من المعلومات حول نموذج التوزيع الكلاسيكي، راجع Azure Resource Manager مقابل التوزيع الكلاسيكي: فهم نماذج التوزيع وحالة مواردك.

المتطلبات الأساسية

إذا قمت بالفعل بتثبيت Azure PowerShell، فيجب أن يكون لديك الإصدار 1.0.0 من Azure PowerShell أو أحدث. يمكنك التحقق من إصدار Azure PowerShell باستخدام هذا الأمر في موجه أوامر Azure PowerShell.

    Get-Module Az | format-table version

أولاً، يجب تسجيل الدخول إلى Azure باستخدام هذا الأمر.

    Connect-AzAccount

حدد عنوان البريد الإلكتروني لحساب Azure وكلمة المرور الخاصة بك في مربع حوار تسجيل الدخول إلى Microsoft Azure.

بعد ذلك، إذا كان لديك اشتراكات Azure متعددة، فستحتاج إلى تعيين اشتراك Azure الخاص بك. للاطلاع على قائمة باشتراكاتك الحالية، شغل هذا الأمر.

    Get-AzSubscription | sort SubscriptionName | Select SubscriptionName

لتحديد الاشتراك، شغل الأمر التالي. في المثال التالي، اسم الاشتراك هو ContosoSubscription.

    Select-AzSubscription -SubscriptionName ContosoSubscription

قبل أن تتمكن من استخدام Windows PowerShell مع Azure Resource Manager، تحتاج إلى التحقق من إعدادك:

  • Windows PowerShell، الإصدار 3.0 أو 4.0. للعثور على إصدار Windows PowerShell، اكتب:$PSVersionTable وتحقق من أن قيمة PSVersion هي 3.0 أو 4.0. لتثبيت إصدار متوافق، راجع Windows Management Framework 3.0.

للحصول على تعليمات مفصلة لأي cmdlet تراه في هذا البرنامج التعليمي، استخدم Get-Help cmdlet.

    Get-Help <cmdlet-name> -Detailed

على سبيل المثال، للحصول على تعليمات لـ New-AzRedisCache cmdlet، اكتب:

    Get-Help New-AzRedisCache -Detailed

كيفية الاتصال بالسحب الأخرى

بشكل افتراضي، تكون بيئة Azure AzureCloud، والتي تمثل مثيل سحابة Azure العمومي. للاتصال بمثيل مختلف، استخدم الأمر Connect-AzAccount مع مفتاح سطر الأوامر -Environment أو -EnvironmentName مع اسم البيئة أو البيئة الذي تريده.

لمشاهدة قائمة بالبيئات المتوفرة، شغل الأمر cmdlet Get-AzEnvironment.

للاتصال بـ Azure Government Cloud

للاتصال بـ Azure Government Cloud، استخدم أحد الأوامر التالية.

    Connect-AzAccount -EnvironmentName AzureUSGovernment

أو

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

لإنشاء ذاكرة تخزين مؤقت في Azure Government Cloud، استخدم أحد المواقع التالية.

  • USGov Virginia
  • الحكومة الفيدرالية للولايات المتحدة - ولاية آيوا

لمزيد من المعلومات حول Azure Government Cloud، راجع Microsoft Azure Government وMicrosoft Azure Government Developer Guide.

للاتصال ب Microsoft Azure المشغل بواسطة 21Vianet Cloud

للاتصال ب Azure المشغل بواسطة سحابة 21Vianet، استخدم أحد الأوامر التالية.

    Connect-AzAccount -EnvironmentName AzureChinaCloud

أو

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

لإنشاء ذاكرة تخزين مؤقت في Azure المشغلة بواسطة 21Vianet Cloud، استخدم أحد المواقع التالية.

  • منطقة شرق الصين
  • منطقة شمال الصين

للاتصال بـ Microsoft Azure Germany

للاتصال بـ Microsoft Azure Germany، استخدم أحد الأوامر التالية.

    Connect-AzAccount -EnvironmentName AzureGermanCloud

أو

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

لإنشاء ذاكرة تخزين مؤقت في Microsoft Azure Germany، استخدم أحد المواقع التالية.

  • منطقة وسط ألمانيا
  • منطقة شمال شرق ألمانيا

لمزيد من المعلومات حول Microsoft Azure Germany، راجع Microsoft Azure Germany.

الخصائص المستخدمة لـ Azure Cache لـ Redis PowerShell

الجدول التالي يحتوي على خصائص Azure PowerShell ووصف للمعلمات الشائعة عند إنشاء Azure Cache لمثيلات Redis وإدارتها.

المعلمة ‏‏الوصف‬ الإعداد الافتراضي
الاسم اسم ذاكرة التخزين المؤقت
الموقع موقع ذاكرة التخزين المؤقت
ResourceGroupName اسم مجموعة الموارد لإنشاء ذاكرة التخزين المؤقت
الحجم حجم ذاكرة التخزين المؤقت. القيم الصالحة هي: P1 وP2 وP3 وP4 وP5 وC0 وC1 وC2 وC3 وC4 وC5 وC6 و250 ميغابايت و1 غيغابايت و2.5 غيغابايت و6 غيغابايت و13 غيغابايت و26 غيغابايت و53 غيغابايت 1 غيغابايت
ShardCount عدد الأجزاء التي يجب إنشاؤها عند إنشاء ذاكرة تخزين مؤقت متميزة مع تمكين التجميع. القيم الصالحة هي: 1 و2 و3 و4 و5 و6 و7 و8 و9 و10
وحدة حفظ المخزون SKU يحدد SKU لذاكرة التخزين المؤقت. القيم الصالحة هي: أساسي، وقياسي، ومتميز قياسي
RedisConfiguration تحديد إعدادات تكوين Redis. للحصول على تفاصيل حول كل إعداد، راجع جدول خصائص RedisConfiguration التالي.
EnableNonSslPort يشير إلى ما إذا كان المنفذ غير SSL ممكنًا. خطأ
MaxMemoryPolicy تم إهمال هذه المعلمة - استخدم RedisConfiguration بدلاً من ذلك.
StaticIP عند استضافة ذاكرة التخزين المؤقت في VNET، يحدد عنوان IP فريدًا في الشبكة الفرعية لذاكرة التخزين المؤقت. إذا لم يتم توفيرها، يتم اختيار واحدًا لك من الشبكة الفرعية.
الشبكة الفرعية عند استضافة ذاكرة التخزين المؤقت في VNET، يحدد اسم الشبكة الفرعية التي سيتم فيها توزيع ذاكرة التخزين المؤقت.
VirtualNetwork عند استضافة ذاكرة التخزين المؤقت في VNET، يحدد معرف المورد للشبكة الظاهرية التي سيتم فيها توزيع ذاكرة التخزين المؤقت.
KeyType يحدد مفتاح الوصول المراد إعادة إنشائه عند تجديد مفاتيح الوصول. القيم الصالحة: أساسي، ثانوي

خَصائص RedisConfiguration

الخاصية ‏‏الوصف مستويات الأسعار
rdb-backup-enabled ما إذا كان يتم تمكين استمرار بيانات Redis Premium فقط
rdb-storage-connection-string سلسلة الاتصال بحساب التخزين لـ استمرار بيانات Redis Premium فقط
rdb-backup-frequency تكرار النسخ الاحتياطي لـ استمرار بيانات Redis Premium فقط
maxmemory-reserved يقوم بتكوين الذاكرة المحجوزة للعمليات غير المخزنة مؤقتًا Standard and Premium
maxmemory-policy يقوم بتكوين نهج الإخلاء لذاكرة التخزين المؤقت جميع مستويات التسعير
notify-keyspace-events يقوم بتكوين إعلامات مساحة المفاتيح Standard and Premium
hash-max-ziplist-entries يقوم بتكوين تحسين الذاكرة لنوع البيانات المجمعة الصغيرة Standard and Premium
hash-max-ziplist-value يقوم بتكوين تحسين الذاكرة لنوع البيانات المجمعة الصغيرة Standard and Premium
set-max-intset-entries يقوم بتكوين تحسين الذاكرة لنوع البيانات المجمعة الصغيرة Standard and Premium
zset-max-ziplist-entries يقوم بتكوين تحسين الذاكرة لنوع البيانات المجمعة الصغيرة Standard and Premium
zset-max-ziplist-value يقوم بتكوين تحسين الذاكرة لنوع البيانات المجمعة الصغيرة Standard and Premium
قواعد البيانات يقوم بتكوين عدد قواعد البيانات. هذه الخاصية لا يمكن تكوينها إلا عند إنشاء ذاكرة تخزين مؤقت. Standard and Premium

لإنشاء Azure Cache لـ Redis

يتم إنشاء Azure Cache جديدة لمثيلات Redis باستخدام New-AzRedisCache cmdlet.

هام

في المرة الأولى التي تقوم فيها بإنشاء Azure Cache لـ Redis في اشتراك باستخدام مدخل Microsoft Azure، المدخل يسجل مساحة الاسم Microsoft.Cache لهذا الاشتراك. إذا حاولت إنشاء Azure Cache لـ Redis الأولى في اشتراك باستخدام PowerShell، يجب أولا تسجيل مساحة الاسم هذه باستخدام الأمر التالي؛ وإلا cmdlets مثل New-AzRedisCache وفشل Get-AzRedisCache.

Register-AzResourceProvider -ProviderNamespace "Microsoft.Cache"

لمشاهدة قائمة بالمعلمات المتوفرة ووصفها لـ New-AzRedisCache، شغل الأمر التالي.

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

لإنشاء ذاكرة تخزين مؤقت بمعلمات افتراضية، شغل الأمر التالي.

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

ResourceGroupName وName وLocation معلمات مطلوبة، ولكن الباقي اختياري وله قيم افتراضية. تشغيل الأمر السابق يؤدي إلى إنشاء مثيل SKU Azure Cache القياسي لـ Redis بالاسم والموقع ومجموعة الموارد المحددة. تم تعطيل المثيل بحجم 1 غيغابايت مع المنفذ غير SSL.

لإنشاء ذاكرة تخزين مؤقت متميزة، حدد حجم P1 (6 غيغابايت - 60 غيغابايت)، أو P2 (13 غيغابايت - 130 غيغابايت)، أو P3 (26 غيغابايت - 260 غيغابايت)، أو P4 (53 غيغابايت - 530 غيغابايت). لتمكين التجميع، حدد عدد الأجزاء باستخدام المعلمة ShardCount. المثال التالي ينشئ ذاكرة تخزين مؤقت متميزة P1 بثلاثة أجزاء. يبلغ حجم ذاكرة التخزين المؤقت المتميزة P1 6 غيغابايت، وبما أننا حددنا ثلاثة أجزاء، فإن الحجم الإجمالي هو 18 غيغابايت (3 × 6 غيغابايت).

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

لتحديد قيم المعلمة RedisConfiguration، قم بإحاطة القيم الموجودة بداخلها {} كأزواج مفاتيح/قيم مثل @{"maxmemory-policy" = "allkeys-random", "notify-keyspace-events" = "KEA"}. المثال التالي ينشئ ذاكرة تخزين مؤقت قياسية 1 غيغابايت مع allkeys-random نهج maxmemory وإعلامات مساحة المفاتيح المكونة باستخدام KEA. لمزيد من المعلومات، راجع إشعارات Keyspace (الإعدادات المتقدمة) ونهج الذاكرة.

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

لتكوين إعداد قواعد البيانات أثناء إنشاء ذاكرة التخزين المؤقت

لا يمكن تكوين الإعداد databases إلا أثناء إنشاء ذاكرة التخزين المؤقت. المثال التالي ينشئ ذاكرة تخزين مؤقت متميزة P3 (26 غيغابايت) مع 48 قاعدة بيانات باستخدام New-AzRedisCache cmdlet.

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

للحصول على مزيدٍ من المعلومات عن الخاصية databases، شاهد تكوين خادم Azure Cache لـ Redis. لمزيد من المعلومات حول إنشاء ذاكرة تخزين مؤقت باستخدام New-AzRedisCache cmdlet، راجع القسم السابق لإنشاء Azure Cache لـ Redis.

لتحديث Azure Cache لـ Redis

يتم تحديث Azure Cache لمثيلات Redis باستخدام Set-AzRedisCache cmdlet.

لمشاهدة قائمة بالمعلمات المتوفرة ووصفها لـ Set-AzRedisCache، شغل الأمر التالي.

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

Set-AzRedisCacheيمكن استخدام cmdlet لتحديث خصائص مثل القيم Size وSku وEnableNonSslPort وRedisConfiguration.

يحدث الأمر التالي maxmemory-policy لذاكرة التخزين المؤقت Azure لـ Redis المسماة myCache.

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

لتحجيم ذاكرة التخزين المؤقت Azure لـ Redis

يمكن استخدام Set-AzRedisCache لتوسيع نطاق Azure Cache لمثيل Redis عند تعديل الخصائص Sizeأو Sku أو ShardCount.

إشعار

تحجيم ذاكرة التخزين المؤقت باستخدام PowerShell يخضع لنفس الحدود والإرشادات مثل تحجيم ذاكرة التخزين المؤقت من مدخل Microsoft Azure. يمكنك التوسع إلى مستوى تسعير مختلف مع القيود التالية.

  • لا يمكنك توسيع مستوى تسعير أعلى إلى مستوى تسعير أقل.
  • لا يمكنك التحجيم من ذاكرة التخزين المؤقت Premium إلى ذاكرة التخزين المؤقت القياسية أو الأساسية .
  • لا يمكنك التحجيم من ذاكرة التخزين المؤقت القياسية إلى ذاكرة التخزين المؤقت الأساسية .
  • يمكنك التحجيم من ذاكرة التخزين المؤقت الأساسية إلى ذاكرة التخزين المؤقت القياسية ولكن لا يمكنك تغيير الحجم في نفس الوقت. إذا كنت بحاجة إلى حجم مختلف، فإنه يمكنك القيام بعملية تغيير حجم لاحقة للحجم المطلوب.
  • لا يمكنك التحجيم من ذاكرة التخزين المؤقت الأساسية مباشرة إلى ذاكرة التخزين المؤقت Premium . لابد من التوسع من أساسي إلى قياسي في عملية تغيير حجم واحدة، ومن ثم من قياسي إلى متميز في عملية تغيير حجم لاحقة.
  • لا يمكنك التحجيم من حجم أكبر إلى حجم C0 (250 ميغابايت).

لمزيد من المعلومات، راجع كيفية تغيير حجم Azure Cache لـ Redis.

يوضح المثال التالي كيفية تغييرِ حجم ذاكرة التخزين المؤقت المسماة myCache إلى ذاكرة تخزين مؤقت 2.5 غيغابايت. هذا الأمر يعمل لكل من ذاكرة التخزين المؤقت الأساسية أو القياسية.

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

بعد إصدار هذا الأمر، يتم إرجاع حالة ذاكرة التخزين المؤقت---مشابه لاستدعاء Get-AzRedisCache. تم تعيين ProvisioningState إلى 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         :

عند اكتمال عملية التحجيم، تتغير ProvisioningState إلى Succeeded. إذا كنت بحاجة إلى إجراء عملية تحجيم أخرى--- على سبيل المثال، تغيير من أساسي إلى قياسي ثم تغيير الحجم--- يجب الانتظار حتى تكتمل العملية السابقة أو تتلقى خطأ مشابها للخطأ التالي.

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

للحصول على معلومات حول Azure Cache لـ Redis

يمكنك استرداد معلومات حول ذاكرة التخزين المؤقت باستخدام Get-AzRedisCache cmdlet.

لمشاهدة قائمة بالمعلمات المتوفرة ووصفها لـ Get-AzRedisCache، شغل الأمر التالي.

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

لإرجاع معلومات حول جميع ذاكرة التخزين المؤقت في الاشتراك الحالي، شغل Get-AzRedisCache دون أي معلمات.

    Get-AzRedisCache

لإرجاع معلومات حول جميع ذاكرة التخزين المؤقت في مجموعة موارد معينة، شغل Get-AzRedisCache باستخدام المعلمة ResourceGroupName.

    Get-AzRedisCache -ResourceGroupName myGroup

لإرجاع معلومات حول ذاكرة تخزين مؤقت معينة، شغل Get-AzRedisCache مع المعلمة Name التي تحتوي على اسم ذاكرة التخزين المؤقت، والمعلمة ResourceGroupName مع مجموعة الموارد التي تحتوي على ذاكرة التخزين المؤقت هذه.

    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         :

لاسترداد مفاتيح الوصول لذاكرة التخزين المؤقت Azure لـ Redis

لاسترداد مفاتيح الوصول لذاكرة التخزين المؤقت الخاصة بك، يمكنك استخدام Get-AzRedisCacheKey cmdlet.

لمشاهدة قائمة بالمعلمات المتوفرة ووصفها لـ Get-AzRedisCacheKey، شغل الأمر التالي.

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

لاسترداد مفاتيح ذاكرة التخزين المؤقت الخاصة بك، استدعِ Get-AzRedisCacheKey cmdlet ومرر اسم ذاكرة التخزين المؤقت الخاصة بك اسم مجموعة الموارد التي تحتوي على ذاكرة التخزين المؤقت.

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

    PrimaryKey   : b2wdt43sfetlju4hfbryfnregrd9wgIcc6IA3zAO1lY=
    SecondaryKey : ABhfB757JgjIgt785JgKH9865eifmekfnn649303JKL=

لإعادة إنشاء مفاتيح الوصول لذاكرة التخزين المؤقت Azure لـ Redis

لإعادة إنشاء مفاتيح الوصول لذاكرة التخزين المؤقت الخاصة بك، يمكنك استخدام New-AzRedisCacheKey cmdlet.

لمشاهدة قائمة بالمعلمات المتوفرة ووصفها لـ New-AzRedisCacheKey، شغل الأمر التالي.

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

لإعادة إنشاء المفتاح الأساسي أو الثانوي لذاكرة التخزين المؤقت، استدع New-AzRedisCacheKey cmdlet ومرر الاسم ومجموعة الموارد وحدد إما للمعلمة Primary أو Secondary أوKeyType. في المثال التالي، يتم إعادة إنشاء مفتاح الوصول الثانوي لذاكرة التخزين المؤقت.

    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 لـ Redis

لحذف ذاكرة التخزين المؤقت Azure لـ Redis، استخدم الأمر Cmdlet Remove-AzRedisCache.

لمشاهدة قائمة بالمعلمات المتوفرة ووصفها لـ Remove-AzRedisCache، شغل الأمر التالي.

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

في المثال التالي، تتم إزالة ذاكرة التخزين المؤقت المسماة myCache.

    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 لـ Redis

يمكنك استيراد البيانات إلى Azure Cache لمثيل Redis باستخدام Import-AzRedisCache cmdlet.

هام

الاستيراد/ التصدير متاح فقط لذاكرات التخزين المؤقت لـ المستوى المتميز. لمزيد من المعلومات حول الاستيراد/ التصدير، راجع استيراد البيانات وتصديرها في Azure Cache for Redis.

لمشاهدة قائمة بالمعلمات المتوفرة ووصفها لـ Import-AzRedisCache، شغل الأمر التالي.

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

يقوم الأمر التالي باستيراد البيانات من الكائن الثنائي كبير الحجم المحدد بواسطة SAS uri إلى ذاكرة التخزين المؤقت Azure لـ 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

لتصدير Azure Cache لـ Redis

يمكنك تصدير البيانات من Azure Cache لمثيل Redis باستخدام Export-AzRedisCache cmdlet.

هام

الاستيراد/ التصدير متاح فقط لذاكرات التخزين المؤقت لـ المستوى المتميز. لمزيد من المعلومات حول الاستيراد/ التصدير، راجع استيراد البيانات وتصديرها في Azure Cache for Redis.

لمشاهدة قائمة بالمعلمات المتوفرة ووصفها لـ Export-AzRedisCache، شغل الأمر التالي.

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

يقوم الأمر التالي بتصدير البيانات من Azure Cache لمثيل Redis إلى الحاوية المحددة بواسطة 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"

لإعادة تشغيل Azure Cache لـ Redis

يمكنك إعادة تشغيل Azure Cache لمثيل Redis باستخدام Reset-AzRedisCache cmdlet.

هام

لا تتوفر إعادة التشغيل إلا لذاكرة التخزين المؤقت الأساسية والقياسية والمتميزة. لمزيد من المعلومات حول إعادة تشغيل ذاكرة التخزين المؤقت، راجع إدارة ذاكرة التخزين المؤقت - إعادة التشغيل.

لمشاهدة قائمة بالمعلمات المتوفرة ووصفها لـ Reset-AzRedisCache، شغل الأمر التالي.

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

الأمر التالي يعيد تشغيل كلتا العقدتين من ذاكرة التخزين المؤقت المحددة.

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

الخطوات التالية

لمعرفة المزيد حول استخدام Windows PowerShell مع Azure، راجع الموارد التالية: