Installation Guide

Install Cassandra on Windows

Complete step-by-step guide for development and testing on Windows!

⚠️ Important: Windows Installation Notice

❌ Not Recommended for Production

Windows is NOT recommended for Cassandra in production!

  • 💥 Poor performance: 30-50% slower than Linux
  • 💥 Limited community support: Most users run Linux
  • 💥 Fewer tools: Monitoring and management tools built for Linux
  • 💥 File system issues: Windows file locks cause problems
  • 💥 Memory management: JVM works better on Linux

✅ When Windows Installation is OK

  • ✅ Learning Cassandra: Testing queries and concepts
  • ✅ Local development: Building applications
  • ✅ Proof of concept: Quick demos
  • ✅ CQL practice: Writing and testing queries

💡 Better Alternatives

For Windows users, consider:

  • 🐳 Docker: Run Cassandra in Linux container (recommended!)
  • 🖥️ WSL2: Windows Subsystem for Linux
  • ☁️ Cloud VM: Free tier on AWS/Azure/GCP
  • 📦 VirtualBox: Linux VM on Windows

→ See Docker installation guide (easier & better!)

⚠️ If you still want to proceed with Windows installation, continue below...

📋 Prerequisites

What you need before starting the installation.

Required Software

  • Windows Version: Windows 10 or Windows Server 2016+ (64-bit)
  • Administrator Access: Required for installation
  • Java 11 or 17: OpenJDK or Oracle JDK
  • Python 2.7+ or 3.x: For cqlsh (CQL shell)
  • Disk Space: At least 5GB free for Cassandra
  • RAM: Minimum 4GB (8GB+ recommended)

Before You Start

  • ⚠️ Disable antivirus temporarily: May block Cassandra processes
  • ⚠️ Close other applications: Free up memory
  • ⚠️ Check firewall settings: May need to allow ports 7000, 9042
  • ⚠️ Have patience: First startup can take 1-2 minutes

☕ Step 1: Install Java

Cassandra requires Java 11 or Java 17. We'll use OpenJDK 11 (free and open source).

1.1

Download OpenJDK 11

Visit the Adoptium (formerly AdoptOpenJDK) website:

https://adoptium.net/temurin/releases/?os=windows&arch=x64&package=jdk
  • Select Windows x64
  • Choose JDK 11 (LTS)
  • Download the .msi installer
1.2

Run the Installer

  • Double-click the downloaded .msi file
  • Click Next through the wizard
  • ✅ IMPORTANT: Check "Set JAVA_HOME variable"
  • ✅ IMPORTANT: Check "Add to PATH"
  • Click Install
1.3

Verify Java Installation

Open Command Prompt (cmd) and run:

rem Check Java version java -version rem Expected output: openjdk version "11.0.x" OpenJDK Runtime Environment Temurin-11.0.x OpenJDK 64-Bit Server VM Temurin-11.0.x rem Check JAVA_HOME echo %JAVA_HOME% rem Expected output (example): C:\Program Files\Eclipse Adoptium\jdk-11.0.x-hotspot

Troubleshooting Java

If "java" is not recognized:

  1. Open System Properties → Environment Variables
  2. Under System Variables, click New
  3. Variable name: JAVA_HOME
  4. Variable value: C:\Program Files\Eclipse Adoptium\jdk-11.0.x-hotspot
  5. Find Path variable → Click Edit
  6. Add new entry: %JAVA_HOME%\bin
  7. Click OK and restart Command Prompt

🐍 Step 2: Install Python (for cqlsh)

Cassandra's CQL shell (cqlsh) requires Python. Let's install Python 3.

2.1

Download Python

Visit Python's official website:

https://www.python.org/downloads/windows/
  • Download Python 3.11.x (latest stable)
  • Choose Windows installer (64-bit)
2.2

Install Python

  • Run the installer
  • ✅ IMPORTANT: Check "Add python.exe to PATH"
  • Click Install Now
  • Wait for installation to complete
2.3

Verify Python Installation

rem Check Python version python --version rem Expected output: Python 3.11.x rem Install required package for cqlsh pip install cassandra-driver

⬇️ Step 3: Download Cassandra

Download the latest stable version of Apache Cassandra.

