问题描述
我有这个.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中的哪些内容更改为:
- 执行.sql脚本(多个数据库脚本)
- 执行单个cqlsh语句
谢谢
解决方法
您只是使用错误的参数运行cqlsh
:您不能将其localhost:9042
用作主机名。主机名和端口是单独的参数。试试:
cqlsh localhost 9042
代替cqlsh localhost:9042
。