【问题标题】:Setup Cassandra container in Github Actions and query在 Github Actions 和查询中设置 Cassandra 容器
【发布时间】:2020-12-04 04:50:27
【问题描述】:

我有这个 .yml 文件:

name: CasDB

on: push

env:
  CARGO_TERM_COLOR: always


jobs:
  test:
    runs-on: ubuntu-latest
    services:
      cassandra:
        image: cassandra
        ports:
          - 9042:9042
        options: --health-cmd "cqlsh --debug" --health-interval 5s --health-retries 10
    steps:
      - run: docker ps
      - run: docker exec ${{ job.services.cassandra.id }} cqlsh --debug localhost:9042 --execute="use somekeyspace;"

我希望在我的 Github 操作中启动 Cassandra 数据库,然后执行一些查询。 Cassandra 数据库正在运行,但是当我想执行查询(“使用 somekeyspace”)时,它会失败并显示以下错误消息:

使用 CQL 驱动程序: 使用连接超时:5秒 使用 'utf-8' 编码 使用 ssl: 错误回溯(最近一次调用最后一次):文件 “/opt/cassandra/bin/cqlsh.py”,第 2459 行,在 main(*read_options(sys.argv[1:], os.environ)) 文件 “/opt/cassandra/bin/cqlsh.py”,第 2437 行,主要 encoding=options.encoding) 文件“/opt/cassandra/bin/cqlsh.py”,行 485,在初始化中 load_balancing_policy=WhiteListRoundRobinPolicy([self.hostname]), 文件 “/opt/cassandra/bin/.../lib/cassandra-driver-internal-only-3.11.0-bb96859b.zip/cassandra-driver-3.11.0-bb96859b/cassandra/policies.py”,第 417 行,在 init socket.gaierror: [Errno -2] 名称或服务不是 已知 ##[错误]进程完成,退出代码为 1。

我需要将 .yml 中的哪些内容更改为:

  1. 执行一个 .sql 脚本(多个数据库脚本)
  2. 执行单个 cqlsh 语句

谢谢

【问题讨论】:

    标签: docker cassandra github-actions scylla


    【解决方案1】:

    您只是在运行带有错误参数的cqlsh:您不能将localhost:9042 作为主机名。主机名和端口是单独的参数。试试:

    cqlsh localhost 9042
    

    而不是cqlsh localhost:9042

    【讨论】:

      猜你喜欢
      • 2020-11-13
      • 1970-01-01
      • 2020-01-01
      • 2021-10-21
      • 2020-10-03
      • 2020-10-25
      • 1970-01-01
      • 2022-12-13
      • 2021-01-29
      相关资源
      最近更新 更多