Apache Cassandra is a provider of Spring Boot Data for handling NoSQL database operations. Apache Cassandra is a NoSQL distributed database for managing large amounts of data across many servers (clusters) while providing high availability at the cost of decreased consistency. Cassandra high availability is achieved by replicating data to multiple nodes over cluster and allow one or more nodes to go down so that transaction will continue till that point even one server is running.
To use Apache Cassandra in your Spring boot application you have to add this Cassandra starter in your pom.xml .
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-cassandra</artifactId>
<version>2.0.0.M7</version>
</dependency>
After adding Cassandra Database starter in your application it will automatically download and add the required dependencies in your application and initialize with default values. You can overwrite these values through application.properties / application.yaml .
Cassandra Configuration Properties
Spring Boot load these properties in CassandraProperties class.
Name | Default Value | Description |
spring.data.cassandra.cluster-name | Cassandra cluster Name. | |
spring.data.cassandra.compression | Compression supported by the Cassandra binary protocol. | |
spring.data.cassandra.connect-timeout-millis | Socket option: connection time out. | |
spring.data.cassandra.consistency-level | Queries consistency level. | |
spring.data.cassandra.contact-points | localhost | Comma-separated cluster node addresses. |
spring.data.cassandra.fetch-size | Queries default fetch size. | |
spring.data.cassandra.keyspace-name | Keyspace name to use. | |
spring.data.cassandra.load-balancing-policy | Class name of the load balancing policy. | |
spring.data.cassandra.port | Port of the Cassandra server. | |
spring.data.cassandra.password | Login password of the server. | |
spring.data.cassandra.read-timeout-millis | Socket option: read time out. | |
spring.data.cassandra.reconnection-policy | Reconnection policy class. | |
spring.data.cassandra.repositories.enabled | Enable Cassandra repositories. | |
spring.data.cassandra.retry-policy | Class name of the retry policy. | |
spring.data.cassandra.serial-consistency-level | Queries serial consistency level. | |
spring.data.cassandra.schema-action | none | Schema action to take at startup. |
spring.data.cassandra.ssl | false | Enable SSL support. |
spring.data.cassandra.username | Login user of the server. |
References
https://docs.spring.io/spring-boot/docs/1.4.x/reference/html/common-application-properties.html
Happy Learning !!!