9

I'm trying to start Cassandra on my Windows laptop and I'm seeing 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 Server
Error occurred during initialization of VM
Could not reserve enough space for 2097152KB object heap

So I opened Powershell to try and set the ExecutionPolicy to Unrestricted and I get the following:

error from powershell

So I follow this to the registry entry which is described in the error and it seems the key is already set correctly. Am I just missing something obvious? The previous version of Cassandra ran perfectly on my machine, but ever since I updated, this is giving me all kinds of issues.

user3270760
  • 1,444
  • 5
  • 23
  • 45
  • 1
    possible duplicate of [PowerShell says "execution of scripts is disabled on this system."](http://stackoverflow.com/questions/4037939/powershell-says-execution-of-scripts-is-disabled-on-this-system) – arco444 Mar 25 '15 at 15:08

6 Answers6

6

You must allow the execution of PowerShell Scripts on Windows 7. The default execution policy of PowerShell is called Restricted. In this mode, PowerShell operates as an interactive shell only.

On PowerShell open C:\Windows\system32 directory, and run the command

Set-ExecutionPolicy Unrestricted

Also, it’s a serious security risk if you forget to set the Execution Policy back to Restricted mode.

So, in the same directory don'tforget to run

Set-ExecutionPolicy Restricted

For detailed information click here

Semih Eker
  • 2,389
  • 1
  • 20
  • 29
1

"Restricted" is the default policy.

Run the below command to get the policy

Get-ExecutionPolicy -Scope CurrentUser

Run the below to set unrestricted policy

Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser

https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-5.1&viewFallbackFrom=powershell-Microsoft.PowerShell.Core

Mathi
  • 21
  • 1
0

I fix in windows by move from c:\ path(windows path) to other derive

After this I use cassandra -f And it work without any issue

I hope it help you

Akbar Asghari
  • 613
  • 8
  • 19
0

even if on changing the windows execution policy you are getting error like The argument 'C:\apache-cassandra-3.11.13\bin\bin\cassandra.ps1' to the -File parameter does not exist. cassandra error

There might be a error in setting your JAVA_HOME so explicitly set the JAVA_HOME by migrating into folder C:\apache-cassandra-3.11.13\bin then set JAVA_HOME=%path to your jdk% in cassandra and node tool in windows batch file

even then if you get error like the shell is exciting then go to C:\apache-cassandra-3.11.13\conf then change the line just by inserting #in the front i.e #

$env:JVM_OPTS = "$env:JVM_OPTS -Djava.library.path=""$env:CASSANDRA_HOME\lib\sigar-bin"""

This worked for me!!

rootShiv
  • 1,375
  • 2
  • 6
  • 21
-2

By chance are you running the 64-bit powershell.exe but Cassandra is trying to use the 32-bit powershell.exe, or vice-versa?

"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"

vs

"C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe"

mortenya
  • 209
  • 1
  • 4
-2

You can go and change Xmx to lesser heap size.....
For e.g. search for JAVA_OPTS in CASSANDRA_HOME\bin\cassandra.bat file
......
set JAVA_OPTS=-ea^
-javaagent:"%CASSANDRA_HOME%\lib\jamm-0.3.0.jar"^
-Xms2G^
-Xmx2G^

......


-Xms1G^
-Xmx1G^

Deepak Singhvi
  • 727
  • 6
  • 13