Ich versuche mit dem Java -Client eine Verbindung zu einem lokal ausgeführten GridDB -Docker -Container herzustellen. Obwohl ich die richtige Cluster -Konfiguration und die Anmeldeinformationen festgelegt habe, erhalte ich immer wieder einen JC_BAD_CONNECTION -Fehler, der eine Zeitüberschreitung angibt, wenn ich versuche, Benachrichtigungsaktualisierungen zu erhalten. Ich führe das offizielle Griddb Docker -Bild lokal aus und verwende Maven, um Abhängigkeiten zu verwalten. Mein Ziel ist es, eine erfolgreiche Verbindung zum GridDB -Cluster herzustellen und eine Zeile in einen Container namens SampleContainer einzufügen.
Code: Select all
package org.example;
import com.toshiba.mwcloud.gs.*;
import java.util.*;
public class GridDBConnector {
public static void main(String[] args) throws GSException {
// Set GridDB connection properties
Properties props = new Properties();
props.setProperty("notificationAddress", "239.0.0.1");
props.setProperty("notificationPort", "20000");
props.setProperty("clusterName", "dockerGridDB");
props.setProperty("user", "admin");
props.setProperty("password", "admin");
// Connect to the cluster
GridStore store = GridStoreFactory.getInstance().getGridStore(props);
// Define container schema
ContainerInfo containerInfo = new ContainerInfo();
containerInfo.setName("SampleContainer");
containerInfo.setType(ContainerType.COLLECTION);
containerInfo.setColumnInfoList(Arrays.asList(
new ColumnInfo("id", GSType.INTEGER),
new ColumnInfo("name", GSType.STRING)
));
containerInfo.setRowKeyAssigned(true);
// Create container and insert data
Collection collection = store.putCollection("SampleContainer", containerInfo, false);
Row row = collection.createRow();
row.setInteger(0, 1);
row.setString(1, "gridDb");
collection.put(row);
System.out.println("Data inserted into GridDB successfully!");
}
}
com.github.griddb
gridstore
5.3.0
< /code>
Was ich ausprobiert habe: < /p>
Ausführen des Docker Container < /strong> < /li>
< /ul>
docker run -d --name griddb-server -p 10001:10001 griddbnet/griddb:arm-5.5.0
< /code>
Die Konfiguration
Ich habe versucht, die Host- und Porteigenschaften zu aktivieren und wegzulassen. /> Ich habe ein benutzerdefiniertes Docker -Brückennetz erstellt und den Container angehängt.❯ docker exec -it griddb-server bash
bash-5.1$ ls /var/lib/gridstore/conf/
gridstore.conf gridstore.pid gs_cluster.json gs_node.json password
bash-5.1$ cat /var/lib/gridstore/conf/gs_cluster.json
{
"dataStore":{
"partitionNum":128,
"storeBlockSize":"64KB"
},
"cluster":{
"clusterName":"dockerGridDB",
"replicationNum":2,
"notificationAddress":"239.0.0.1",
"notificationPort":20000,
"notificationInterval":"5s",
"heartbeatInterval":"5s",
"loadbalanceCheckInterval":"180s"
},
"sync":{
"timeoutInterval":"30s"
},
"transaction":{
"notificationAddress":"239.0.0.1",
"notificationPort":31999,
"notificationInterval":"5s",
"replicationMode":0,
"replicationTimeoutInterval":"10s"
},
"sql":{
"notificationAddress":"239.0.0.1",
"notificationPort":41999,
"notificationInterval":"5s"
}
}
< /code>
Überprüfung von Protokolls
Der folgende Fehler wiederholt sich immer wieder: < /li>
< /ul>
com.toshiba.mwcloud.gs.common.GSConnectionException: [145028:JC_BAD_CONNECTION] Failed to update by notification (address=/239.0.0.1:20000, reason=Receive timed out)
< /code>
Was ich erwarte /brauche Hilfe bei: < /strong> < /p>
Welche Konfiguration oder Netzwerk -Setup fehlt ich, um eine ordnungsgemäße Benachrichtigungskommunikation zwischen dem Java -Client zu aktivieren. Damit Multicast in Docker auf MacOS/Linux arbeiten kann? Allerdings habe ich auch eine unterschiedliche Eigenschaftskonfiguration anderer durchlaufen. Es funktionierte nicht.>