Skip to content

Files

Latest commit

7e303ca · Mar 18, 2022

History

History
280 lines (211 loc) · 11.1 KB

manage-resources-cli.md

File metadata and controls

280 lines (211 loc) · 11.1 KB
title description author ms.service ms.topic ms.date ms.author ms.custom keywords
Manage resources with Azure CLI - Azure Resource Manager | Microsoft Docs
Learn about the common commands to automate the management of your Azure Managed Instance for Apache Cassandra using Azure CLI.
TheovanKraay
managed-instance-apache-cassandra
how-to
11/02/2021
thvankra
devx-track-azurecli, seo-azure-cli, ignite-fall-2021
azure resource manager cli

Manage Azure Managed Instance for Apache Cassandra resources using Azure CLI

This article describes common commands to automate the management of your Azure Managed Instance for Apache Cassandra clusters using Azure CLI.

[!INCLUDE azure-cli-prepare-your-environment.md]

Important

This article requires the Azure CLI version 2.30.0 or higher. If you are using Azure Cloud Shell, the latest version is already installed.

Manage Azure Managed Instance for Apache Cassandra resources cannot be renamed as this violates how Azure Resource Manager works with resource URIs.

Azure Managed Instance for Apache Cassandra clusters

The following sections demonstrate how to manage Azure Managed Instance for Apache Cassandra clusters, including:

Create a managed instance cluster

Create an Azure Managed Instance for Apache Cassandra cluster by using the az managed-cassandra cluster create command:

resourceGroupName='MyResourceGroup'
clusterName='cassandra-hybrid-cluster'
location='West US'
delegatedManagementSubnetId='/subscriptions/<subscription id>/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/management'
initialCassandraAdminPassword='myPassword'

# You can override the cluster name if the original name is not legal for an Azure resource.
# overrideClusterName='ClusterNameIllegalForAzureResource'
# the default Cassandra version is v3.11

az managed-cassandra cluster create \
    --cluster-name $clusterName \
    --resource-group $resourceGroupName \
    --location $location \
    --delegated-management-subnet-id $delegatedManagementSubnetId \
    --initial-cassandra-admin-password $initialCassandraAdminPassword \

Delete a managed instance cluster

Delete a cluster by using the az managed-cassandra cluster delete command:

resourceGroupName='MyResourceGroup'
clusterName='cassandra-hybrid-cluster'

az managed-cassandra cluster delete \
    --cluster-name $clusterName \
    --resource-group $resourceGroupName

Get the cluster details

Get cluster details by using the az managed-cassandra cluster show command:

resourceGroupName='MyResourceGroup'
clusterName='cassandra-hybrid-cluster'

az managed-cassandra cluster show \
    --cluster-name $clusterName \
    --resource-group $resourceGroupName

Get the cluster node status

Get cluster details by using the az managed-cassandra cluster node-status command:

clusterName='cassandra-hybrid-cluster'
resourceGroupName='MyResourceGroup'

az managed-cassandra cluster status \
    --cluster-name $clusterName \
    --resource-group $resourceGroupName

List the clusters by resource group

List clusters by resource group by using the az managed-cassandra cluster list command:

subscriptionId='MySubscriptionId'
resourceGroupName='MyResourceGroup'

az managed-cassandra cluster list\
    --resource-group $resourceGroupName

List clusters by subscription ID

List clusters by subscription ID by using the az managed-cassandra cluster list command:

# set your subscription id
az account set -s <subscriptionID>

az managed-cassandra cluster list

The managed instance datacenters

The following sections demonstrate how to manage Azure Managed Instance for Apache Cassandra datacenters, including:

Create a datacenter

Create a datacenter by using the az managed-cassandra datacenter create command:

resourceGroupName='MyResourceGroup'
clusterName='cassandra-hybrid-cluster'
dataCenterName='dc1'
dataCenterLocation='eastus2'
delegatedSubnetId='/subscriptions/<SubscriptionID>/resourceGroups/customer-vnet-rg/providers/Microsoft.Network/virtualNetworks/customer-vnet/subnets/dc1-subnet'
virtualMachineSKU='Standard_D8s_v4'
noOfDisksPerNode=4

