【问题标题】:Cassandra is not starting with cassandra -fCassandra 不是从 cassandra -f 开始的
【发布时间】:2020-08-17 02:24:43
【问题描述】:

虽然我的环境变量是正确的,但我无法使用“cassandra -f”启动 cassandra。我使用的是 Windows 10 机器。

我收到以下错误!

PS C:\WINDOWS\system32> cassandra -f                                                                                                                                                                            

*---------------------------------------------------------------------* *---------------------------------------------------------------------* 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 C:\cassandra\conf\cassandra-env.ps1:212 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 C:\cassandra\conf\cassandra-env.ps1:213 char:5 + $p.WaitForExit() + ~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : InvalidOperationException You cannot call a method on a null-valued expression. At C:\cassandra\conf\cassandra-env.ps1:214 char:5 + $stderr = $p.StandardError.ReadToEnd() + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At C:\cassandra\conf\cassandra-env.ps1:218 char:9 + if ($stderr.Contains("Error")) + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull You cannot call a method on a null-valued expression. At C:\cassandra\conf\cassandra-env.ps1:231 char:5 + $sa = $stderr.Split("""") + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull Cannot index into a null array. At C:\cassandra\conf\cassandra-env.ps1:232 char:5 + $env:JVM_VERSION = $sa[1] + ~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : NullArray You cannot call a method on a null-valued expression. At C:\cassandra\conf\cassandra-env.ps1:234 char:9 + if ($stderr.Contains("OpenJDK")) + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull Cannot index into a null array. At C:\cassandra\conf\cassandra-env.ps1:247 char:5 + $pa = $sa[1].Split("_") + ~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : NullArray Cannot index into a null array. At C:\cassandra\conf\cassandra-env.ps1:248 char:5 + $subVersion = $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 C:\cassandra\conf\cassandra-env.ps1:406 char:9 + if ($env:JVM_VERSION.CompareTo("1.8.0") -eq -1 -or [convert]::ToI ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (:) [], RuntimeException + FullyQualifiedErrorId : InvokeMethodOnNull Exception calling "Start" with "0" argument(s): "The system cannot find the file specified" At C:\cassandra\bin\cassandra.ps1:251 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 C:\cassandra\bin\cassandra.ps1:253 char:9 + $p.WaitForExit() + ~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [], MethodInvocationException + FullyQualifiedErrorId : InvalidOperationException

【问题讨论】:

  • Cassandra 通常不在 Windows 上运行。它曾一度有一些 Windows 支持,但尚未得到维护。您要启动哪个版本?
  • 从外观上看,它在尝试验证您的 JRE 时失败了。你有安装Java吗? java -version 的输出是什么?
  • @Aaron:我正在运行 JDK 12.0.1

标签: windows cassandra


【解决方案1】:

所以这就是它看起来失败的那一行:

 if ($env:JVM_VERSION.CompareTo("1.8.0") -eq -1

当我在 CentOS (Linux) 机器上运行 java -version 时,我看到以下输出:

$ java -version
openjdk version "1.8.0_191"
OpenJDK Runtime Environment (build 1.8.0_191-b12)
OpenJDK 64-Bit Server VM (build 25.191-b12, mixed mode)

如您所见,第一行的版本以特定格式“1.8.0_191”返回。

所以有几点:

  1. 我不知道 java -version 的输出对于 Java 12 显示了什么,但我知道某些 JDK 供应商的格式不同。例如,AdoptOpenJDK 部署会导致 Cassandra 4.0 出现问题(根据此 JIRA:https://issues.apache.org/jira/browse/CASSANDRA-14926)。

  2. Cassandra 版本 3(及更早版本)仅适用于 Java 8。Cassandra 4(尚未发布)将支持 Java 11。AFAIK,Java 12 尚未列入路线图。

当然,我会安装较低版本的 Java。如果您使用的是 Cassandra 3,则应安装最新的 Java 8 补丁。

如果您仍然有问题,我会从 cassandra-env.ps1 文件中删除 Java 版本检查。不过,这样做后果自负。

【讨论】:

  • java 12.0.1 2019-04-16 Java(TM) SE Runtime Environment (build 12.0.1+12) Java HotSpot(TM) 64-Bit Server VM (build 12.0.1+12,混合模式,共享)
【解决方案2】:

我在 Windows 10 上遇到了与 Cassandra 3.11.7 相同的问题,并通过正确设置 JAVA_HOME 解决了这个问题。我发现 JAVA_HOME 应该指向'bin'的父级,例如到“C:\Program Files\Java\jre1.8.0_261”而不是“C:\Program Files\Java\jre1.8.0_261\bin”。这已经解决了错误“系统找不到指定的路径。”

信用:https://github.com/elastic/elasticsearch/issues/2274

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-21
    • 2018-08-17
    • 2021-11-21
    • 2012-09-03
    • 1970-01-01
    • 2012-04-16
    • 1970-01-01
    相关资源
    最近更新 更多