Search in sources :

Example 46 with JoinConfig

use of com.hazelcast.config.JoinConfig in project SSM by Intel-bigdata.

the class HazelcastInstanceProvider method addMemberConfig.

public static void addMemberConfig(ClasspathXmlConfig config) {
    NetworkConfig network = config.getNetworkConfig();
    JoinConfig join = network.getJoin();
    String serverConfFile = new Configuration().get(SmartConfKeys.SMART_CONF_DIR_KEY, SmartConfKeys.SMART_CONF_DIR_DEFAULT) + "/servers";
    Scanner sc = null;
    try {
        sc = new Scanner(new File(serverConfFile));
    } catch (FileNotFoundException ex) {
        LOG.error("Cannot find the config file: {}!", serverConfFile);
    }
    if (sc != null) {
        while (sc.hasNextLine()) {
            String host = sc.nextLine().trim();
            if (!host.startsWith("#") && !host.isEmpty()) {
                join.getTcpIpConfig().addMember(host);
            }
        }
    }
}
Also used : Scanner(java.util.Scanner) Configuration(org.apache.hadoop.conf.Configuration) NetworkConfig(com.hazelcast.config.NetworkConfig) JoinConfig(com.hazelcast.config.JoinConfig) FileNotFoundException(java.io.FileNotFoundException) File(java.io.File)

Example 47 with JoinConfig

use of com.hazelcast.config.JoinConfig in project hazelcast by hazelcast.

the class PartitionServiceBeanDTOTest method getConfig.

@Override
protected Config getConfig() {
    Config config = new Config();
    // Join is disabled intentionally. will start standalone HazelcastInstance.
    NetworkConfig networkConfig = config.getNetworkConfig();
    JoinConfig join = networkConfig.getJoin();
    join.getMulticastConfig().setEnabled(false);
    join.getTcpIpConfig().setEnabled(false);
    return config;
}
Also used : Config(com.hazelcast.config.Config) NetworkConfig(com.hazelcast.config.NetworkConfig) JoinConfig(com.hazelcast.config.JoinConfig) NetworkConfig(com.hazelcast.config.NetworkConfig) JoinConfig(com.hazelcast.config.JoinConfig)

Example 48 with JoinConfig

use of com.hazelcast.config.JoinConfig in project hazelcast by hazelcast.

the class DefaultAddressPicker method preferIPv4Stack.

private boolean preferIPv4Stack() {
    boolean preferIPv4Stack = Boolean.getBoolean("java.net.preferIPv4Stack") || hazelcastProperties.getBoolean(GroupProperty.PREFER_IPv4_STACK);
    // AWS does not support IPv6
    JoinConfig join = config.getNetworkConfig().getJoin();
    AwsConfig awsConfig = join.getAwsConfig();
    boolean awsEnabled = awsConfig != null && awsConfig.isEnabled();
    return preferIPv4Stack || awsEnabled;
}
Also used : AwsConfig(com.hazelcast.config.AwsConfig) JoinConfig(com.hazelcast.config.JoinConfig)

Example 49 with JoinConfig

use of com.hazelcast.config.JoinConfig in project hazelcast by hazelcast.

the class Node method createJoiner.

Joiner createJoiner() {
    JoinConfig join = config.getNetworkConfig().getJoin();
    join.verify();
    if (properties.getBoolean(DISCOVERY_SPI_ENABLED)) {
        //TODO: Auto-Upgrade Multicast+AWS configuration!
        logger.info("Activating Discovery SPI Joiner");
        return new DiscoveryJoiner(this, discoveryService, properties.getBoolean(DISCOVERY_SPI_PUBLIC_IP_ENABLED));
    } else {
        if (join.getMulticastConfig().isEnabled() && multicastService != null) {
            logger.info("Creating MulticastJoiner");
            return new MulticastJoiner(this);
        } else if (join.getTcpIpConfig().isEnabled()) {
            logger.info("Creating TcpIpJoiner");
            return new TcpIpJoiner(this);
        } else if (join.getAwsConfig().isEnabled()) {
            Class clazz;
            try {
                logger.info("Creating AWSJoiner");
                clazz = Class.forName("com.hazelcast.cluster.impl.TcpIpJoinerOverAWS");
                Constructor constructor = clazz.getConstructor(Node.class);
                return (Joiner) constructor.newInstance(this);
            } catch (Exception e) {
                throw ExceptionUtil.rethrow(e);
            }
        }
    }
    return null;
}
Also used : MulticastJoiner(com.hazelcast.internal.cluster.impl.MulticastJoiner) DiscoveryJoiner(com.hazelcast.internal.cluster.impl.DiscoveryJoiner) Joiner(com.hazelcast.cluster.Joiner) TcpIpJoiner(com.hazelcast.cluster.impl.TcpIpJoiner) Constructor(java.lang.reflect.Constructor) JoinConfig(com.hazelcast.config.JoinConfig) DiscoveryJoiner(com.hazelcast.internal.cluster.impl.DiscoveryJoiner) TcpIpJoiner(com.hazelcast.cluster.impl.TcpIpJoiner) MulticastJoiner(com.hazelcast.internal.cluster.impl.MulticastJoiner)

Example 50 with JoinConfig

use of com.hazelcast.config.JoinConfig in project hazelcast by hazelcast.

the class NodeExtensionTest method getConfig.

protected Config getConfig() {
    Config config = new Config();
    NetworkConfig networkConfig = config.getNetworkConfig();
    JoinConfig join = networkConfig.getJoin();
    join.getMulticastConfig().setEnabled(false);
    return config;
}
Also used : Config(com.hazelcast.config.Config) NetworkConfig(com.hazelcast.config.NetworkConfig) JoinConfig(com.hazelcast.config.JoinConfig) NetworkConfig(com.hazelcast.config.NetworkConfig) JoinConfig(com.hazelcast.config.JoinConfig)

Aggregations

JoinConfig (com.hazelcast.config.JoinConfig)90 Config (com.hazelcast.config.Config)64 NetworkConfig (com.hazelcast.config.NetworkConfig)32 Test (org.junit.Test)32 TcpIpConfig (com.hazelcast.config.TcpIpConfig)27 QuickTest (com.hazelcast.test.annotation.QuickTest)20 InterfacesConfig (com.hazelcast.config.InterfacesConfig)18 HazelcastInstance (com.hazelcast.core.HazelcastInstance)18 MulticastConfig (com.hazelcast.config.MulticastConfig)15 PartitionGroupConfig (com.hazelcast.config.PartitionGroupConfig)15 DiscoveryConfig (com.hazelcast.config.DiscoveryConfig)13 SlowTest (com.hazelcast.test.annotation.SlowTest)12 DiscoveryStrategyConfig (com.hazelcast.config.DiscoveryStrategyConfig)11 RealmConfig (com.hazelcast.config.security.RealmConfig)11 ClientConfig (com.hazelcast.client.config.ClientConfig)9 ListenerConfig (com.hazelcast.config.ListenerConfig)8 AwsConfig (com.hazelcast.config.AwsConfig)7 MemberAttributeConfig (com.hazelcast.config.MemberAttributeConfig)7 ServerSocketEndpointConfig (com.hazelcast.config.ServerSocketEndpointConfig)6 CountDownLatch (java.util.concurrent.CountDownLatch)6