Search in sources :

Example 56 with TcpDiscoveryVmIpFinder

use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.

the class GridCachePartitionedWritesTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected final IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(new TcpDiscoveryVmIpFinder(true));
    c.setDiscoverySpi(disco);
    CacheConfiguration cc = defaultCacheConfiguration();
    cc.setCacheMode(CacheMode.PARTITIONED);
    cc.setWriteSynchronizationMode(CacheWriteSynchronizationMode.FULL_SYNC);
    cc.setAtomicityMode(TRANSACTIONAL);
    assert store != null;
    cc.setCacheStoreFactory(singletonFactory(store));
    cc.setReadThrough(true);
    cc.setWriteThrough(true);
    cc.setLoadPreviousValue(true);
    c.setCacheConfiguration(cc);
    return c;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) CacheConfiguration(org.apache.ignite.configuration.CacheConfiguration) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 57 with TcpDiscoveryVmIpFinder

use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.

the class IgniteNoClassOnServerAbstractTest method createConfiguration.

/**
 * @return Configuration.
 */
private IgniteConfiguration createConfiguration() {
    IgniteConfiguration cfg = new IgniteConfiguration();
    cfg.setPeerClassLoadingEnabled(false);
    cfg.setLocalHost("127.0.0.1");
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinderCleanFrequency(1000);
    TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
    ipFinder.setAddresses(Arrays.asList("127.0.0.1:47500..47509"));
    disco.setIpFinder(ipFinder);
    cfg.setDiscoverySpi(disco);
    return cfg;
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 58 with TcpDiscoveryVmIpFinder

use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.

the class PlatformConfigurationUtils method writeDiscoveryConfiguration.

/**
 * Writes discovery configuration.
 *
 * @param w Writer.
 * @param spi Disco.
 */
private static void writeDiscoveryConfiguration(BinaryRawWriter w, DiscoverySpi spi) {
    assert w != null;
    assert spi != null;
    if (!(spi instanceof TcpDiscoverySpi)) {
        w.writeBoolean(false);
        return;
    }
    w.writeBoolean(true);
    TcpDiscoverySpi tcp = (TcpDiscoverySpi) spi;
    TcpDiscoveryIpFinder finder = tcp.getIpFinder();
    if (finder instanceof TcpDiscoveryVmIpFinder) {
        w.writeBoolean(true);
        boolean isMcast = finder instanceof TcpDiscoveryMulticastIpFinder;
        w.writeByte((byte) (isMcast ? 2 : 1));
        Collection<InetSocketAddress> addrs = finder.getRegisteredAddresses();
        w.writeInt(addrs.size());
        for (InetSocketAddress a : addrs) w.writeString(a.toString());
        if (isMcast) {
            TcpDiscoveryMulticastIpFinder multiFinder = (TcpDiscoveryMulticastIpFinder) finder;
            w.writeString(multiFinder.getLocalAddress());
            w.writeString(multiFinder.getMulticastGroup());
            w.writeInt(multiFinder.getMulticastPort());
            w.writeInt(multiFinder.getAddressRequestAttempts());
            w.writeInt(multiFinder.getResponseWaitTime());
            int ttl = multiFinder.getTimeToLive();
            w.writeBoolean(ttl != -1);
            if (ttl != -1)
                w.writeInt(ttl);
        }
    } else
        w.writeBoolean(false);
    w.writeLong(tcp.getSocketTimeout());
    w.writeLong(tcp.getAckTimeout());
    w.writeLong(tcp.getMaxAckTimeout());
    w.writeLong(tcp.getNetworkTimeout());
    w.writeLong(tcp.getJoinTimeout());
    w.writeBoolean(tcp.isForceServerMode());
    w.writeBoolean(tcp.isClientReconnectDisabled());
    w.writeString(tcp.getLocalAddress());
    w.writeInt(tcp.getReconnectCount());
    w.writeInt(tcp.getLocalPort());
    w.writeInt(tcp.getLocalPortRange());
    w.writeLong(tcp.getStatisticsPrintFrequency());
    w.writeLong(tcp.getIpFinderCleanFrequency());
    w.writeInt(tcp.getThreadPriority());
    w.writeInt((int) tcp.getTopHistorySize());
}
Also used : TcpDiscoveryMulticastIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.multicast.TcpDiscoveryMulticastIpFinder) TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) InetSocketAddress(java.net.InetSocketAddress) TcpDiscoveryIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 59 with TcpDiscoveryVmIpFinder

