Jak tworzyć Azure Cache for Redis i zarządzać nimi przy użyciu klasycznego interfejsu wiersza polecenia platformy Azure

Klasyczny interfejs wiersza polecenia platformy Azure to doskonały sposób zarządzania infrastrukturą platformy Azure z dowolnej platformy. W tym artykule pokazano, jak tworzyć wystąpienia Azure Cache for Redis i zarządzać nimi przy użyciu klasycznego interfejsu wiersza polecenia platformy Azure.

Ważne

Ten artykuł dotyczy czynności, które wymagają użycia klasycznego interfejsu wiersza polecenia platformy Azure. Jest to starsza wersja interfejsu wiersza polecenia platformy Azure, której należy używać wyłącznie z klasycznym modelem wdrażania platformy Azure.

Aby zainstalować klasyczny interfejs wiersza polecenia, zobacz Instalowanie klasycznego interfejsu wiersza polecenia platformy Azure i instalowanie bieżącego interfejsu wiersza polecenia platformy Azure dla wdrożeń usługi Azure Resource Manager, zobacz Instalowanie interfejsu wiersza polecenia platformy Azure.

Uwaga

Aby uzyskać najnowsze przykładowe skrypty interfejsu wiersza polecenia platformy Azure, zobacz Przykłady interfejsu wiersza polecenia platformy Azure Azure Cache for Redis.

Wymagania wstępne

Aby utworzyć wystąpienia Azure Cache for Redis i zarządzać nimi przy użyciu klasycznego interfejsu wiersza polecenia platformy Azure, należy wykonać następujące kroki.

Właściwości usługi Azure Cache for Redis

Podczas tworzenia i aktualizowania wystąpień Azure Cache for Redis są używane następujące właściwości.

Właściwość Przełącznik Opis
name -n, --name Nazwa Azure Cache for Redis.
grupa zasobów -g, --resource-group Nazwa grupy zasobów.
location -l, --location Lokalizacja do utworzenia pamięci podręcznej.
size -z, --size Rozmiar Azure Cache for Redis. Prawidłowe wartości: [C0, C1, C2, C3, C4, C5, C6, P1, P2, P3, P4]
sku -x, --sku Jednostka SKU Redis. Powinna być jedną z: [Podstawowa, Standardowa, Premium]
EnableNonSslPort -e, --enable-non-ssl-port Właściwość EnableNonSslPort Azure Cache for Redis. Dodaj tę flagę, jeśli chcesz włączyć port inny niż TLS/SSL dla pamięci podręcznej
Konfiguracja usługi Redis -c, --redis-configuration Konfiguracja usługi Redis. Tutaj wprowadź ciąg w formacie JSON kluczy konfiguracji i wartości. Format:"{"":""",":"}"
Konfiguracja usługi Redis -f, --redis-configuration-file Konfiguracja usługi Redis. W tym miejscu wprowadź ścieżkę pliku zawierającego klucze konfiguracji i wartości. Format wpisu pliku: {"":"","":""}
Liczba fragmentów -r, --shard-count Liczba fragmentów do utworzenia w pamięci podręcznej klastra w warstwie Premium z klastrowaniem.
Virtual Network -v, --virtual-network Podczas hostowania pamięci podręcznej w sieci wirtualnej określa dokładny identyfikator zasobu Resource Manager sieci wirtualnej do wdrożenia Azure Cache for Redis. Przykładowy format: /subscriptions/{subid}/resourceGroups/{resourceGroupName}/Microsoft.ClassicNetwork/VirtualNetworks/vnet1
typ klucza -t, --key-type Typ klucza do odnowienia. Prawidłowe wartości: [Primary, Secondary]
Statyczny adres IP -p, --static-ip <static-ip> Podczas hostowania pamięci podręcznej w sieci wirtualnej określa unikatowy adres IP w podsieci pamięci podręcznej. Jeśli nie zostanie podana, zostanie wybrana jedna z podsieci.
Podsieć t, --subnet subnet <> Podczas hostowania pamięci podręcznej w sieci wirtualnej określa nazwę podsieci, w której ma zostać wdrożona pamięć podręczna.
VirtualNetwork -v, --virtual-network virtual-network virtual-network <> Podczas hostowania pamięci podręcznej w sieci wirtualnej określa dokładny identyfikator zasobu Resource Manager sieci wirtualnej do wdrożenia Azure Cache for Redis. Przykładowy format: /subscriptions/{subid}/resourceGroups/{resourceGroupName}/Microsoft.ClassicNetwork/VirtualNetworks/vnet1
Subskrypcja -s, --subscription Identyfikator subskrypcji.

Zobacz wszystkie polecenia Azure Cache for Redis

Aby wyświetlić wszystkie polecenia Azure Cache for Redis i ich parametry, użyj azure rediscache -h polecenia .

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)

Tworzenie usługi Azure Cache for Redis

Aby utworzyć Azure Cache for Redis, użyj następującego polecenia:

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

Aby uzyskać więcej informacji na temat tego polecenia, uruchom azure rediscache create -h polecenie .

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)

Usuwanie istniejącego Azure Cache for Redis

Aby usunąć Azure Cache for Redis, użyj następującego polecenia:

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

Aby uzyskać więcej informacji na temat tego polecenia, uruchom azure rediscache delete -h polecenie .

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)

Wyświetl listę wszystkich Azure Cache for Redis w ramach subskrypcji lub grupy zasobów

Aby wyświetlić listę wszystkich Azure Cache for Redis w ramach subskrypcji lub grupy zasobów, użyj następującego polecenia:

    azure rediscache list [options]

Aby uzyskać więcej informacji na temat tego polecenia, uruchom azure rediscache list -h polecenie .

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)

Pokaż właściwości istniejącego Azure Cache for Redis

Aby wyświetlić właściwości istniejącego Azure Cache for Redis, użyj następującego polecenia:

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

Aby uzyskać więcej informacji na temat tego polecenia, uruchom azure rediscache show -h polecenie .

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)

Zmienianie ustawień istniejącego Azure Cache for Redis

Aby zmienić ustawienia istniejącego Azure Cache for Redis, użyj następującego polecenia:

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

Aby uzyskać więcej informacji na temat tego polecenia, uruchom azure rediscache set -h polecenie .

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)

Odnawianie klucza uwierzytelniania dla istniejącego Azure Cache for Redis

Aby odnowić klucz uwierzytelniania dla istniejącego Azure Cache for Redis, użyj następującego polecenia:

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

Określ Primary wartość lub Secondary dla key-type.

Aby uzyskać więcej informacji na temat tego polecenia, uruchom azure rediscache renew-key -h polecenie .

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)

Wyświetlanie listy kluczy podstawowych i pomocniczych istniejącego Azure Cache for Redis

Aby wyświetlić listę kluczy podstawowych i pomocniczych istniejącego Azure Cache for Redis, użyj następującego polecenia:

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

Aby uzyskać więcej informacji na temat tego polecenia, uruchom azure rediscache list-keys -h polecenie .

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)