尝试从 apache-cassandra-4.0.7-bin.tar.gz 创建 docker 映像,但在配置密钥空间后出现以下错误
$ docker exec -it pidcss /bin/bash
$ ./cqlsh localhost -u cassandra -p cassandra
Connected to Test Cluster at localhost:9042
[cqlsh 6.0.0 | Cassandra 4.0.7 | CQL spec 3.4.5 | Native protocol v5]
Use HELP for help.
cassandra@cqlsh> CREATE KEYSPACE pid
... WITH REPLICATION = {
... 'class' : 'SimpleStrategy',
... 'replication_factor' : 0
... };
cassandra@cqlsh> use pid
... ;
cassandra@cqlsh:pid> CREATE TABLE if not exists vis (parentid text, type text, PRIMARY
KEY (parentid));
cassandra@cqlsh:pid> describe tables;
$ ./cqlsh localhost -u cassandra -p cassandra
Connected to Test Cluster at localhost:9042
[cqlsh 6.0.0 | Cassandra 4.0.7 | CQL spec 3.4.5 | Native protocol v5]
Use HELP for help.
cassandra@cqlsh> CREATE KEYSPACE pid WITH REPLICATION = {
'class' : 'SimpleStrategy',
'replication_factor' : 0
};
cassandra@cqlsh> use pid
... ;
cassandra@cqlsh:pid> CREATE TABLE if not exists vis (parentid text, type text, PRIMARY KEY (parentid));
cassandra@cqlsh:pid> describe tables;
vismenu
cassandra@cqlsh:pid> select * from vis ; NoHostAvailable: ('Unable to complete the operation against any hosts', {<Host: 127.0.0.1:9042 datacenter1>: Unavailable('Error from server: code=1000 [Unavailable exception] message="Cannot achieve consistency level ONE" info={\'consistency\': \'ONE\', \'required_replicas\': 1, \'alive_replicas\': 0}')}) cassandra@cqlsh:pid>
有什么想法可以帮助解决这个问题。
谢谢,
尚不清楚 docker 镜像是否已成功拉取并设置正确。从高层次来看,这些步骤看起来像,
docker pull cassandra:4.0.11
或使用来自 https://hub.docker.com/_/cassandra/tags?page=1的最新标签
docker pull cassandra:latest
docker network create cassandra
docker run --rm -d --name cassandra --hostname cassandra --network cassandra cassandra
并让它完全启动docker run --rm -it --network cassandra nuvo/docker-cqlsh cqlsh cassandra 9042 --cqlversion='3.4.5'
启动交互式 CQLSHell(可选的清理活动)
docker kill cassandra
docker network rm cassandra
希望有帮助!