在Github Actions和query中设置Cassandra容器



我有这个.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数据库正在运行,但当我想执行查询("use somekeyspace"(时,它失败了,并显示以下错误消息:

使用CQL驱动程序:<模块"cassandra"来自'/opt/cassandra/bin/…/lib/cassandra-driver-internal-only-3.11.0-bb96859b.zip/cassandra-driver-3.11.0-bb 96859b/cassandra/init.py'>使用连接超时:5秒使用"utf-8"编码使用ssl:False Traceback(最近一次调用最后一次(:文件"/opt/cassandra/bin/cqlsh.py",第2459行,inmain(*read_options(sys.argv[1:],os.environment((文件"/opt/cassandra/bin/cqlsh.py",第2437行,在main中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-deriver-3.11.0-bb 96859b/cassandra/policies.py",第417行,在init socket.gaierror:[Erno-2]名称或服务不是已知##[error]进程已完成,退出代码为1。

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

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

感谢

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

cqlsh localhost 9042

而不是CCD_ 3。

最新更新