windows - Cassandra 不是从 cassandra -f 开始的

标签 windows cassandra

尽管我的环境变量是正确的,但我无法使用 '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

最佳答案

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

 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”返回。

所以有几点:
  • 我不知道 java -version 的输出是什么显示 Java 12,但我知道某些 JDK 供应商的格式不同。例如,AdoptOpenJDK 部署会导致 Cassandra 4.0 出现问题(根据此 JIRA:https://issues.apache.org/jira/browse/CASSANDRA-14926)。
  • Cassandra 版本 3(及更早版本)仅适用于 Java 8。Cassandra 4(尚未发布)最多支持 Java 11。AFAIK,Java 12 尚未列入路线图。

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

    如果您仍然遇到问题,我会从 cassandra-env.ps1 文件中删除 Java 版本检查。尽管如此,您这样做有自己的危险。

    关于windows - Cassandra 不是从 cassandra -f 开始的,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57198310/

    相关文章:

    windows - x264 和 libavcodec

    c++ - 将数据从 PC 发送到微 Controller

    php - 将 PHP 和 MySQL 编译为独立的 Windows 或 Linux 应用程序

    javascript - 如何在cassandra中更新其键为时间戳类型的集合

    java - Java 中 Set 的表示与 CQL 的比较

    javascript - 循环内的 Promise 闭包

    php - 将遗留的 PHP 项目从 Windows 迁移到 Linux(不一致的大小写灾难)

    在 Wamp 窗口上具有类似 cron 功能的 php 脚本

    cassandra - 如何更改 Cassandra 中的 PARTITION KEY 列?

    java - Flink 和 Cassandra 连接问题