إدارة Azure Cache for Redis with Azure PowerShell

ملاحظة

تستخدم هذه المقالة الوحدة النمطية Azure Az PowerShell، وهي الوحدة النمطية PowerShell الموصى بها للتفاعل مع Azure. لبدء استخدام الوحدة النمطية Az PowerShell، راجع تثبيت Azure PowerShell. لمعرفة كيفية الترحيل إلى الوحدة النمطية Az PowerShell، راجع ترحيل Azure PowerShell من AzureRM إلى Az.

توضح لك هذه المقالة كيفية إنشاء ذاكرة التخزين المؤقت ل Azure لمثيلات Redis وتحديثها وتوسيع نطاقها. توضح المقالة أيضا كيفية إعادة إنشاء مفاتيح الوصول، وكيفية عرض معلومات حول ذاكرة التخزين المؤقت. للحصول على قائمة كاملة بذاكرة التخزين المؤقت Azure ل Redis PowerShell cmdets، راجع Azure Cache for 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 3.0.

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

    Get-Help <cmdlet-name> -Detailed

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

    Get-Help New-AzRedisCache -Detailed

كيفية الاتصال بالغيوم الأخرى

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

للاطلاع على قائمة البيئات المتوفرة، قم بتشغيل Get-AzEnvironment cmdlet.

كيفية الاتصال بسحابة Azure Government

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

    Connect-AzAccount -EnvironmentName AzureUSGovernment

أو

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

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

  • ولاية فيرجينيا الأمريكية
  • الحكومة الفيدرالية للولايات المتحدة - ولاية آيوا

لمزيد من المعلومات حول سحابة Azure Government، راجع Microsoft Azure Governmentودليل مطوري Azure Government Microsoft.

كيفية الاتصال بسحابة Azure 21Vianet China Cloud

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

    Connect-AzAccount -EnvironmentName AzureChinaCloud

أو

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

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

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

لمزيد من المعلومات حول Azure China Cloud، راجع AzureChinaCloud ل Azure التي تديرها 21Vianet في الصين.

للاتصال ب Microsoft Azure ألمانيا

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

    Connect-AzAccount -EnvironmentName AzureGermanCloud

أو

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

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

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

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

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

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

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

خصائص RedisConfiguration

الخاصية الوصف مستويات الأسعار
RDB-النسخ الاحتياطي تمكين ما إذا كان استمرار بيانات Redis ممكنا Premium فقط
rdb-storage-connection-string سلسلة الاتصال بحساب التخزين لاستمرار بيانات Redis Premium فقط
RDB-النسخ الاحتياطي التردد تردد النسخ الاحتياطي لاستمرار بيانات Redis Premium فقط
الحد الأقصى للذاكرة المحجوزة تكوين الذاكرة المحجوزة للعمليات غير المخزنة مؤقتا Standard and Premium
سياسة الذاكرة القصوى تكوين سياسة الإخلاء لذاكرة التخزين المؤقت جميع مستويات التسعير
إعلام-keyspace-events تكوين إعلامات مساحة المفتاح Standard and Premium
التجزئة-ماكس-ziplist-إدخالات تكوين تحسين الذاكرة لأنواع البيانات المجمعة الصغيرة Standard and Premium
hash-max-ziplist-value تكوين تحسين الذاكرة لأنواع البيانات المجمعة الصغيرة Standard and Premium
set-max-intset-ent-enttries تكوين تحسين الذاكرة لأنواع البيانات المجمعة الصغيرة Standard and Premium
zset-max-ziplist-enttries تكوين تحسين الذاكرة لأنواع البيانات المجمعة الصغيرة Standard and Premium
zset-max-ziplist-value تكوين تحسين الذاكرة لأنواع البيانات المجمعة الصغيرة Standard and Premium
قواعد البيانات تكوين عدد قواعد البيانات. يمكن تكوين هذه الخاصية فقط عند إنشاء ذاكرة التخزين المؤقت. Standard and Premium

لإنشاء ذاكرة تخزين مؤقت Azure ل Redis

يتم إنشاء ذاكرة التخزين المؤقت Azure الجديدة لمثيلات Redis باستخدام cmdlet New-AzRedisCache .

هام

في المرة الأولى التي تقوم فيها بإنشاء ذاكرة تخزين مؤقت ل Azure ل Redis في اشتراك باستخدام مدخل Azure، تقوم البوابة الإلكترونية بتسجيل Microsoft.Cache مساحة الاسم لهذا الاشتراك. إذا حاولت إنشاء أول ذاكرة تخزين مؤقت Azure ل 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، وهي Location معلمات مطلوبة، Nameولكن الباقي اختياري وله قيم افتراضية. يؤدي تشغيل الأمر السابق إلى إنشاء ذاكرة تخزين مؤقت قياسية ل SKU Azure لمثيل 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 نهج الحد الأقصى للذاكرة وإعلامات مساحة المفاتيح التي تم تكوينها باستخدام KEA. لمزيد من المعلومات، راجع إعلامات مساحة المفتاح (الإعدادات المتقدمة)وسياسات الذاكرة.

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

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

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

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

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

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

يتم تحديث ذاكرة التخزين المؤقت Azure لمثيلات Redis باستخدام cmdlet Set-AzRedisCache .

للاطلاع على قائمة بالمعلمات المتوفرة وأوصافها ل 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، ، ، SkuEnableNonSslPortوالقيمRedisConfiguration.

يقوم الأمر التالي بتحديث نهج maxmemory لذاكرة التخزين المؤقت Azure ل Redis المسمى myCache.

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

لتوسيع نطاق ذاكرة التخزين المؤقت Azure ل Redis

Set-AzRedisCacheيمكن استخدامها لقياس ذاكرة التخزين المؤقت Azure لمثيل Redis عند SizeSkuتعديل ، أو ShardCount الخصائص.

ملاحظة

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

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

لمزيد من المعلومات، راجع كيفية قياس ذاكرة التخزين المؤقت Azure ل 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 ل Redis

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

للاطلاع على قائمة بالمعلمات المتوفرة وأوصافها ل 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

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

للاطلاع على قائمة بالمعلمات المتوفرة وأوصافها ل 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

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

للاطلاع على قائمة بالمعلمات المتوفرة وأوصافها ل 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 المعلمة KeyType أو Secondary لها. في المثال التالي، يتم إعادة إنشاء مفتاح الوصول الثانوي لذاكرة التخزين المؤقت.

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

يمكنك استيراد البيانات إلى ذاكرة التخزين المؤقت Azure لمثيل Redis باستخدام Import-AzRedisCache cmdlet.

هام

لا يتوفر الاستيراد/التصدير إلا لذاكرة التخزين المؤقت Premium الطبقات. لمزيد من المعلومات حول الاستيراد/التصدير، راجع استيراد وتصدير البيانات في 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 Cache for 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 ل Redis

يمكنك تصدير البيانات من ذاكرة التخزين المؤقت Azure لمثيل Redis باستخدام Export-AzRedisCache cmdlet.

هام

لا يتوفر الاستيراد/التصدير إلا لذاكرة التخزين المؤقت Premium الطبقات. لمزيد من المعلومات حول الاستيراد/التصدير، راجع استيراد وتصدير البيانات في 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 لمثيل 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 ل Redis

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

هام

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

للاطلاع على قائمة بالمعلمات المتوفرة وأوصافها ل 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، راجع الموارد التالية: