Я впервые пытаюсь интегрировать Griddb с моим приложением Java. />
- Запустил Griddb < /code> Сервер с Docker: < /p>
Код: Выделить всё
docker pull griddbnet/griddb:arm-5.5.0 \ docker run -d --name griddb-server -p 10001:10001 griddbnet/griddb:arm-5.5.0 - добавил griddb java client зависимость:
Код: Выделить всё
com.github.griddb gridstore 5.3.0 - Полный код Java фрагмент для подключения
Код: Выделить всё
package org.example; import com.toshiba.mwcloud.gs.*; import java.util.Arrays; import java.util.Properties; public class GridDBClient { public static void main(String[] args) throws GSException { Properties props = new Properties(); props.setProperty("host", "127.0.0.1"); props.setProperty("port", "10001"); props.setProperty("clusterName", "defaultCluster"); props.setProperty("user", "admin"); props.setProperty("password", "admin"); GridStore store = GridStoreFactory.getInstance().getGridStore(props); 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); 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!"); } }
Журнал ошибок:
Код: Выделить всё
INFO: Failover working (context=9629756, statement=null, orgAddress=null, partition=0, statementId=0, trialCount=1, trialMillis=1053, timeoutMillis=120000)
com.toshiba.mwcloud.gs.common.GSWrongNodeException: [10053:TXN_CLUSTER_NAME_INVALID] cluster name invalid (input=defaultCluster) (address=127.0.0.1:10001, partitionId=0)
Есть ли способ проверить имя кластера внутри контейнера Docker?>
Подробнее здесь: https://stackoverflow.com/questions/795 ... me-invalid