Modifying the Basic Configuration File (cassandra.yaml)

1. Introduction

cassandra.yaml is the basic configuration file for Cassandra, used to define core configuration items such as datacenters, nodes, and networks.

2. Datacenter Settings

  • datacenters: Specifies the datacenters for Cassandra. Each datacenter has its own IP address and port.
    datacenters:
      - dc1:
          build_timeout: 60s
          network:
            peer_address: 127.0.0.1
            peer_port: 9042
  • build_timeout: Specifies the time a node needs to wait during initialization.

3. Node Settings

  • seed_peers: Specifies the seed nodes for Cassandra, used to start new nodes.
    seeds:
      - 127.0.0.1:9042
  • listen_address: Specifies the IP address and port for Cassandra to listen on.

4. Network Settings

  • network: Configures Cassandra's internal network access.
    network:
      peer_address: 127.0.0.1
      peer_port: 9042
  • rpc_address: Specifies the RPC (remote procedure call) port.

5. Token Ring Settings

  • token_ring_size: Defines the total number of partitions.
    token_ring_size: 256
  • consistency_level: Specifies the consistency level for Cassandra.

6. Other Settings

  • auto_add_token: If set to true, adds a partition token in each new node.
    auto_add_token: false
  • max_connections: Specifies the maximum number of connections between Cassandra and other nodes.

7. Additional Options

  • log_dir: Specifies the storage location for log files.
    log_dir: /var/log/cassandra/
  • port: Specifies the port for Cassandra to listen on, default is 9042.