3.1

Download from Apache

Visit Apache Cassandra downloads:

https://cassandra.apache.org/download/
  • Download apache-cassandra-4.1.x-bin.tar.gz
  • Note: This is a .tar.gz file (Unix format)
  • You'll need 7-Zip or WinRAR to extract it
3.2

Extract Cassandra

  • Install 7-Zip if you don't have it
  • Right-click the downloaded file → 7-Zip → Extract Here
  • You may need to extract twice (first .tar.gz, then .tar)
  • Move extracted folder to: C:\cassandra\
rem Your folder structure should look like: C:\cassandra\apache-cassandra-4.1.x\ ├── bin\ ├── conf\ ├── lib\ ├── pylib\ └── tools\

Path Recommendation

Use simple paths without spaces:

  • ✅ Good: C:\cassandra\
  • ✅ Good: C:\apache-cassandra\
  • ❌ Bad: C:\Program Files\Cassandra\ (has spaces!)
  • ❌ Bad: C:\My Documents\Cassandra\ (has spaces!)

Spaces in paths can cause issues with scripts!

⚙️ Step 4: Configure Cassandra

Modify configuration files for Windows environment.

4.1

Set Environment Variables

Open Command Prompt as Administrator and run:

rem Set CASSANDRA_HOME setx CASSANDRA_HOME "C:\cassandra\apache-cassandra-4.1.x" /M rem Add Cassandra to PATH setx PATH "%PATH%;%CASSANDRA_HOME%\bin" /M rem Close and reopen Command Prompt
4.2

Edit cassandra.yaml

Open C:\cassandra\apache-cassandra-4.1.x\conf\cassandra.yaml in Notepad++

Find and modify these settings:

# Change data directory paths (use Windows paths) data_file_directories: - C:/cassandra/data/data commitlog_directory: C:/cassandra/data/commitlog saved_caches_directory: C:/cassandra/data/saved_caches hints_directory: C:/cassandra/data/hints # Use forward slashes (/) or double backslashes (\\) # Single backslash (\) will cause errors!
4.3

Create Data Directories

rem Create Cassandra data directories mkdir C:\cassandra\data mkdir C:\cassandra\data\data mkdir C:\cassandra\data\commitlog mkdir C:\cassandra\data\saved_caches mkdir C:\cassandra\data\hints mkdir C:\cassandra\logs
4.4

Configure JVM Heap (Optional but Recommended)

Edit conf\jvm-server.options (or jvm11-server.options for Java 11):

# For 8GB RAM system, set heap to 2GB (1/4 of RAM) -Xms2G -Xmx2G # For 4GB RAM system (minimum) -Xms1G -Xmx1G

🚀 Step 5: Start Cassandra

Start Cassandra server for the first time!

5.1

Start Cassandra Server

Open Command Prompt as Administrator and navigate to Cassandra:

rem Navigate to Cassandra directory cd C:\cassandra\apache-cassandra-4.1.x rem Start Cassandra (this will take 1-2 minutes) bin\cassandra.bat

What you'll see:

  • Lots of log messages (this is normal!)
  • Warnings about performance (expected on Windows)
  • Eventually: "Starting listening for CQL clients..."

First Startup is SLOW

Be patient! First startup can take 1-2 minutes:

  • ⏱️ Cassandra creates system tables
  • ⏱️ JVM warms up
  • ⏱️ Schema initialization
  • ⏱️ Network ports binding

Don't close the window! Keep it running. Cassandra logs appear here.

5.2

Check if Cassandra is Running

Look for these messages in the output:

INFO [...] Node localhost/127.0.0.1:7000 state jump to NORMAL INFO [...] Starting listening for CQL clients on /127.0.0.1:9042... INFO [...] Not starting RPC server as requested.

✅ If you see "Starting listening for CQL clients" → Success!

✅ Step 6: Verify Installation

Test that Cassandra is working correctly!

6.1

Connect with nodetool

Open a NEW Command Prompt (keep the first one running Cassandra) and run:

