Cara membuat dan mengelola Azure Cache for Redis menggunakan CLI klasik Azure

CLI klasik Azure adalah cara yang bagus untuk mengelola infrastruktur Azure Anda dari platform apa pun. Artikel ini menunjukkan cara membuat dan mengelola instans Azure Cache for Redis menggunakan CLI klasik Azure.

Penting

Artikel ini berisi konten yang memerlukan CLI klasik Azure. Ini adalah versi lama Azure CLI yang seharusnya hanya digunakan dengan model penerapan klasik Azure.

Untuk menginstal CLI klasik, lihat Menginstal CLI klasik Azure dan menginstal CLI Azure saat ini untuk penyebaran Azure Resource Manager, lihat Menginstal Azure CLI.

Catatan

Untuk skrip sampel Azure CLI terbaru, lihat Sampel Azure Cache for Redis CLI Azure.

Prasyarat

Untuk membuat dan mengelola instans Azure Cache for Redis menggunakan CLI klasik Azure, Anda harus mengikuti langkah-langkah berikut.

Properti Azure Cache for Redis

Berbagai properti berikut ini digunakan saat membuat dan memperbarui Azure Cache for Redis.

Properti Sakelar Deskripsi
nama -n, --nama Nama Azure Cache for Redis.
grup sumber daya -g, --grup-sumber-daya Nama Grup Sumber Daya.
lokasi -l, --lokasi Lokasi untuk membuat tembolokan.
ukuran -z, --ukuran Ukuran Azure Cache for Redis. Nilai yang valid: [C0, C1, C2, C3, C4, C5, C6, P1, P2, P3, P4]
sku -x, --sku SKU Redis. Harus salah satu dari: [Dasar, Standar, Premium]
EnableNonSslPort -e, --aktifkan-port-non-ssl Properti EnableNonSslPort dari Azure Cache for Redis. Tambahkan bendera ini jika Anda ingin mengaktifkan Port non-TLS/SSL untuk tembolokan Anda
Konfigurasi Redis -c, --konfigurasi-redis Konfigurasi Redis. Masukkan string kunci dan nilai konfigurasi berformat JSON di sini. Format:"{"":"","":""}"
Konfigurasi Redis -f, --file-konfigurasi-redis Konfigurasi Redis. Masukkan jalur file yang memuat kunci dan nilai konfigurasi di sini. Format untuk entri file: {"":"","":""}
Jumlah Shard -r, --jumlah-shard Jumlah Shard untuk dibuat pada Tembolokan Kluster Premium dengan pengklusteran.
Virtual Network -v, --jaringan-virtual Saat meng-hosting cache Anda di VNET, tentukan ID sumber daya Resource Manager yang tepat dari jaringan virtual untuk menyebarkan Azure Cache for Redis. Format contoh: /subscriptions/{subid}/resourceGroups/{resourceGroupName}/Microsoft.ClassicNetwork/VirtualNetworks/vnet1
jenis kunci -t, --jenis-kunci Jenis kunci untuk diperbarui. Nilai yang valid: [Primer, Sekunder]
StaticIP -p, --static-ip <static-ip> Saat menghosting cache Anda di VNET, tentukan alamat IP unik di subnet untuk cache. Jika tidak disediakan, akan dipilihkan untuk Anda dari subnet.
Subnet t, --subnet <subnet> Saat menghosting cache Anda di VNET, tentukan nama subnet tempat menyebarkan cache.
VirtualNetwork -v, --virtual-network <virtual-network> Saat meng-hosting cache Anda di VNET, tentukan ID sumber daya Resource Manager yang tepat dari jaringan virtual untuk menyebarkan Azure Cache for Redis. Format contoh: /subscriptions/{subid}/resourceGroups/{resourceGroupName}/Microsoft.ClassicNetwork/VirtualNetworks/vnet1
Langganan -s, --langganan Pengidentifikasi langganan.

Lihat semua perintah Azure Cache for Redis

Untuk melihat semua perintah Azure Cache for Redis dan parameternya, gunakan perintah azure rediscache -h.

C:\>azure rediscache -h
help:    Commands to manage your Azure Cache for Redis(s)
help:
help:    Create an Azure Cache for Redis
help:      rediscache create [--name <name> --resource-group <resource-group> --location <location> [options]]
help:
help:    Delete an existing Azure Cache for Redis
help:      rediscache delete [--name <name> --resource-group <resource-group> ]
help:
help:    List all Azure Cache for Redis within your Subscription or Resource Group
help:      rediscache list [options]
help:
help:    Show properties of an existing Azure Cache for Redis
help:      rediscache show [--name <name> --resource-group <resource-group>]
help:
help:    Change settings of an existing Azure Cache for Redis
help:      rediscache set [--name <name> --resource-group <resource-group> --redis-configuration <redis-configuration>/--redis-configuration-file <redisConfigurationFile>]
help:
help:    Renew the authentication key for an existing Azure Cache for Redis
help:      rediscache renew-key [--name <name> --resource-group <resource-group> ]
help:
help:    Lists Primary and Secondary key of an existing Azure Cache for Redis
help:      rediscache list-keys [--name <name> --resource-group <resource-group>]
help:
help:    Options:
help:      -h, --help  output usage information
help:
help:    Current Mode: arm (Azure Resource Management)

