Package org.elasticsearch.discovery.zen.elect

Examples of org.elasticsearch.discovery.zen.elect.ElectMasterService


        this.pingTimeout = settings.getAsTime("discovery.zen.ping.timeout", settings.getAsTime("discovery.zen.ping_timeout", componentSettings.getAsTime("ping_timeout", componentSettings.getAsTime("initial_ping_timeout", timeValueSeconds(3)))));
        this.sendLeaveRequest = componentSettings.getAsBoolean("send_leave_request", true);

        logger.debug("using ping.timeout [{}]", pingTimeout);

        this.electMaster = new ElectMasterService(settings);

        this.masterFD = new MasterFaultDetection(settings, threadPool, transportService, this);
        this.masterFD.addListener(new MasterNodeFailureListener());

        this.nodesFD = new NodesFaultDetection(settings, threadPool, transportService);
View Full Code Here


        settings = ImmutableSettings.builder().put(settings).put("transport.tcp.port", startPort + "-" + endPort).build();

        ThreadPool threadPool = new ThreadPool(getClass().getName());
        ClusterName clusterName = new ClusterName("test");
        NetworkService networkService = new NetworkService(settings);
        ElectMasterService electMasterService = new ElectMasterService(settings);

        NettyTransport transportA = new NettyTransport(settings, threadPool, networkService, BigArrays.NON_RECYCLING_INSTANCE, Version.CURRENT);
        final TransportService transportServiceA = new TransportService(transportA, threadPool).start();
        final DiscoveryNode nodeA = new DiscoveryNode("UZP_A", transportServiceA.boundAddress().publishAddress(), Version.CURRENT);
View Full Code Here

import java.util.*;

public class ElectMasterServiceTest extends ElasticsearchTestCase {

    ElectMasterService electMasterService() {
        return new ElectMasterService(ImmutableSettings.EMPTY);
    }
View Full Code Here

    }

    @Test
    public void electMaster() {
        List<DiscoveryNode> nodes = generateRandomNodes();
        ElectMasterService service = electMasterService();
        int min_master_nodes = randomIntBetween(0, nodes.size());
        service.minimumMasterNodes(min_master_nodes);

        int master_nodes = 0;
        for (DiscoveryNode node : nodes) {
            if (node.masterNode()) {
                master_nodes++;
            }
        }
        DiscoveryNode master = null;
        if (service.hasEnoughMasterNodes(nodes)) {
            master = service.electMaster(nodes);
        }

        if (master_nodes == 0) {
            assertNull(master);
        } else if (min_master_nodes > 0 && master_nodes < min_master_nodes) {
View Full Code Here

TOP

Related Classes of org.elasticsearch.discovery.zen.elect.ElectMasterService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.