GridGain + .NET Предупреждение о подключении к клиенту

Я подключаюсь к GridGain Cluster и продолжаю видеть следующую ошибку в журналах. Я также замечаю, что клиентские подключения разрываются / переподключаются довольно часто (хотя я был новичком в платформе, я не уверен, что это нормальное поведение).

[12: 41: 35,548] [WARN] [grid-nio-worker-0- # 53% null%] [GridTcpRestProtocol] Не определен маршаллер для сеанса NIO, по умолчанию используется PROTOBUF [ses=GridSelectorNioSessionImpl [selectorIdx=0, queueSize= 0 0, writeBuf=null, readBuf=null, super=GridNioSessionImpl [locAddr=/10.25.220.83:11211, rmtAddr=/1.144.94.10:49000, createTime=1398948095537, closeTime=0, bytesSent=0, bytesRcvd=1455 = ss55 = ss = 55 1398948095537, lastSndTime=1398948095537, lastRcvTime=1398948095548, readsPaused= ложные, FilterChain = FilterChain [фильтры = [GridNioCodecFilter [СА =GridTcpRestParser [jdkMarshaller=GridJdkMarshaller [], protobufMarshaller=org.gridgain.client.marshaller.protobuf.GridClientProtobufMarshaller@68ebf23e], directMode=false], принято =true]]]

Это проблема конфигурации? Как я могу определить маршаллер? Ниже моя конфигурация:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:util="http://www.springframework.org/schema/util" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd">
<description>Main Spring file for grid configuration.</description>
<bean id="grid.cfg" class="org.gridgain.grid.GridConfiguration" scope="singleton">
<property name="peerClassLoadingEnabled" value="false"/>
<property name="localHost" value="10.25.220.83"/>
<!-- Cache configurations (all properties are optional). -->
<property name="cacheConfiguration">
    <list>
        <!-- Partitioned cache example configuration (Atomic mode). -->
        <bean parent="cache-template">
            <property name="name" value="partitioned"/>
            <property name="cacheMode" value="PARTITIONED"/>
            <property name="atomicityMode" value="ATOMIC"/>
            <property name="distributionMode" value="PARTITIONED_ONLY"/>
            <property name="backups" value="1"/>
        </bean>
        <!-- Partitioned cache example configuration (Transactional mode). -->
        <bean parent="cache-template">
            <property name="name" value="partitioned_tx"/>
            <property name="cacheMode" value="PARTITIONED"/>
            <property name="atomicityMode" value="TRANSACTIONAL"/>
            <property name="distributionMode" value="NEAR_PARTITIONED"/>
            <property name="backups" value="1"/>
        </bean>
        <!-- Replicated cache example configuration (Atomic mode). -->
        <bean parent="cache-template">
            <property name="name" value="replicated"/>
            <property name="cacheMode" value="REPLICATED"/>
            <property name="atomicityMode" value="ATOMIC"/> 
        </bean>
        <!-- Replicated cache example configuration (Transactional mode). -->
        <bean parent="cache-template">
            <property name="name" value="replicated_tx"/>
            <property name="cacheMode" value="REPLICATED"/>
            <property name="atomicityMode" value="TRANSACTIONAL"/> 
        </bean>
    </list>
</property>
<property name="discoverySpi">
<bean class="org.gridgain.grid.spi.discovery.tcp.GridTcpDiscoverySpi">
<property name="ipFinder">
<bean class="org.gridgain.grid.spi.discovery.tcp.ipfinder.vm.GridTcpDiscoveryVmIpFinder">
<property name="addresses">
<list>
 <value>10.25.220.83:47500</value>
 <value>10.25.240.87:47500</value>
</list>
</property>
</bean>
</property>
</bean>
</property>
</bean>
<!-- Template for all example cache configurations. -->
<bean id="cache-template" abstract="true" class="org.gridgain.grid.cache.GridCacheConfiguration">
 <property name="preloadMode" value="ASYNC"/>
    <property name="preloadBatchSize" value="#{2 * 1024 * 1024}"/>
    <property name="preloadThrottle" value="100"/> 
    <property name="startSize" value="3000000"/>  
    <property name="name" value="partitioned"/>
    <property name="cacheMode" value="PARTITIONED"/>
    <property name="atomicityMode" value="ATOMIC"/>
    <property name="writeSynchronizationMode" value="FULL_ASYNC"/>
    <property name="distributionMode" value="PARTITIONED_ONLY"/>  
    <property name="queryIndexEnabled" value="false"/>
    <property name="backups" value="1"/>
</bean>
</beans>

Я использую следующий клиентский код из консольного приложения C# 4.5.

static void Main(string[] args)
{

    // Create a GridGain Client
    var ggClient = CreateClient();
    Console.WriteLine("GridGain Connected");

    ggCache = ggClient.Data("partitioned");
    ggCompute = ggClient.Compute();

    ggCache.Put<string, byte[]>("test", new byte[] { 0, 1, 2, 3, 4 });   

    GridClientFactory.StopAll(); 
}

private static IGridClientData ggCache;
private static IGridClientCompute ggCompute;  

/**
 * <summary>
 * This method will create a client with default configuration. Note that this method expects that
 * first node will bind rest binary protocol on default port. It also expects that partitioned cache is
 * configured in grid.</summary>
 *
 * <returns>Client instance.</returns>
 * <exception cref="GridClientException">If client could not be created.</exception>
 */
private static IGridClient CreateClient()
{
    var cacheCfg = new GridClientDataConfiguration();

    // Set remote cache name.
    cacheCfg.Name = "partitioned";

    // Set client partitioned affinity for this cache.
    cacheCfg.Affinity = new GridClientPartitionAffinity();

    var cfg = new GridClientConfiguration();
    cfg.IsTopologyCacheEnabled = true;
    cfg.DataConfigurations.Add(cacheCfg);

    // Point client to a local node. Note that this server is only used
    // for initial connection. After having established initial connection
    // client will make decisions which grid node to use based on collocation
    // with key affinity or load balancing.
    cfg.Servers.Add("127.0.0.1" + ':' + GridClientConfiguration.DefaultTcpPort);
    cfg.Routers.Add("127.1.0.1" + ':' + GridClientConfiguration.DefaultTcpPort);
    // cfg.Servers.Add("127.2.0.1" + ':' + GridClientConfiguration.DefaultTcpPort);

    var client = GridClientFactory.Start(cfg); 
    return client;

}

1 ответ

Начиная с GridGain версии 6.2.0-rc2, добавлен GridGain Portable Object функция, которая значительно расширяет функциональные возможности C++ и.NET и устраняет проблемы с подключением.

С Portable Objects вы можете:

  1. Хранить объект в.NET и получать на Java или C++ (обратное также верно)
  2. Динамическое изменение структуры классов на стороне клиента без перезапуска сервера.
  3. Получить переносимые объекты из кэша без десериализации в класс и получить необходимые поля по имени.

Пример Portable Objects доступен для скачивания в версии для предприятий.

Другие вопросы по тегам