Membuat Azure Cache for Redis

Untuk membuat Azure Cache for Redis, gunakan perintah berikut ini:

    azure rediscache create [--name <name> --resource-group <resource-group> --location <location> [options]]

Untuk informasi selengkapnya tentang perintah ini, jalankan perintah azure rediscache create -h.

C:\>azure rediscache create -h
help:    Create an Azure Cache for Redis
help:
help:    Usage: rediscache create [--name <name> --resource-group <resource-group> --location <location> [options]]
help:
help:    Options:
help:      -h, --help                                               output usage information
help:      -v, --verbose                                            use verbose output
help:      -vv                                                      more verbose with debug output
help:      --json                                                   use json output
help:      -n, --name <name>                                        Name of the Azure Cache for Redis.
help:      -g, --resource-group <resource-group>                    Name of the Resource Group
help:      -l, --location <location>                                Location to create cache.
help:      -z, --size <size>                                        Size of the Azure Cache for Redis. Valid values: [C0, C1, C2, C3, C4, C5, C6, P1, P2, P3, P4]
help:      -x, --sku <sku>                                          Redis SKU. Should be one of : [Basic, Standard, Premium]
help:      -e, --enable-non-ssl-port                                EnableNonSslPort property of the Azure Cache for Redis. Add this flag if you want to enable the non-TLS/SSL Port for your cache
help:      -c, --redis-configuration <redis-configuration>          Redis Configuration. Enter a JSON formatted string of configuration keys and values here. Format:"{"<key1>":"<value1>","<key2>":"<value2>"}"
help:      -f, --redis-configuration-file <redisConfigurationFile>  Redis Configuration. Enter the path of a file containing configuration keys and values here. Format for the file entry: {"<key1>":"<value1>","<key2>":"<value2>"}
help:      -r, --shard-count <shard-count>                          Number of Shards to create on a Premium Cluster Cache
help:      -v, --virtual-network <virtual-network>                  The exact ARM resource ID of the virtual network to deploy the Azure Cache for Redis in. Example format: /subscriptions/{subid}/resourceGroups/{resourceGroupName}/Microsoft.ClassicNetwork/VirtualNetworks/vnet1
help:      -t, --subnet <subnet>                                    Required when deploying an Azure Cache for Redis inside an existing Azure Virtual Network
help:      -p, --static-ip <static-ip>                              Required when deploying an Azure Cache for Redis inside an existing Azure Virtual Network
help:      -s, --subscription <id>                                  the subscription identifier
help:
help:    Current Mode: arm (Azure Resource Management)

Menghapus Azure Cache for Redis yang sudah ada

Untuk menghapus Azure Cache for Redis, gunakan perintah berikut ini:

    azure rediscache delete [--name <name> --resource-group <resource-group> ]

Untuk informasi selengkapnya tentang perintah ini, jalankan perintah azure rediscache delete -h.

C:\>azure rediscache delete -h
help:    Delete an existing Azure Cache for Redis
help:
help:    Usage: rediscache delete [--name <name> --resource-group <resource-group> ]
help:
help:    Options:
help:      -h, --help                             output usage information
help:      -v, --verbose                          use verbose output
help:      -vv                                    more verbose with debug output
help:      --json                                 use json output
help:      -n, --name <name>                      Name of the Azure Cache for Redis.
help:      -g, --resource-group <resource-group>  Name of the Resource Group under which the cache exists
help:      -s, --subscription <subscription>      the subscription identifier
help:
help:    Current Mode: arm (Azure Resource Management)

Mencantumkan semua Azure Cache for Redis dalam Langganan atau Grup Sumber Daya Anda

Untuk mencantumkan semua Azure Cache for Redis dalam Langganan atau Grup Sumber Daya Anda, gunakan perintah berikut ini:

    azure rediscache list [options]

Untuk informasi selengkapnya tentang perintah ini, jalankan perintah azure rediscache list -h.

C:\>azure rediscache list -h
help:    List all Azure Cache for Redis within your Subscription or Resource Group
help:
help:    Usage: rediscache list [options]
help:
help:    Options:
help:      -h, --help                             output usage information
help:      -v, --verbose                          use verbose output
help:      -vv                                    more verbose with debug output
help:      --json                                 use json output
help:      -g, --resource-group <resource-group>  Name of the Resource Group
help:      -s, --subscription <subscription>      the subscription identifier
help:
help:    Current Mode: arm (Azure Resource Management)

