Search in sources :

Example 61 with TcpDiscoverySpi

use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.

the class GridSpringBeanSerializationSelfTest method config.

/**
 * @return Grid configuration.
 */
private IgniteConfiguration config() {
    IgniteConfiguration cfg = new IgniteConfiguration();
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(disco);
    cfg.setUserAttributes(F.asMap(ATTR_KEY, true));
    cfg.setConnectorConfiguration(null);
    cfg.setIgniteInstanceName(getTestIgniteInstanceName());
    cfg.setBinaryConfiguration(new BinaryConfiguration());
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) BinaryConfiguration(org.apache.ignite.configuration.BinaryConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 62 with TcpDiscoverySpi

use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.

the class ComputeFailoverNodeStartup method configuration.

/**
 * Create Ignite configuration with configured checkpoints.
 *
 * @return Ignite configuration.
 * @throws IgniteException If configuration creation failed.
 */
public static IgniteConfiguration configuration() throws IgniteException {
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setLocalHost("127.0.0.1");
    cfg.setPeerClassLoadingEnabled(true);
    // Configure checkpoint SPI.
    SharedFsCheckpointSpi checkpointSpi = new SharedFsCheckpointSpi();
    checkpointSpi.setDirectoryPaths(Collections.singletonList("work/checkpoint/sharedfs"));
    cfg.setCheckpointSpi(checkpointSpi);
    // Configure discovery SPI.
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
    ipFinder.setAddresses(Arrays.asList("127.0.0.1:47500..47509"));
    discoSpi.setIpFinder(ipFinder);
    cfg.setDiscoverySpi(discoSpi);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) SharedFsCheckpointSpi(org.apache.ignite.spi.checkpoint.sharedfs.SharedFsCheckpointSpi) TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 63 with TcpDiscoverySpi

use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.

the class GridManagerLocalMessageListenerSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(ipFinder);
    c.setDiscoverySpi(discoSpi);
    TcpCommunicationSpi commSpi = new TcpCommunicationSpi();
    c.setCommunicationSpi(commSpi);
    return c;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpCommunicationSpi(org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 64 with TcpDiscoverySpi

use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.

the class GridManagerMxBeanIllegalArgumentHandleTest method testIllegalStateIsCatch.

/**
 * Creates minimal disco manager mock, checks illegal state is not propagated
 */
public void testIllegalStateIsCatch() {
    final IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setDiscoverySpi(new TcpDiscoverySpi());
    final IgniteLogger log = Mockito.mock(IgniteLogger.class);
    final GridKernalContext ctx = Mockito.mock(GridKernalContext.class);
    when(ctx.config()).thenReturn(cfg);
    when(ctx.log(Mockito.anyString())).thenReturn(log);
    when(ctx.log(Mockito.any(Class.class))).thenReturn(log);
    final GridDiscoveryManager mgr = new GridDiscoveryManager(ctx);
    final long nHeapMax = mgr.metrics().getNonHeapMemoryMaximum();
    if (correctSetupOfTestPerformed)
        assertEquals(0, nHeapMax);
    final long heapMax = mgr.metrics().getHeapMemoryMaximum();
    if (correctSetupOfTestPerformed)
        assertEquals(0, heapMax);
}
Also used : GridDiscoveryManager(org.apache.ignite.internal.managers.discovery.GridDiscoveryManager) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) GridKernalContext(org.apache.ignite.internal.GridKernalContext) IgniteLogger(org.apache.ignite.IgniteLogger) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 65 with TcpDiscoverySpi

use of org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi in project ignite by apache.

the class GridCheckpointManagerAbstractSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    assert igniteInstanceName != null;
    IgniteConfiguration cfg = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(IP_FINDER);
    cfg.setDiscoverySpi(discoSpi);
    if (igniteInstanceName.contains("cache")) {
        String cacheName = "test-checkpoints";
        CacheConfiguration cacheCfg = defaultCacheConfiguration();
        cacheCfg.setName(cacheName);
        cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
        CacheCheckpointSpi spi = new CacheCheckpointSpi();
        spi.setCacheName(cacheName);
        cfg.setCacheConfiguration(cacheCfg);
        cfg.setCheckpointSpi(spi);
    } else if (igniteInstanceName.contains("jdbc")) {
        JdbcCheckpointSpi spi = new JdbcCheckpointSpi();
        jdbcDataSource ds = new jdbcDataSource();
        ds.setDatabase("jdbc:hsqldb:mem:gg_test_" + getClass().getSimpleName());
        ds.setUser("sa");
        ds.setPassword("");
        spi.setDataSource(ds);
        spi.setCheckpointTableName("test_checkpoints");
        spi.setKeyFieldName("key");
        spi.setValueFieldName("value");
        spi.setValueFieldType("longvarbinary");
        spi.setExpireDateFieldName("expire_date");
        cfg.setCheckpointSpi(spi);
    }
    return cfg;
}
Also used : org.hsqldb.jdbc.jdbcDataSource(org.hsqldb.jdbc.jdbcDataSource) CacheCheckpointSpi(org.apache.ignite.spi.checkpoint.cache.CacheCheckpointSpi) IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) JdbcCheckpointSpi(org.apache.ignite.spi.checkpoint.jdbc.JdbcCheckpointSpi) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)764 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)745 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)330 TcpDiscoveryVmIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder)80 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)76 NearCacheConfiguration (org.apache.ignite.configuration.NearCacheConfiguration)58 DataStorageConfiguration (org.apache.ignite.configuration.DataStorageConfiguration)55 RendezvousAffinityFunction (org.apache.ignite.cache.affinity.rendezvous.RendezvousAffinityFunction)48 DataRegionConfiguration (org.apache.ignite.configuration.DataRegionConfiguration)48 ConnectorConfiguration (org.apache.ignite.configuration.ConnectorConfiguration)41 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)35 FileSystemConfiguration (org.apache.ignite.configuration.FileSystemConfiguration)31 IgfsGroupDataBlocksKeyMapper (org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper)21 BinaryConfiguration (org.apache.ignite.configuration.BinaryConfiguration)19 ArrayList (java.util.ArrayList)18 Ignite (org.apache.ignite.Ignite)18 TestRecordingCommunicationSpi (org.apache.ignite.internal.TestRecordingCommunicationSpi)18 QueryEntity (org.apache.ignite.cache.QueryEntity)12 DiscoverySpi (org.apache.ignite.spi.discovery.DiscoverySpi)10 MemoryEventStorageSpi (org.apache.ignite.spi.eventstorage.memory.MemoryEventStorageSpi)10