Search in sources :

Example 86 with TcpDiscoveryVmIpFinder

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

the class GridSessionCancelSiblingsFromFutureSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
    c.setDiscoverySpi(discoSpi);
    c.setPublicThreadPoolSize(SPLIT_COUNT * EXEC_COUNT);
    return c;
}
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 87 with TcpDiscoveryVmIpFinder

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

the class GridSessionCancelSiblingsFromJobSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
    c.setDiscoverySpi(discoSpi);
    c.setPublicThreadPoolSize(SPLIT_COUNT * EXEC_COUNT);
    return c;
}
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 88 with TcpDiscoveryVmIpFinder

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

the class Log4j2LoggerVerboseModeSelfTest method getConfiguration.

/**
 * Creates grid configuration.
 *
 * @param igniteInstanceName Ignite instance name.
 * @param logPath Logger configuration path.
 * @return Grid configuration.
 * @throws Exception If error occurred.
 */
private static IgniteConfiguration getConfiguration(String igniteInstanceName, String logPath) throws Exception {
    TcpDiscoverySpi disco = new TcpDiscoverySpi();
    disco.setIpFinder(new TcpDiscoveryVmIpFinder(false) {

        {
            setAddresses(Collections.singleton("127.0.0.1:47500..47509"));
        }
    });
    File xml = GridTestUtils.resolveIgnitePath(LOG_PATH_VERBOSE_TEST);
    Log4J2Logger logger = new Log4J2Logger(xml);
    return new IgniteConfiguration().setIgniteInstanceName(igniteInstanceName).setGridLogger(logger).setConnectorConfiguration(null).setDiscoverySpi(disco);
}
Also used : IgniteConfiguration(org.apache.ignite.configuration.IgniteConfiguration) TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) File(java.io.File) TcpDiscoverySpi(org.apache.ignite.spi.discovery.tcp.TcpDiscoverySpi)

Example 89 with TcpDiscoveryVmIpFinder

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

the class TcpClientDiscoverySpiFailureTimeoutSelfTest method clientReconnectOnCoordinatorRouterFail.

/**
 * Test tries to provoke scenario when client sends reconnect message before router failure detected.
 *
 * @param srvNodes Number of additional server nodes.
 * @throws Exception If failed.
 */
public void clientReconnectOnCoordinatorRouterFail(int srvNodes) throws Exception {
    startServerNodes(1);
    Ignite srv = G.ignite("server-0");
    final TcpDiscoveryNode srvNode = (TcpDiscoveryNode) srv.cluster().localNode();
    final UUID srvNodeId = srvNode.id();
    clientIpFinder = new TcpDiscoveryVmIpFinder();
    clientIpFinder.setAddresses(Collections.singleton("localhost:" + srvNode.discoveryPort() + ".." + (srvNode.discoveryPort() + 1)));
    failureThreshold = 1000L;
    netTimeout = 1000L;
    // Client should connect to coordinator.
    startClientNodes(1);
    failureThreshold = 10_000L;
    netTimeout = 5000L;
    List<String> nodes = new ArrayList<>();
    for (int i = 0; i < srvNodes; i++) {
        Ignite g = startGrid("server-" + srvIdx.getAndIncrement());
        nodes.add(g.name());
        srvNodeIds.add(g.cluster().localNode().id());
    }
    checkNodes(1 + srvNodes, 1);
    nodes.add("client-0");
    final CountDownLatch latch = new CountDownLatch(nodes.size());
    final AtomicBoolean err = new AtomicBoolean();
    for (String node : nodes) {
        G.ignite(node).events().localListen(new IgnitePredicate<Event>() {

            @Override
            public boolean apply(Event evt) {
                DiscoveryEvent disoEvt = (DiscoveryEvent) evt;
                if (disoEvt.eventNode().id().equals(srvNodeId)) {
                    info("Expected node failed event: " + ((DiscoveryEvent) evt).eventNode());
                    latch.countDown();
                } else {
                    log.info("Unexpected node failed event: " + evt);
                    err.set(true);
                }
                return true;
            }
        }, EVT_NODE_FAILED);
    }
    Thread.sleep(5000);
    Ignite client = G.ignite("client-0");
    UUID nodeId = client.cluster().localNode().id();
    log.info("Fail coordinator: " + srvNodeId);
    TestTcpDiscoverySpi srvSpi = (TestTcpDiscoverySpi) srv.configuration().getDiscoverySpi();
    srvSpi.pauseAll(false);
    try {
        Thread.sleep(2000);
    } finally {
        srvSpi.simulateNodeFailure();
        srvSpi.resumeAll();
    }
    try {
        assertTrue(latch.await(failureThreshold + 3000, TimeUnit.MILLISECONDS));
        assertFalse("Unexpected event, see log for details.", err.get());
        assertEquals(nodeId, client.cluster().localNode().id());
    } finally {
        srvSpi.resumeAll();
    }
}
Also used : TcpDiscoveryVmIpFinder(org.apache.ignite.spi.discovery.tcp.ipfinder.vm.TcpDiscoveryVmIpFinder) ArrayList(java.util.ArrayList) DiscoveryEvent(org.apache.ignite.events.DiscoveryEvent) CountDownLatch(java.util.concurrent.CountDownLatch) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) DiscoveryEvent(org.apache.ignite.events.DiscoveryEvent) Event(org.apache.ignite.events.Event) Ignite(org.apache.ignite.Ignite) UUID(java.util.UUID) TcpDiscoveryNode(org.apache.ignite.spi.discovery.tcp.internal.TcpDiscoveryNode)

Example 90 with TcpDiscoveryVmIpFinder

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

the class GridSessionSetJobAttributeWaitListenerSelfTest method getConfiguration.

/**
 * {@inheritDoc}
 */
@Override
protected IgniteConfiguration getConfiguration(String igniteInstanceName) throws Exception {
    IgniteConfiguration c = super.getConfiguration(igniteInstanceName);
    TcpDiscoverySpi discoSpi = new TcpDiscoverySpi();
    discoSpi.setIpFinder(new TcpDiscoveryVmIpFinder(true));
    c.setDiscoverySpi(discoSpi);
    c.setPublicThreadPoolSize(SPLIT_COUNT * 2);
    return c;
}
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)

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