Search in sources :

Example 26 with ConnectorConfiguration

use of org.apache.ignite.configuration.ConnectorConfiguration in project ignite by apache.

the class GridLifecycleAwareSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected final IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    TestConnectorMessageInterceptor interceptor = new TestConnectorMessageInterceptor();
    ConnectorConfiguration clientCfg = new ConnectorConfiguration();
    clientCfg.setMessageInterceptor(interceptor);
    cfg.setConnectorConfiguration(clientCfg);
    lifecycleAwares.add(interceptor);
    TestSegmentationResolver segmentationRslvr = new TestSegmentationResolver();
    cfg.setSegmentationResolvers(segmentationRslvr);
    lifecycleAwares.add(segmentationRslvr);
    TestContextFactory ctxFactory = new TestContextFactory();
    clientCfg.setSslContextFactory(ctxFactory);
    lifecycleAwares.add(ctxFactory);
    TestLifecycleBean lifecycleBean = new TestLifecycleBean();
    cfg.setLifecycleBeans(lifecycleBean);
    lifecycleAwares.add(lifecycleBean);
    TestMarshaller marshaller = new TestMarshaller();
    cfg.setMarshaller(marshaller);
    lifecycleAwares.add(marshaller.lifecycleAware());
    TestLogger testLog = new TestLogger();
    cfg.setGridLogger(testLog);
    lifecycleAwares.add(testLog.lifecycleAware());
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) ConnectorConfiguration(org.apache.ignite.configuration.ConnectorConfiguration)

Example 27 with ConnectorConfiguration

use of org.apache.ignite.configuration.ConnectorConfiguration in project ignite by apache.

the class GridCacheCommandHandlerSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration() throws Exception {
    // Discovery config.
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(new TcpDiscoveryVmIpFinder(true));
    disco.setJoinTimeout(5000);
    // Cache config.
    CacheConfiguration cacheCfg = defaultCacheConfiguration();
    cacheCfg.setCacheMode(CacheMode.LOCAL);
    cacheCfg.setAtomicityMode(atomicityMode());
    // Grid config.
    IgniteConfiguration cfg = super.getConfiguration();
    cfg.setLocalHost("127.0.0.1");
    ConnectorConfiguration clnCfg = new ConnectorConfiguration();
    clnCfg.setHost("127.0.0.1");
    cfg.setConnectorConfiguration(clnCfg);
    cfg.setDiscoverySpi(disco);
    // Add 'null' cache configuration.
    cfg.setCacheConfiguration(cacheCfg);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) ConnectorConfiguration(org.apache.ignite.configuration.ConnectorConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 28 with ConnectorConfiguration

use of org.apache.ignite.configuration.ConnectorConfiguration in project ignite by apache.

the class IgniteNode method start.

/** {@inheritDoc} */
@Override
public void start(BenchmarkConfiguration cfg) throws Exception {
    IgniteBenchmarkArguments args = new IgniteBenchmarkArguments();
    BenchmarkUtils.jcommander(cfg.commandLineArguments(), args, "<ignite-node>");
    IgniteBiTuple<IgniteConfiguration, ? extends ApplicationContext> tup = loadConfiguration(args.configuration());
    IgniteConfiguration c = tup.get1();
    assert c != null;
    if (args.cleanWorkDirectory())
        FileUtils.cleanDirectory(U.workDirectory(c.getWorkDirectory(), c.getIgniteHome()));
    ApplicationContext appCtx = tup.get2();
    assert appCtx != null;
    CacheConfiguration[] ccfgs = c.getCacheConfiguration();
    if (ccfgs != null) {
        for (CacheConfiguration cc : ccfgs) {
            // IgniteNode can not run in CLIENT_ONLY mode,
            // except the case when it's used inside IgniteAbstractBenchmark.
            boolean cl = args.isClientOnly() && (args.isNearCache() || clientMode);
            if (cl)
                c.setClientMode(true);
            if (args.isNearCache()) {
                NearCacheConfiguration nearCfg = new NearCacheConfiguration();
                if (args.getNearCacheSize() != 0)
                    nearCfg.setNearEvictionPolicy(new LruEvictionPolicy(args.getNearCacheSize()));
                cc.setNearConfiguration(nearCfg);
            }
            cc.setWriteSynchronizationMode(args.syncMode());
            cc.setBackups(args.backups());
            if (args.restTcpPort() != 0) {
                ConnectorConfiguration ccc = new ConnectorConfiguration();
                ccc.setPort(args.restTcpPort());
                if (args.restTcpHost() != null)
                    ccc.setHost(args.restTcpHost());
                c.setConnectorConfiguration(ccc);
            }
            cc.setReadThrough(args.isStoreEnabled());
            cc.setWriteThrough(args.isStoreEnabled());
            cc.setWriteBehindEnabled(args.isWriteBehind());
            BenchmarkUtils.println(cfg, "Cache configured with the following parameters: " + cc);
        }
    } else
        BenchmarkUtils.println(cfg, "There are no caches configured");
    TransactionConfiguration tc = c.getTransactionConfiguration();
    tc.setDefaultTxConcurrency(args.txConcurrency());
    tc.setDefaultTxIsolation(args.txIsolation());
    TcpCommunicationSpi commSpi = (TcpCommunicationSpi) c.getCommunicationSpi();
    if (commSpi == null)
        commSpi = new TcpCommunicationSpi();
    c.setCommunicationSpi(commSpi);
    if (args.getPageSize() != MemoryConfiguration.DFLT_PAGE_SIZE) {
        MemoryConfiguration dbCfg = c.getMemoryConfiguration();
        if (dbCfg == null) {
            dbCfg = new MemoryConfiguration();
            c.setMemoryConfiguration(dbCfg);
        }
        dbCfg.setPageSize(args.getPageSize());
    }
    ignite = IgniteSpring.start(c, appCtx);
    BenchmarkUtils.println("Configured marshaller: " + ignite.cluster().localNode().attribute(ATTR_MARSHALLER));
}
Also used : TransactionConfiguration(org.apache.ignite.configuration.TransactionConfiguration) MemoryConfiguration(org.apache.ignite.configuration.MemoryConfiguration) ConnectorConfiguration(org.apache.ignite.configuration.ConnectorConfiguration) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) ApplicationContext(org.springframework.context.ApplicationContext) GenericApplicationContext(org.springframework.context.support.GenericApplicationContext) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) NearCacheConfiguration(org.apache.ignite.configuration.NearCacheConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) LruEvictionPolicy(org.apache.ignite.cache.eviction.lru.LruEvictionPolicy)