use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.

the class MemcacheRestExampleNodeStartup method configuration.

/**
 * Create Ignite configuration with IGFS and enabled IPC.
 *
 * @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.setDeploymentMode(SHARED);
    cfg.setPeerClassLoadingEnabled(true);
    cfg.setConnectorConfiguration(new ConnectorConfiguration());
    CacheConfiguration cacheCfg = new CacheConfiguration();
    cacheCfg.setName("default");
    cacheCfg.setAtomicityMode(TRANSACTIONAL);
    cacheCfg.setWriteSynchronizationMode(FULL_SYNC);
    cacheCfg.setRebalanceMode(SYNC);
    cacheCfg.setAtomicityMode(TRANSACTIONAL);
    cfg.setCacheConfiguration(cacheCfg);
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder();
    ipFinder.setAddresses(Collections.singletonList("127.0.0.1:47500..47509"));
    discoSpi.setIpFinder(ipFinder);
    cfg.setDiscoverySpi(discoSpi);
    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 60 with TcpDiscoveryVmIpFinder

use of org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder in project ignite by apache.

the class JdbcBulkLoadSelfTest method getConfiguration0.

/**
 * @param gridName Grid name.
 * @return Grid configuration used for starting the grid.
 * @throws Exception If failed.
 */
private IgniteConfiguration getConfiguration0(String gridName) throws Exception {
    IgniteConfiguration cfg = super.getConfiguration(gridName);
    CacheConfiguration<?, ?> cache = defaultCacheConfiguration();
    cache.setCacheMode(PARTITIONED);
    cache.setBackups(1);
    cache.setWriteSynchronizationMode(FULL_SYNC);
    cache.setIndexedTypes(Integer.class, Person.class);
    cfg.setCacheConfiguration(cache);
    cfg.setLocalHost("127.0.0.1");
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    TcpDiscoveryVmIpFinder ipFinder = new TcpDiscoveryVmIpFinder(true);
    ipFinder.setAddresses(Collections.singleton("127.0.0.1:47500..47501"));
    disco.setIpFinder(ipFinder);
    cfg.setDiscoverySpi(disco);
    cfg.setConnectorConfiguration(new ConnectorConfiguration());
    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) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Aggregations

TcpDiscoveryVmIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder)97 IgniteConfiguration (org.apache.ignite.configuration.IgniteConfiguration)81 TcpDiscoverySpi (org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)80 CacheConfiguration (org.apache.ignite.configuration.CacheConfiguration)38 FileSystemConfiguration (org.apache.ignite.configuration.FileSystemConfiguration)16 Ignite (org.apache.ignite.Ignite)14 IgfsGroupDataBlocksKeyMapper (org.apache.ignite.igfs.IgfsGroupDataBlocksKeyMapper)12 ConnectorConfiguration (org.apache.ignite.configuration.ConnectorConfiguration)8 BinaryMarshaller (org.apache.ignite.internal.binary.BinaryMarshaller)6 TcpDiscoveryNode (org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode)6 ArrayList (java.util.ArrayList)5 IgfsIpcEndpointConfiguration (org.apache.ignite.igfs.IgfsIpcEndpointConfiguration)5 HashMap (java.util.HashMap)4 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)4 IgniteException (org.apache.ignite.IgniteException)4 TcpDiscoveryIpFinder (org.apache.ignite.spi.discovery.tcp.ipfinder.TcpDiscoveryIpFinder)4 InetSocketAddress (java.net.InetSocketAddress)3 UUID (java.util.UUID)3 TcpCommunicationSpi (org.apache.ignite.spi.communication.tcp.TcpCommunicationSpi)3 File (java.io.File)2