az managed-cassandra datacenter create \
    --resource-group $resourceGroupName \
    --cluster-name $clusterName \
    --data-center-name $dataCenterName \
    --data-center-location $dataCenterLocation \
    --delegated-subnet-id $delegatedSubnetId \
    --node-count 3 
    --sku $virtualMachineSKU \
    --disk-capacity $noOfDisksPerNode \
    --availability-zone false

Note

The value for --sku can be chosen from the following available SKUs:

  • Standard_E8s_v4
  • Standard_E16s_v4
  • Standard_E20s_v4
  • Standard_E32s_v4
  • Standard_DS13_v2
  • Standard_DS14_v2
  • Standard_D8s_v4
  • Standard_D16s_v4
  • Standard_D32s_v4

Note also that --availability-zone is set to false. To enable availability zones, set this to true. Availability zones increase the availability SLA of the service. For more details, review the full SLA details here.

Warning

Availability zones are not supported in all regions. Deployments will fail if you select a region where Availability zones are not supported. See here for supported regions. The successful deployment of availability zones is also subject to the availability of compute resources in all of the zones in the given region. Deployments may fail if the SKU you have selected, or capacity, is not available across all zones.

Delete a datacenter

Delete a datacenter by using the az managed-cassandra datacenter delete command:

resourceGroupName='MyResourceGroup'
clusterName='cassandra-hybrid-cluster'
dataCenterName='dc1'

az managed-cassandra datacenter delete \
    --resource-group $resourceGroupName \
    --cluster-name $clusterName \
    --data-center-name $dataCenterName 

Warning

If you have more than one datacenter in your cluster, you must remove any references to the datacenter you are trying to delete in any keyspace replication strategy settings first. This command will fail if there are still references to the datacenter in any keyspaces within your cluster.

Get datacenter details

Get datacenter details by using the az managed-cassandra datacenter show command:

resourceGroupName='MyResourceGroup'
clusterName='cassandra-hybrid-cluster'
dataCenterName='dc1'

az managed-cassandra datacenter show \
    --resource-group $resourceGroupName \
    --cluster-name $clusterName \
    --data-center-name $dataCenterName 

Update or scale a datacenter

Update or scale a datacenter (to scale change nodeCount value) by using the az managed-cassandra datacenter update command:

resourceGroupName='MyResourceGroup'
clusterName='cassandra-hybrid-cluster'
dataCenterName='dc1'

az managed-cassandra datacenter update \
    --resource-group $resourceGroupName \
    --cluster-name $clusterName \
    --data-center-name $dataCenterName \
    --node-count 13 

Update Cassandra configuration

Change Cassandra configuration on a datacenter by using the az managed-cassandra datacenter update command. You will need to base64 encode the YAML fragment by using an online tool. The following YAML settings are supported:

  • column_index_size_in_kb
  • allocate_tokens_for_keyspace
  • compaction_throughput_mb_per_sec
  • read_request_timeout_in_ms
  • range_request_timeout_in_ms
  • aggregated_request_timeout_in_ms
  • write_request_timeout_in_ms
  • request_timeout_in_ms
  • internode_compression
  • batchlog_replay_throttle_in_kb

For example, the following YAML fragment:

column_index_size_in_kb: 16
read_request_timeout_in_ms: 10000

When encoded, the YAML is converted to: Y29sdW1uX2luZGV4X3NpemVfaW5fa2I6IDE2CnJlYWRfcmVxdWVzdF90aW1lb3V0X2luX21zOiAxMDAwMA==.

See below:

resourceGroupName='MyResourceGroup'
clusterName='cassandra-hybrid-cluster'
dataCenterName='dc1'
dataCenterLocation='eastus'
yamlFragment='Y29sdW1uX2luZGV4X3NpemVfaW5fa2I6IDE2CnJlYWRfcmVxdWVzdF90aW1lb3V0X2luX21zOiAxMDAwMA=='

az managed-cassandra datacenter update \
    --resource-group $resourceGroupName \
    --cluster-name $clusterName \
    --data-center-name $dataCenterName \
    --base64-encoded-cassandra-yaml-fragment $yamlFragment

Get the datacenters in a cluster

Get datacenters in a cluster by using the az managed-cassandra datacenter list command:

resourceGroupName='MyResourceGroup'
clusterName='cassandra-hybrid-cluster'

az managed-cassandra datacenter list \
    --resource-group $resourceGroupName \
    --cluster-name $clusterName

Next steps