rem Check node status nodetool status rem Expected output: Datacenter: datacenter1 ======================= Status=Up/Down |/ State=Normal/Leaving/Joining/Moving -- Address Load Tokens Owns Host ID Rack UN 127.0.0.1 69.91 KiB 16 100.0% 8d5ed3f4-7764-4dbd-bad8-43fddce94b7c rack1 rem UN = Up and Normal (good!)
6.2

Connect with cqlsh

In the same Command Prompt, start the CQL shell:

rem Start CQL shell python bin\cqlsh.py rem Expected output: Connected to Test Cluster at 127.0.0.1:9042 [cqlsh 6.1.0 | Cassandra 4.1.x | CQL spec 3.4.6 | Native protocol v5] Use HELP for help. cqlsh>
6.3

Run Test Queries

Try some basic CQL commands:

-- Check Cassandra version SELECT release_version FROM system.local; -- Create a test keyspace CREATE KEYSPACE test_keyspace WITH REPLICATION = { 'class': 'SimpleStrategy', 'replication_factor': 1 }; -- Use the keyspace USE test_keyspace; -- Create a test table CREATE TABLE users ( user_id UUID PRIMARY KEY, name TEXT, email TEXT ); -- Insert data INSERT INTO users (user_id, name, email) VALUES (uuid(), 'Alice', 'alice@example.com'); -- Query data SELECT * FROM users; -- Exit cqlsh EXIT;

Installation Successful!

If all commands worked, congratulations! 🎉

You now have Cassandra running on Windows!

  • ✅ Cassandra server running on port 9042
  • ✅ cqlsh working
  • ✅ Can create keyspaces and tables
  • ✅ Ready to learn CQL!

🔧 Common Issues & Solutions

Fix common Windows installation problems!

❌ "java is not recognized"

Problem: Java not in PATH

Solution:

  1. Verify Java installed: Check C:\Program Files\Eclipse Adoptium\
  2. Add to PATH manually (see Step 1.3 troubleshooting)
  3. Restart Command Prompt
  4. Try java -version again

❌ "Cannot find conf\cassandra.yaml"

Problem: Wrong directory or path with spaces

Solution:

  1. Make sure you're in C:\cassandra\apache-cassandra-4.1.x\
  2. Run: dir conf\cassandra.yaml to verify file exists
  3. Move Cassandra to path without spaces if needed

❌ "Address already in use (port 7000 or 9042)"

Problem: Another Cassandra instance running

Solution:

rem Find process using port 9042 netstat -ano | findstr 9042 rem Kill the process (replace PID with actual number) taskkill /PID 1234 /F rem Or restart computer

❌ "python is not recognized"

Problem: Python not installed or not in PATH

Solution:

  1. Reinstall Python (check "Add to PATH")
  2. Or manually add: C:\Users\YourName\AppData\Local\Programs\Python\Python311\ to PATH
  3. Restart Command Prompt

❌ Cassandra starts then crashes immediately

Possible causes:

  • Not enough RAM: Need at least 4GB, close other apps
  • Antivirus blocking: Disable temporarily
  • Disk space: Need at least 5GB free
  • Wrong Java version: Must be Java 11 or 17

Check logs:

rem View Cassandra logs type C:\cassandra\logs\system.log

❌ "cqlsh: command not found"

Problem: Wrong syntax or path

Solution:

rem Use Python to run cqlsh python bin\cqlsh.py rem Or with full path python C:\cassandra\apache-cassandra-4.1.x\bin\cqlsh.py

Still Having Problems?

Try these steps:

  1. Check logs: C:\cassandra\logs\system.log
  2. Restart computer: Clean slate
  3. Reinstall Java: Make sure Java 11 is installed correctly
  4. Try Docker instead: Much easier on Windows! → Docker Guide
  5. Ask for help: Apache Cassandra mailing list or Stack Overflow

🎉 What's Next?

Congratulations! You've successfully installed Cassandra on Windows!

🚀 Continue Your Learning:

💡 Important Reminders:

  • ⚠️ Development only: Don't use Windows for production!
  • 🐳 Consider Docker: Easier and more reliable for learning
  • 🐧 Production = Linux: Plan to use Linux for real deployments
  • 💾 Backup your data: C:\cassandra\data\ directory

🎓 Ready to learn CQL and build applications!

Advertisement

Responsive Ad