Cassandra on Mac
This guide covers installing Apache Cassandra on macOS, connecting with cqlsh
, and basic usage.
Installation
Install Cassandra using Homebrew:
brew install cassandra
Connecting with cqlsh
Connect to your Cassandra instance:
cqlsh <ip_address> 9042 \
-u <username> \
-p <password> \
--cqlversion="3.4.7"
Switch to your keyspace:
DESCRIBE KEYSPACES;
USE <keyspace_name>;
Securing cqlsh
To enable authentication, follow the official guide.
Create or edit ~/.cassandra/credentials
:
[PlainTextAuthProvider]
username = user1
password = pass1
Basic Queries
Show all tables in the current keyspace:
DESCRIBE TABLES;
-- or --
DESC TABLES;
Show the schema for a specific table:
DESCRIBE TABLE <table_name>;
-- or --
DESC <table_name>;