Skip to content

Commit 567df44

Browse files
authored
Merge pull request #188626 from TheovanKraay/cassandra-mi-materialized-views
cassandra mi materialized views doc
2 parents a0a3f02 + c9414f4 commit 567df44

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

articles/managed-instance-apache-cassandra/TOC.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@
5151
href: network-rules.md
5252
- name: Visualize metrics in Prometheus with Grafana
5353
href: visualize-prometheus-grafana.md
54+
- name: Enable materialized views
55+
href: materialized-views.md
5456
- name: Reference
5557
items:
5658
- name: REST API
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
---
2+
title: Materialized views in Azure Managed Instance for Apache Cassandra
3+
description: Learn how to enable materialized views in Azure Managed Instance for Apache Cassandra.
4+
author: TheovanKraay
5+
ms.author: thvankra
6+
ms.service: managed-instance-apache-cassandra
7+
ms.topic: how-to
8+
ms.date: 02/15/2022
9+
---
10+
11+
# Materialized views in Azure Managed Instance for Apache Cassandra
12+
13+
Azure Managed Instance for Apache Cassandra provides automated deployment and scaling operations for managed open-source Apache Cassandra data centers. This article discusses how to enable materialized views.
14+
15+
## Materialized view support
16+
Materialized views are disabled by default, but users can enable them on their cluster. However, we discourage users of Azure Managed Instance for Apache Cassandra from using materialized views. They are experimental (see
17+
[Materialized Views marked experimental-Apache Mail Archives](https://lists.apache.org/thread/o5bk8xyxyl6k3sjf7kkblqw52gm5s9mp) and the [proposal to do so](https://www.mail-archive.com/[email protected]/msg11516.html)). In particular:
18+
19+
- The implementation of materialized views is distributed system design that
20+
hasn’t been extensively modeled and simulated. There have been no formal
21+
proofs about its properties.
22+
- There is no way to determine if a materialized view is out of sync with its
23+
base table.
24+
- There is no upper bound on how long it takes for a materialized view to be
25+
synced when there is a change to its base table.
26+
- If there is an error and a materialized view goes out of sync, the only way to
27+
repair it is to drop the materialized view and recreate it.
28+
29+
Microsoft cannot offer any SLA or support on issues with materialized views.
30+
31+
## Alternatives to materialized views
32+
Like most NoSQL stores, Apache Cassandra is not designed to have a normalized data model. If you need to update data in more than one place, your program should send all the necessary statements as part of a [BATCH](https://cassandra.apache.org/doc/trunk/cassandra/cql/dml.html#batch_statement). This has two advantages over materialized views:
33+
34+
- BATCH guarantees that all statements in the batch are committed or none.
35+
- All the statements have the same quorum and commit semantics.
36+
37+
If your workload truly needs a normalized data model, consider a scalable relational store like Azure's [Hyperscale PostgreSQL](/azure/postgresql/hyperscale/).
38+
39+
## How to enable materialized views
40+
You need to set `enable_materialized_views: true` in the `rawUserConfig` field of your Cassandra data center. To do so, use the following Azure CLI command to update each data center in your cluster:
41+
42+
```azurecli-interactive
43+
FRAGMENT="enable_materialized_views: true"
44+
ENCODED_FRAGMENT=$(echo "$FRAGMENT" | base64 -w 0)
45+
# or
46+
# ENCODED_FRAGMENT="ZW5hYmxlX21hdGVyaWFsaXplZF92aWV3czogdHJ1ZQo="
47+
resourceGroupName='MyResourceGroup'
48+
clusterName='cassandra-hybrid-cluster'
49+
dataCenterName='dc1'
50+
az managed-cassandra datacenter update \
51+
--resource-group $resourceGroupName \
52+
--cluster-name $clusterName \
53+
--data-center-name $dataCenterName \
54+
--base64-encoded-cassandra-yaml-fragment "$ENCODED_FRAGMENT"
55+
```
56+
57+
## Next steps
58+
59+
* [Create a managed instance cluster from the Azure portal](create-cluster-portal.md)
60+
* [Deploy a Managed Apache Spark Cluster with Azure Databricks](deploy-cluster-databricks.md)
61+
* [Manage Azure Managed Instance for Apache Cassandra resources using Azure CLI](manage-resources-cli.md)

0 commit comments

Comments
 (0)