The following document describes setting up Cassandra as a service. If you are interested in running Cassandra in userspace, check out the instructions in MacOS Developer Setup for React, React Native, Node and Cassandra Development.
In order to install Cassandra and
cqlsh we will need to run:
brew install cassandra brew install python pip install cql
In order to check the installation used
brew info cassandra
Here is a typical result:
$ brew info cassandra cassandra: stable 3.3 (bottled) Eventually consistent, distributed key-value store https://cassandra.apache.org /usr/local/Cellar/cassandra/3.3_1 (4,967 files, 115.3M) * Poured from bottle From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/cassandra.rb ==> Caveats To reload cassandra after an upgrade: launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.cassandra.plist launchctl load ~/Library/LaunchAgents/homebrew.mxcl.cassandra.plist
In order to launch the Cassandra server use:
launchctl load /usr/local/opt/cassandra/homebrew.mxcl.cassandra.plist
In order to set Cassandra to start upon login use:
ln -sfv /usr/local/opt/cassandra/*.plist ~/Library/LaunchAgents
In order to verify that Cassandra is running use:
For more detailed explannation please refer to the excellent Christopher Batey's Blog Post.
By default the Cassandra data files are stored at:
Cassandra can also be started manually in terminal by running:
Some components by default are at:
The data by default is stored at:
Very often on a development machine it would be natural to reduce the amount of memory that Cassandra is using. While going below the minimum settings for memory is not advised for production instances, as far as development goes it is perfectly fine. In the example below the total amount of memory for Cassandra will be around 700-800 MB.
# Override these to set the amount of memory to allocate to the JVM at # start-up. For production use you may wish to adjust this for your # environment. MAX_HEAP_SIZE is the total amount of memory dedicated # to the Java heap. HEAP_NEWSIZE refers to the size of the young # generation. Both MAX_HEAP_SIZE and HEAP_NEWSIZE should be either set # or not (if you set one, set the other). # # The main trade-off for the young generation is that the larger it # is, the longer GC pause times will be. The shorter it is, the more # expensive GC will be (usually). # # The example HEAP_NEWSIZE assumes a modern 8-core+ machine for decent pause # times. If in doubt, and if you do not particularly want to tweak, go with # 100 MB per physical CPU core. MAX_HEAP_SIZE="400M" HEAP_NEWSIZE="200M"