Reputation: 11
I'm trying to start cassandra server
C:\Program Files\DataStax Community\apache-cassandra\bin>cassandra
but it is giving me the following error:
WARNING! Powershell script execution unavailable.
Please use
'powershell Set-ExecutionPolicy Unrestricted'
on this user-account to run cassandra with fully featured functionality on this platform.Starting with legacy startup options
Starting Cassandra ServerError occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
I also tried powershell Set-ExecutionPolicy Unrestricted
but still gives some errors... like
C:\Program Files\DataStax Community\apache-cassandra\bin>powershell Set-ExecutionPolicy Unrestricted
C:\Program Files\DataStax Community\apache-cassandra\bin>cassandra
Detected powershell execution permissions. Running with enhanced startup scripts.
This following statement comes in red colour
The term '/' is not recognized as a cmdlet, function, operable program, or script file. Verify the term and try again. At line:1 char:2 + /f <<<< ile C:\Program Files\DataStax Community\apache-cassandra\\bin\cassandra.ps1
If it's still not clear I attached an image:
Upvotes: 1
Views: 6979
Reputation: 16353
As the error states, you need to grant Powershell permissions to the Windows account running the Cassandra script.
You can grant permissions to all Windows accounts on your machine with:
C:\> powershell Set-ExecutionPolicy Unrestricted
WARNING: You need to run the command prompt as an administrator for the command above to work.
As an alternative, you can grant unrestricted access just for your current user with:
C:\> powershell Set-ExecutionPolicy -Scope CurrentUser Unrestricted
As a side note, this error indicates that you don't have enough RAM on your machine to run Cassandra with the default configuration:
Error occurred during initialization of VM
Could not reserve enough space for object heap
My guess is that your laptop/desktop only has 8GB of RAM. By default, Cassandra will attempt to start with 2GB of memory allocated to the heap but if there isn't enough free memory, Java will fail to reserve it.
Try to start Cassandra with a more conservative allocation of 1GB for max heap size and 400MB for NewGen by uncommenting the following lines in the "Heap Settings" section of conf/jvm.options
:
-Xms1G
-Xmx1G
-Xmn400M
I wanted to let you know that there is very limited Windows support in Cassandra 3.11 and there are several known issues that will not be fixed due to limitations in the operating system.
Furthermore, Windows support has been completely dropped in Cassandra 4.0 due to lack of maintainers and testing (CASSANDRA-16171).
As a workaround, we recommend the following:
If you just want to build apps with Cassandra as a backend, Astra DB has a free tier that lets you launch a Cassandra cluster in a few clicks with no credit card required. Cheers!
Upvotes: 0
Reputation: 69
I am studding Cassandra and I had the same issue. Follow the steps below to start it. I hope it help you.
1 - To open windows variables editor:
2 - Add the following variables according to your Java physical path (64 bits), Cassandra physical path and Java Memory Option. In my case:
JAVA_HOME = C:\Program Files\Java\jre1.8.0_221
CASSANDRA_HOME = C:\Program Files (x86)\apache-cassandra-3.11.4
_JAVA_OPTIONS = -Xmx2048M
3 - To open your powershell as administrator
4 - Access your Cassandra folder:
5 - Execute the command ".\cassandra" then your cassandra will start.
Upvotes: 1