您的帖子中没有足够的信息来确定潜在问题是什么,所以我将发布我的测试环境,以便您可以将其与您的进行比较。
DSE 配置
这是我的单节点 DSE 6.8.15 集群:
$ nodetool status
Datacenter: Cassandra
=====================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving/Stopped
-- Address Load Tokens Owns (effective) Host ID Rack
UN 10.101.36.175 203.4 KiB 8 100.0% 722c2393-92c8-4eb5-999c-c39063a9aee5 rack1
这些是我在其中配置的条目cassandra.yaml
:
cluster_name: 'stargate'
seed_provider:
- class_name: org.apache.cassandra.locator.SimpleSeedProvider
parameters:
- seeds: "10.101.36.175"
listen_address: 10.101.36.175
native_transport_address: 10.101.36.175
并在dse.yaml
:
authentication_options:
enabled: true
default_scheme: internal
星门配置
我的 Stargate 节点的 IP 是10.101.36.44
,我已经启动它:
$ starctl \
--cluster-name stargate \
--cluster-seed 10.101.36.175 \
--cluster-version 6.8 \
--listen 10.101.36.44 \
--dc Cassandra \
--rack rack1 \
--dse \
--enable-auth
作为参考,我使用了Stargate.io 安装指南中的示例。
Stargate 启动后,我可以确认 API 端点的所有必要端口都已启动:
$ sudo lsof -nPi -sTCP:LISTEN
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
systemd-r 817 systemd-resolve 13u IPv4 22041 0t0 TCP 127.0.0.53:53 (LISTEN)
sshd 1136 root 3u IPv4 25117 0t0 TCP *:22 (LISTEN)
sshd 1136 root 4u IPv6 25128 0t0 TCP *:22 (LISTEN)
java 8724 ubuntu 467u IPv6 59646 0t0 TCP *:7199 (LISTEN)
java 8724 ubuntu 468u IPv6 59647 0t0 TCP *:37421 (LISTEN)
java 8724 ubuntu 473u IPv6 59240 0t0 TCP 10.101.36.44:7000 (LISTEN)
java 8724 ubuntu 851u IPv6 61496 0t0 TCP *:8081 (LISTEN)
java 8724 ubuntu 866u IPv6 62632 0t0 TCP *:8090 (LISTEN)
java 8724 ubuntu 867u IPv6 63503 0t0 TCP *:8084 (LISTEN)
java 8724 ubuntu 872u IPv6 65299 0t0 TCP *:8080 (LISTEN)
java 8724 ubuntu 889u IPv6 63517 0t0 TCP *:9042 (LISTEN)
java 8724 ubuntu 1013u IPv6 65561 0t0 TCP *:8082 (LISTEN)
测试
在我的集群中,我创建了这个表:
CREATE KEYSPACE sgoneks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'} AND durable_writes = true;
CREATE TABLE sgoneks.vaccinations_by_name (
name text PRIMARY KEY,
firstdose date,
seconddose date,
vaccine text
)
该表包含以下数据:
sguser@cqlsh> SELECT * FROM sgoneks.vaccinations_by_name ;
name | firstdose | seconddose | vaccine
--------+------------+------------+-------------
bob | 2021-02-28 | 2021-05-23 | astrazeneca
carlos | 2021-03-12 | 2021-04-02 | astrazeneca
alice | 2021-06-20 | 2021-07-19 | pfizer
以下是我生成身份验证令牌并将其保存为环境变量的方式:
$ curl -L -X POST 'http://10.101.36.44:8081/v1/auth' \
-H 'Content-Type: application/json' \
--data-raw '{"username":"sguser", "password":"sguser"}'
{"authToken":"41867001-216d-4525-b612-6b883a64984d"}
$ export AUTH_TOKEN="41867001-216d-4525-b612-6b883a64984d"
这是通过检查键空间是否sgoneks
存在的快速连接测试:
$ curl -L -X GET 'http://10.101.36.44:8082/v2/schemas/keyspaces/sgoneks' \
-H 'Content-Type: application/json' \
-H "X-Cassandra-Token: $AUTH_TOKEN" \
-H "Accept: application/json" \
| jq
{
"data": {
"name": "sgoneks"
}
}
最后,我在这里检索了疫苗接种的详细信息name='alice'
:
$ curl -L -X GET 'http://10.101.36.44:8082/v2/keyspaces/sgoneks/vaccinations_by_name/alice' \
-H 'Content-Type: application/json' \
-H "X-Cassandra-Token: $AUTH_TOKEN" \
| jq
{
"count": 1,
"data": [
{
"name": "alice",
"firstdose": {
"year": 2021,
"month": "JUNE",
"monthValue": 6,
"chronology": {
"calendarType": "iso8601",
"id": "ISO"
},
"dayOfMonth": 20,
"dayOfWeek": "SUNDAY",
"era": "CE",
"dayOfYear": 171,
"leapYear": false
},
"seconddose": {
"year": 2021,
"month": "JULY",
"monthValue": 7,
"chronology": {
"calendarType": "iso8601",
"id": "ISO"
},
"dayOfMonth": 19,
"dayOfWeek": "MONDAY",
"era": "CE",
"dayOfYear": 200,
"leapYear": false
},
"vaccine": "pfizer"
}
]
}
附带说明一下,您可能会发现只使用Astra DB会更容易,因为它带有预先配置好的Stargate.io并且可以使用。
如果您的 DSE 安装仍有问题,我建议您通过DataStax 支持记录一张票,以便我们的一位工程师可以直接为您提供帮助。干杯!