Menunjukkan properti Azure Cache for Redis yang sudah ada

Untuk menunjukkan properti Azure Cache for Redis yang sudah ada, gunakan perintah berikut ini:

    azure rediscache show [--name <name> --resource-group <resource-group>]

Untuk informasi selengkapnya tentang perintah ini, jalankan perintah azure rediscache show -h.

C:\>azure rediscache show -h
help:    Show properties of an existing Azure Cache for Redis
help:
help:    Usage: rediscache show [--name <name> --resource-group <resource-group>]
help:
help:    Options:
help:      -h, --help                             output usage information
help:      -v, --verbose                          use verbose output
help:      -vv                                    more verbose with debug output
help:      --json                                 use json output
help:      -n, --name <name>                      Name of the Azure Cache for Redis.
help:      -g, --resource-group <resource-group>  Name of the Resource Group
help:      -s, --subscription <subscription>      the subscription identifier
help:
help:    Current Mode: arm (Azure Resource Management)

Mengubah pengaturan Azure Cache for Redis yang sudah ada

Untuk mengubah pengaturan Azure Cache for Redis yang sudah ada, gunakan perintah berikut ini:

    azure rediscache set [--name <name> --resource-group <resource-group> --redis-configuration <redis-configuration>/--redis-configuration-file <redisConfigurationFile>]

Untuk informasi selengkapnya tentang perintah ini, jalankan perintah azure rediscache set -h.

C:\>azure rediscache set -h
help:    Change settings of an existing Azure Cache for Redis
help:
help:    Usage: rediscache set [--name <name> --resource-group <resource-group> --redis-configuration <redis-configuration>/--redis-configuration-file <redisConfigurationFile>]
help:
help:    Options:
help:      -h, --help                                               output usage information
help:      -v, --verbose                                            use verbose output
help:      -vv                                                      more verbose with debug output
help:      --json                                                   use json output
help:      -n, --name <name>                                        Name of the Azure Cache for Redis.
help:      -g, --resource-group <resource-group>                    Name of the Resource Group
help:      -c, --redis-configuration <redis-configuration>          Redis Configuration. Enter a JSON formatted string of configuration keys and values here.
help:      -f, --redis-configuration-file <redisConfigurationFile>  Redis Configuration. Enter the path of a file containing configuration keys and values here.
help:      -s, --subscription <subscription>                        the subscription identifier
help:
help:    Current Mode: arm (Azure Resource Management)

Memperbarui kunci autentikasi untuk Azure Cache for Redis yang sudah ada

Untuk memperbarui kunci autentikasi untuk Azure Cache for Redis yang sudah ada, gunakan perintah berikut ini:

    azure rediscache renew-key [--name <name> --resource-group <resource-group> --key-type <key-type>]

Tentukan Primary atau Secondary untuk key-type.

Untuk informasi selengkapnya tentang perintah ini, jalankan perintah azure rediscache renew-key -h.

C:\>azure rediscache renew-key -h
help:    Renew the authentication key for an existing Azure Cache for Redis
help:
help:    Usage: rediscache renew-key [--name <name> --resource-group <resource-group> ]
help:
help:    Options:
help:      -h, --help                             output usage information
help:      -v, --verbose                          use verbose output
help:      -vv                                    more verbose with debug output
help:      --json                                 use json output
help:      -n, --name <name>                      Name of the Azure Cache for Redis.
help:      -g, --resource-group <resource-group>  Name of the Resource Group under which cache exists
help:      -t, --key-type <key-type>              type of key to renew. Valid values are: 'Primary', 'Secondary'.
help:      -s, --subscription <subscription>      the subscription identifier
help:
help:    Current Mode: arm (Azure Resource Management)

Mencantumkan kunci Utama dan Sekunder dari Azure Cache for Redis yang sudah ada

Untuk mencantumkan kunci Utama dan Sekunder dari Azure Cache for Redis yang sudah ada, gunakan perintah berikut ini:

    azure rediscache list-keys [--name <name> --resource-group <resource-group>]

Untuk informasi selengkapnya tentang perintah ini, jalankan perintah azure rediscache list-keys -h.

C:\>azure rediscache list-keys -h
help:    Lists Primary and Secondary key of an existing Azure Cache for Redis
help:
help:    Usage: rediscache list-keys [--name <name> --resource-group <resource-group>]
help:
help:    Options:
help:      -h, --help                             output usage information
help:      -v, --verbose                          use verbose output
help:      -vv                                    more verbose with debug output
help:      --json                                 use json output
help:      -n, --name <name>                      Name of the Azure Cache for Redis.
help:      -g, --resource-group <resource-group>  Name of the Resource Group under which Cache exists
help:      -s, --subscription <subscription>      the subscription identifier
help:
help:    Current Mode: arm (Azure Resource Management)