【问题标题】:Executing multiple cassandra scripts on same keyspace在同一键空间上执行多个 cassandra 脚本
【发布时间】:2017-11-09 17:42:04
【问题描述】:

要通过 cqlsh 执行单个 cassandra sript,我正在执行以下脚本,它工作得很好:

cqlsh -k mykeyspace -u username -p password  -f file1.cql

但是,我有多个 cqlfile,所以我创建了一个主 cql 文件,其中包含类似的条目

master.cql 
 --Content
source file1.cql
source files.cql
source file3.cql

执行上述脚本时:

cqlsh -k mykeyspace -u username -p password  -f master.cql

我收到一条错误消息,例如“未指定密钥空间”。 我不想对单个 cql 文件中的键空间进行硬编码。 What is the way to execute multiple cql files at once ?

【问题讨论】:

    标签: cassandra datastax cql cassandra-2.0 cqlsh


    【解决方案1】:

    -f 开关从 cassandra 3.0 开始只允许单个文件。

    要使用 cql shell 运行多个文件,您可以在 linux 中创建一个 shell 文件并执行它。

    例子:

    您可以在下面创建一个shell文件并运行它。

    cqlsh -k mykeyspace -u username -p password  -f file1.cql
    cqlsh -k mykeyspace -u username -p password  -f file2.cql
    cqlsh -k mykeyspace -u username -p password  -f file3.cql
    

    所以用上面的命令代替master.cql master.sh 应该可以解决问题。

    【讨论】:

      猜你喜欢
      • 2014-03-27
      • 2019-12-09
      • 1970-01-01
      • 1970-01-01
      • 2014-04-18
      • 1970-01-01
      • 1970-01-01
      • 2014-12-10
      • 1970-01-01
      相关资源
      最近更新 更多