Example 29 with ConnectorConfiguration

use of org.apache.ignite.configuration.ConnectorConfiguration in project ignite by apache.

the class JdbcLocalCachesSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    CacheConfiguration cache = defaultCacheConfiguration();
    cache.setName(CACHE_NAME);
    cache.setCacheMode(LOCAL);
    cache.setWriteSynchronizationMode(FULL_SYNC);
    cache.setIndexedTypes(String.class, Integer.class);
    cfg.setCacheConfiguration(cache);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(disco);
    cfg.setConnectorConfiguration(new ConnectorConfiguration());
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) ConnectorConfiguration(org.apache.ignite.configuration.ConnectorConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 30 with ConnectorConfiguration

use of org.apache.ignite.configuration.ConnectorConfiguration in project ignite by apache.

the class JdbcEmptyCacheSelfTest method getConfiguration.

/** {@inheritDoc} */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    CacheConfiguration cache = defaultCacheConfiguration();
    cache.setName(CACHE_NAME);
    cache.setCacheMode(PARTITIONED);
    cache.setBackups(1);
    cache.setWriteSynchronizationMode(FULL_SYNC);
    cache.setIndexedTypes(Byte.class, Byte.class);
    cfg.setCacheConfiguration(cache);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(disco);
    cfg.setConnectorConfiguration(new ConnectorConfiguration());
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) ConnectorConfiguration(org.apache.ignite.configuration.ConnectorConfiguration) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

ConnectorConfiguration (org.apache.ignite.configuration.ConnectorConfiguration)48 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)44 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)36 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)10 TcpDiscoveryVmIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder)4 AffinityKey (org.apache.ignite.cache.affinity.AffinityKey)2 GridSslContextFactory (org.apache.ignite.internal.client.ssl.GridSslContextFactory)2 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)2 IOException (java.io.IOException)1 SSLContext (javax.net.ssl.SSLContext)1 SSLException (javax.net.ssl.SSLException)1 BinaryTypeConfiguration (org.apache.ignite.binary.BinaryTypeConfiguration)1 QueryEntity (org.apache.ignite.cache.QueryEntity)1 QueryIndex (org.apache.ignite.cache.QueryIndex)1 LruEvictionPolicy (org.apache.ignite.cache.eviction.lru.LruEvictionPolicy)1 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)1 ConnectorMessageInterceptor (org.apache.ignite.configuration.ConnectorMessageInterceptor)1 MemoryConfiguration (org.apache.ignite.configuration.MemoryConfiguration)1 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)1 OdbcConfiguration (org.apache.ignite.configuration.OdbcConfiguration)1