admin管理员组文章数量:1303404
Please someone help me how to enable materialized view in cassandra docker image. I couldn't see any env variables available to enable it. I am having latest version (greater than 3.x) version which can run Materialized views. I tried below by adding CASSANDRA_MATERIALIZED_VIEWS_ENABLED as env which is not working
Dockercompose.yaml
cassandra:
image: cassandra:latest
container_name: cassandra
ports:
- "9042:9042"
environment:
- CASSANDRA_USER=cassandra
- CASSANDRA_PASSWORD=cassandra
- CASSANDRA_MATERIALIZED_VIEWS_ENABLED=true
volumes:
- cassandra_data:/var/lib/cassandra
healthcheck:
test: [ "CMD", "cqlsh", "-e", "describe keyspaces" ]
interval: 30s
timeout: 10s
retries: 5
Error
Cassandra detailed error SERVER_INVALID_QUERY: Materialized views are disabled.
Else guide me how better we can run the cassandra in docker with MV's enabled?
Please someone help me how to enable materialized view in cassandra docker image. I couldn't see any env variables available to enable it. I am having latest version (greater than 3.x) version which can run Materialized views. I tried below by adding CASSANDRA_MATERIALIZED_VIEWS_ENABLED as env which is not working
Dockercompose.yaml
cassandra:
image: cassandra:latest
container_name: cassandra
ports:
- "9042:9042"
environment:
- CASSANDRA_USER=cassandra
- CASSANDRA_PASSWORD=cassandra
- CASSANDRA_MATERIALIZED_VIEWS_ENABLED=true
volumes:
- cassandra_data:/var/lib/cassandra
healthcheck:
test: [ "CMD", "cqlsh", "-e", "describe keyspaces" ]
interval: 30s
timeout: 10s
retries: 5
Error
Cassandra detailed error SERVER_INVALID_QUERY: Materialized views are disabled.
Else guide me how better we can run the cassandra in docker with MV's enabled?
Share Improve this question edited Feb 10 at 5:27 Erick Ramirez 16.4k2 gold badges21 silver badges31 bronze badges asked Feb 4 at 15:30 Armani_bologneArmani_bologne 812 silver badges7 bronze badges2 Answers
Reset to default 0I was running into the same issue and was able to find this nice resource here to run materialized views: https://github/akka/akka-persistence-cassandra/blob/main/docker-compose.yml
The expectation is to replace the volume define for cassandra configuration in the cassandra image with your own version
volumes:
# This configuration is customized to enable materialized views.
- ${PWD}/cassandra-config/cassandra.yaml:/etc/cassandra/cassandra.yaml
The github example already have configuration file there and you can take a look at it.
Only a very limited number of Cassandra configuration properties are exposed as environment variables in the Docker image:
CASSANDRA_LISTEN_ADDRESS
CASSANDRA_BROADCAST_ADDRESS
CASSANDRA_LISTEN_ADDRESS
CASSANDRA_RPC_ADDRESS
CASSANDRA_START_RPC
CASSANDRA_SEEDS
CASSANDRA_BROADCAST_ADDRESS
CASSANDRA_CLUSTER_NAME
CASSANDRA_NUM_TOKENS
CASSANDRA_DC
CASSANDRA_ENDPOINT_SNITCH
CASSANDRA_RACK
For reference, see the default cassandra/docker-entrypoint.sh
on GitHub.
The materialized_views_enabled
property (previously enable_materialized_views
in Cassandra 4.0) is not configurable as an environment variable.
The recommended method for configuring the cassandra
image is to provide a custom copy of /etc/cassandra/cassandra.yaml
. The easiest way to do this is by supplying your own cassandra.yaml
using a volume bind mount which will override the default copy in the Docker image.
In the Docker compose file, here's an example for specifying the location of the custom cassandra.yaml
on the Docker host:
cassandra:
image: cassandra:latest
...
volumes:
- /path/to/custom/cassandra.yaml:/etc/cassandra/cassandra.yaml
...
As a side note, running cqlsh
to check if the container is healthy requires too much resources particularly since you have it configured to run every 30 seconds. Cassandra is considered operational when it is listening for client connections on CQL port 9042
(default).
I recommend you replace cqlsh
with a simpler test that checks if Cassandra is listening on port 9042
using Linux utilities like netstat
. For example:
healthcheck:
test: ["CMD-SHELL", "netstat -ltn | grep -q 9042"]
This method uses very little CPU and memory, plus it has the advantage that it executes a lot faster so you'll detect an issue with the container quicker. Cheers!
本文标签: How do I enable materialized views in Cassandra running in a Docker containerStack Overflow
版权声明:本文标题:How do I enable materialized views in Cassandra running in a Docker container? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741756075a2396119.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论