我目前在 GridDB 中执行客户端请求时遇到问题,并且收到错误代码“10008 TXN_CLUSTER_ROLE_UNMATCH”。出现这个错误
GridStoreFactory factory = GridStoreFactory.getInstance();
try (GridStore store = factory.getGridStore(props)) {
// Create a TimeSeries container (replace "your_container_name" with your actual container name)
String containerName = "your_container_name";
TimeSeries<String> ts = store.putTimeSeries(containerName, String.class);
// Prepare data for insertion
long timestamp = System.currentTimeMillis();
String data = "Sample Data";
// Insert data into the TimeSeries container
ts.put(timestamp, data);
// Retrieve data from the TimeSeries container
Row<String> row = ts.get(timestamp);
System.out.println("Retrieved data: " + row.getValue());
} catch (GSException e) {
e.printStackTrace();
}
我目前正在使用 WSL 机器,我的 GridDB 版本是“5.1.0-39692 CE”。
为了解决此问题,我尝试执行 gs_joincluster 命令以确保集群处于已构建状态。
gs_joincluster -u admin -w adminpass -c myCluster -s 192.168.0.1 -p 10001
尽管执行了 gs_joincluster 操作,问题仍然存在。我正在联系社区,了解潜在原因以及解决“TXN_CLUSTER_ROLE_UNMATCH”错误的其他步骤。
如果运行 gs_stat 会发生什么?你的节点已经在运行了吗?您可能需要先执行 gs_startnode ?或者你能分享更多你的错误吗?这个有点难帮你解决