Cassandra 2.2.1 不会启动使用 cassandra -f

Cassandra 2.2.1 will not start using cassandra -f

我从 apache.cassandra 下载了 cassandra。

我已确保我的 env 路径变量设置正确。

我在 windows 命令提示符中键入:cassandra -f,这就是我得到的结果:

E:\apache-cassandra-2.2.1\bin>cassandra -f
Detected powershell execution permissions.  Running with enhanced startup scripts.
*---------------------------------------------------------------------*
*---------------------------------------------------------------------*

    WARNING!  Automatic page file configuration detected.
    It is recommended that you disable swap when running Cassandra
    for performance and stability reasons.

*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
Exception calling "Start" with "0" argument(s): "The system cannot find the file specified"
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:249 char:5
+     $p.Start() | Out-Null
+     ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : Win32Exception

Exception calling "WaitForExit" with "0" argument(s): "No process is associated with this object."
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:250 char:5
+     $p.WaitForExit()
+     ~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : InvalidOperationException

You cannot call a method on a null-valued expression.
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:251 char:5
+     $stderr = $p.StandardError.ReadToEnd()
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:255 char:9
+     if ($stderr.Contains("Error"))
+         ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:268 char:5
+     $sa = $stderr.Split("""")
+     ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Cannot index into a null array.
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:269 char:5
+     $env:JVM_VERSION = $sa[1]
+     ~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

You cannot call a method on a null-valued expression.
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:271 char:9
+     if ($stderr.Contains("OpenJDK"))
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Cannot index into a null array.
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:284 char:5
+     $pa = $sa[1].Split("_")
+     ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

Cannot index into a null array.
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:285 char:5
+     $env:JVM_PATCH_VERSION=$pa[1]
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : NullArray

*---------------------------------------------------------------------*
*---------------------------------------------------------------------*

    WARNING! Detected a power profile other than High Performance.
    Performance of this node will suffer.
    Modify conf\cassandra.env.ps1 to suppress this warning.

*---------------------------------------------------------------------*
*---------------------------------------------------------------------*
You cannot call a method on a null-valued expression.
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:413 char:9
+     if (($env:JVM_VERSION.CompareTo("1.7") -eq 1) -and ($env:JVM_ARCH ...
+         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

You cannot call a method on a null-valued expression.
At E:\apache-cassandra-2.2.1\conf\cassandra-env.ps1:417 char:10
+     if ( (($env:JVM_VERSION.CompareTo("1.7") -ge 0) -and ($env:JVM_PA ...
+          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Exception calling "Start" with "0" argument(s): "The system cannot find the file specified"
At E:\apache-cassandra-2.2.1\bin\cassandra.ps1:249 char:9
+         $p.Start() | Out-Null
+         ~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : Win32Exception

Exception calling "WaitForExit" with "0" argument(s): "No process is associated with this object."
At E:\apache-cassandra-2.2.1\bin\cassandra.ps1:251 char:9
+         $p.WaitForExit()
+         ~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : InvalidOperationException


E:\apache-cassandra-2.2.1\bin>

这让我抓狂。我不明白为什么这么难。

我 运行 使用 windows 10 pro 并且有很多 space。这是在笔记本电脑上运行的,应该可以运行,但当然不行。

我的 cassandra.yaml 文件没问题。

我是 运行 localhost 作为我的 "seed"。我应该将其设置为 127.0.0.1、localhost 还是我本地机器的 IP?

我需要调整我的 "etc/hosts" 文件吗?

如能提供帮助,我们将不胜感激。

我刚刚在设置 Cassandra 2.1.11 时遇到并解决了类似的错误。在我的例子中,脚本需要一个 JAVA_BIN 环境变量。检查 .ps1 脚本并创建缺少的环境变量 JAVA_BIN 指向 ...\bin\java.exe。

遇到了同样的问题。结果我不是 运行 作为管理员的 CMD...:[=​​12=]:

你可以看到这样一行$env:JAVA_BIN = "$env:JAVA_HOME\bin\java.exe 在 cassandra\conf 文件夹内的 cassandra-env.ps1 中。当 JAVA_HOME 路径错误时会出现此错误。转到系统 -> 环境变量更改为 JAVA_HOME 以更正路径,即 jdk 文件夹。

这可能是由于 JAVA_HOME Cassandra 指向的环境变量。 .ps1脚本文件中的JAVA_HOME环境变量指向JAVA_HOME\bin\java.exe,所以在你的系统环境变量应该排除"bin",即C:\Program Files\Java\jdk1.8.0_172 以避免冲突,因为在 JAVA_HOME 之后它会自动在文件中附加 bin\java.exe。

p.s 这就是我的工作方式。

  1. 在:C:\Program Files\apache-cassandra-3.11.3\conf" folder open the file - "cassandra-env
  2. 搜索:JAVA_HOME
  3. 它将向您显示由 java exe 文件的代码创建的路径。
  4. 仔细检查并确保路径正确。

您可以通过直接更新文件或按照其他答案中的说明更新环境变量来完成。