Cassandra Seeds and Cluster Discovery
Seed nodes are designated contact points that facilitate cluster discovery and gossip protocol initialization. While operationally identical to other nodes, seeds play a critical role in cluster formation, node bootstrapping, and partition recovery scenarios.
Seed Node Functions
Section titled “Seed Node Functions”Primary Responsibilities
Section titled “Primary Responsibilities”| Function | Description | When Used |
|---|---|---|
| Bootstrap discovery | Provide initial cluster topology to joining nodes | New node startup |
| Gossip initialization | First peers for gossip protocol establishment | Node startup |
| Gossip fallback | Contacted opportunistically during gossip rounds | Steady-state gossip |
| Cluster formation | Enable initial cluster creation | First nodes starting |
What Seeds Are NOT
Section titled “What Seeds Are NOT”Seeds are often misunderstood. They do not:
- Have special data responsibilities
- Act as coordinators or masters
- Store additional metadata
- Require more resources than other nodes
- Need to be online for cluster operation (after initial formation)
Operational Equivalence
After cluster formation, seeds function identically to non-seed nodes. The "seed" designation only affects gossip peer selection and bootstrap discovery—not data storage, query coordination, or any other operational aspect.
Cluster Discovery Process
Section titled “Cluster Discovery Process”Initial Bootstrap Discovery
Section titled “Initial Bootstrap Discovery”When a new node starts, it must discover the existing cluster:
Discovery sequence details:
- Read configuration: Parse
seed_providerfrom cassandra.yaml - Attempt seed contact: Contact seeds (order may vary) until one responds
- Receive cluster state: Seed sends complete gossip state (all known endpoints)
- Integrate into gossip: Begin participating in gossip protocol
- Determine ownership: Calculate token ranges (automatic with vnodes)
- Announce presence: Gossip own state to cluster
- Bootstrap streaming: Receive data for owned token ranges
Seed Selection in Gossip
Section titled “Seed Selection in Gossip”During normal gossip operation, seeds receive preferential treatment:
Gossip round (per second per node):
1. Select random live peer → send GossipDigestSyn2. Maybe contact unreachable node: - Probability = unreachable_count / (live_count + 1)3. If step 1 didn't contact a seed: - Maybe contact a random seed - Probability based on cluster stateThis preferential treatment ensures:
- Seeds maintain current cluster state
- Partitioned segments can reconnect via seeds
- New nodes can always discover the cluster
Seed Configuration
Section titled “Seed Configuration”Basic Configuration
Section titled “Basic Configuration”seed_provider: - class_name: org.apache.cassandra.locator.SimpleSeedProvider parameters: - seeds: "10.0.1.1,10.0.1.2,10.0.1.3"Configuration Parameters
Section titled “Configuration Parameters”| Parameter | Description | Example |
|---|---|---|
class_name | Seed provider implementation | SimpleSeedProvider |
seeds | Comma-separated list of seed IP addresses | "10.0.1.1,10.0.1.2" |
Multi-Datacenter Configuration
Section titled “Multi-Datacenter Configuration”For multi-datacenter deployments, include seeds from each datacenter:
# cassandra.yaml - Multi-DC seed configuration
seed_provider: - class_name: org.apache.cassandra.locator.SimpleSeedProvider parameters: # Include 2-3 seeds per datacenter - seeds: "10.0.1.1,10.0.1.2,10.1.1.1,10.1.1.2" # └── DC1 seeds ──┘ └── DC2 seeds ──┘Seed Selection Guidelines
Section titled “Seed Selection Guidelines”Recommended Practices
Section titled “Recommended Practices”| Guideline | Rationale |
|---|---|
| 2-3 seeds per datacenter | Redundancy without excessive gossip traffic |
| Distribute across racks | Survive rack-level failures |
| Use stable, reliable nodes | Seeds should rarely be replaced |
| Same list on all nodes | Consistent cluster discovery |
| Ensure reachability | At least one seed should be reachable from starting nodes |
Seed Count Recommendations
Section titled “Seed Count Recommendations”| Cluster Size | Seeds per DC | Total Seeds | Notes |
|---|---|---|---|
| 3-5 nodes | 2 | 2 | Minimum viable |
| 6-20 nodes | 2-3 | 2-3 | Standard deployment |
| 20-100 nodes | 3 | 3-6 | Large cluster |
| 100+ nodes | 3 | 6-9 | Very large cluster |
Selection Criteria
Section titled “Selection Criteria”When choosing which nodes to designate as seeds:
Common Mistakes and Solutions
Section titled “Common Mistakes and Solutions”Mistake 1: Single Seed Node
Section titled “Mistake 1: Single Seed Node”Problem: Only one seed configured
# BAD: Single point of failureseeds: "10.0.1.1"Impact:
- If seed is down, new nodes cannot join
- Cluster formation requires seed availability
Solution:
# GOOD: Multiple seedsseeds: "10.0.1.1,10.0.1.2,10.0.1.3"Mistake 2: Too Many Seeds
Section titled “Mistake 2: Too Many Seeds”Problem: All or most nodes designated as seeds
# BAD: Excessive seedsseeds: "10.0.1.1,10.0.1.2,10.0.1.3,10.0.1.4,10.0.1.5,10.0.1.6,..."Impact:
- Increased gossip traffic to seeds
- No operational benefit
- Harder to maintain consistency
Solution: Limit to 2-3 per datacenter.
Mistake 3: Inconsistent Seed Lists
Section titled “Mistake 3: Inconsistent Seed Lists”Problem: Different nodes have different seed configurations
# Node A: seeds: "10.0.1.1,10.0.1.2"# Node B: seeds: "10.0.1.3,10.0.1.4"Impact:
- Cluster may fragment
- Inconsistent discovery behavior
- Potential for split-brain scenarios
Solution: Identical seed list on all nodes.
Mistake 4: Seeds in Same Failure Domain
Section titled “Mistake 4: Seeds in Same Failure Domain”Problem: All seeds on same rack or availability zone
# BAD: All seeds in rack1seeds: "10.0.1.1,10.0.1.2,10.0.1.3" # All rack1Impact:
- Rack failure makes cluster unreachable for new nodes
- Reduced partition recovery capability
Solution: Distribute seeds across failure domains.
Mistake 5: Unreachable Seeds
Section titled “Mistake 5: Unreachable Seeds”Problem: Seeds behind firewalls or unreachable from other nodes
Impact:
- Bootstrap failures
- Gossip initialization failures
Solution:
- Ensure port 7000 (or
storage_port) open between all nodes - Verify network connectivity before adding seeds
Seed Operations
Section titled “Seed Operations”Adding a New Seed
Section titled “Adding a New Seed”To designate an existing node as a seed:
-
Update configuration on all nodes:
seeds: "10.0.1.1,10.0.1.2,10.0.1.3,10.0.1.4" # Added 10.0.1.4 -
Rolling restart (optional but recommended):
- Restart nodes one at a time
- New seed designation takes effect
No Restart Required
Adding a seed to the configuration doesn't require immediate restart. The change takes effect when nodes restart for other reasons. However, a rolling restart ensures consistent behavior sooner.
Removing a Seed
Section titled “Removing a Seed”To remove a node from seed designation:
-
Ensure other seeds are available:
- Verify remaining seeds are operational
- Minimum 2 seeds should remain per datacenter
-
Update configuration on all nodes:
seeds: "10.0.1.1,10.0.1.2" # Removed 10.0.1.3 -
Rolling restart (optional but recommended)
Replacing a Failed Seed
Section titled “Replacing a Failed Seed”If a seed node fails permanently:
- Remove from seed list (all nodes' configuration)
- Add replacement seed (different node)
- Handle the failed node:
- If recoverable: repair and restart
- If not recoverable: use
removenodeorassassinate
Partition Recovery
Section titled “Partition Recovery”How Seeds Aid Partition Recovery
Section titled “How Seeds Aid Partition Recovery”During network partitions, seeds help reconnect isolated cluster segments:
Recovery mechanism:
- Network partition isolates cluster segments
- Each segment continues operating independently
- Gossip within segments maintains local consistency
- Seeds in each segment attempt cross-segment communication
- When partition heals, seeds gossip across segments
- State merges using version numbers (higher wins)
- Cluster reunifies with consistent state
Requirements for Partition Recovery
Section titled “Requirements for Partition Recovery”| Requirement | Reason |
|---|---|
| Seeds in each segment | At least one seed per potential partition |
| Gossip to seeds continues | Seeds receive state updates from local segment |
| Version ordering | Generation/version numbers resolve conflicts |
Monitoring Seeds
Section titled “Monitoring Seeds”Health Checks
Section titled “Health Checks”# Verify seed connectivitynodetool gossipinfo | grep -A1 "generation"
# Check if seeds are livenodetool status | grep -E "UN|DN"
# Verify gossip state includes seedsnodetool gossipinfo | grep "<seed_ip>"Metrics
Section titled “Metrics”| Metric | Source | Concern Threshold |
|---|---|---|
| Gossip messages to seeds | JMX | Abnormally high or zero |
| Seed node status | nodetool status | DN (Down) state |
| Bootstrap success rate | Logs | Failures mentioning seeds |
Custom Seed Providers
Section titled “Custom Seed Providers”Built-in Provider
Section titled “Built-in Provider”# SimpleSeedProvider - reads from configurationseed_provider: - class_name: org.apache.cassandra.locator.SimpleSeedProvider parameters: - seeds: "10.0.1.1,10.0.1.2"Cloud Provider Integration
Section titled “Cloud Provider Integration”For dynamic cloud environments, custom seed providers can integrate with cloud APIs:
| Cloud Provider | Approach |
|---|---|
| AWS | EC2 tags, Auto Scaling groups, ECS service discovery |
| GCP | Instance groups, GCE metadata |
| Kubernetes | Headless services, StatefulSet endpoints |
| Azure | VMSS, Azure DNS |
Custom seed providers implement org.apache.cassandra.locator.SeedProvider interface.
Related Documentation
Section titled “Related Documentation”- Gossip Protocol - How seeds participate in gossip
- Node Lifecycle - Bootstrap process using seeds
- Scaling Operations - Seed considerations when scaling