Search in sources :

Example 6 with EndpointConfig

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

the class DefaultAddressPicker method getPublicAddressByPortSearch.

private AddressDefinition getPublicAddressByPortSearch() throws IOException {
    boolean bindAny = hazelcastProperties.getBoolean(ClusterProperty.SOCKET_SERVER_BIND_ANY);
    AddressDefinition bindAddressDef = pickAddressDef();
    EndpointConfig endpoint = config.getAdvancedNetworkConfig().isEnabled() ? config.getAdvancedNetworkConfig().getEndpointConfigs().get(endpointQualifier) : null;
    serverSocketChannel = createServerSocketChannel(logger, endpoint, bindAddressDef.inetAddress, bindAddressDef.port == 0 ? port : bindAddressDef.port, portCount, isPortAutoIncrement, isReuseAddress, bindAny);
    int port = serverSocketChannel.socket().getLocalPort();
    bindAddress = createAddress(bindAddressDef, port);
    if (logger.isFineEnabled()) {
        logger.fine("Picked " + bindAddress + (endpointQualifier == null ? "" : ", for endpoint " + endpointQualifier) + ", using socket " + serverSocketChannel.socket() + ", bind any local is " + bindAny);
    }
    return getPublicAddress(port);
}
Also used : EndpointConfig(com.hazelcast.config.EndpointConfig)

Example 7 with EndpointConfig

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

the class DelegatingAddressPicker method pickAddressFromEndpointConfig.

private void pickAddressFromEndpointConfig() {
    InetSocketAddress bindAddress;
    InetSocketAddress publicAddress;
    ServerSocketChannel serverSocketChannel;
    for (EndpointConfig config : config.getAdvancedNetworkConfig().getEndpointConfigs().values()) {
        if (!(config instanceof ServerSocketEndpointConfig)) {
            continue;
        }
        ServerSocketEndpointConfig endpointConfig = (ServerSocketEndpointConfig) config;
        EndpointQualifier qualifier = endpointConfig.getQualifier();
        bindAddress = memberAddressProvider.getBindAddress(qualifier);
        publicAddress = memberAddressProvider.getPublicAddress(qualifier);
        validatePublicAddress(publicAddress);
        if (!bindAddresses.values().contains(bindAddress)) {
            // bind new server socket
            serverSocketChannel = createServerSocketChannel(logger, config, bindAddress.getAddress(), bindAddress.getPort() == 0 ? endpointConfig.getPort() : bindAddress.getPort(), endpointConfig.getPortCount(), endpointConfig.isPortAutoIncrement(), endpointConfig.isReuseAddress(), false);
            serverSocketChannels.put(qualifier, serverSocketChannel);
            int port = serverSocketChannel.socket().getLocalPort();
            if (port != bindAddress.getPort()) {
                bindAddress = new InetSocketAddress(bindAddress.getAddress(), port);
            }
            if (publicAddress.getPort() == 0) {
                publicAddress = new InetSocketAddress(publicAddress.getAddress(), port);
            }
        }
        logger.info("Using bind address: " + bindAddress + ", " + "public address: " + publicAddress + " for qualifier " + qualifier);
        bindAddresses.put(qualifier, bindAddress);
        publicAddresses.put(qualifier, publicAddress);
    }
}
Also used : InetSocketAddress(java.net.InetSocketAddress) EndpointQualifier(com.hazelcast.instance.EndpointQualifier) ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig) ServerSocketChannel(java.nio.channels.ServerSocketChannel) ServerSocketHelper.createServerSocketChannel(com.hazelcast.instance.impl.ServerSocketHelper.createServerSocketChannel) EndpointConfig(com.hazelcast.config.EndpointConfig) ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig)

Example 8 with EndpointConfig

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

the class MemberDomConfigProcessor method handleWanEndpointConfig.

protected void handleWanEndpointConfig(Node node) throws Exception {
    EndpointConfig config = new EndpointConfig();
    config.setProtocolType(ProtocolType.WAN);
    handleEndpointConfig(config, node);
}
Also used : ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig) RestServerEndpointConfig(com.hazelcast.config.RestServerEndpointConfig) EndpointConfig(com.hazelcast.config.EndpointConfig)

Example 9 with EndpointConfig

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

the class ConfigValidator method warnForUsageOfDeprecatedSymmetricEncryption.

public static void warnForUsageOfDeprecatedSymmetricEncryption(Config config, ILogger logger) {
    String warn = "Symmetric encryption is deprecated and will be removed in a future version. Consider using TLS instead.";
    boolean usesAdvancedNetworkConfig = config.getAdvancedNetworkConfig().isEnabled();
    if (config.getNetworkConfig() != null && config.getNetworkConfig().getSymmetricEncryptionConfig() != null && config.getNetworkConfig().getSymmetricEncryptionConfig().isEnabled() && !usesAdvancedNetworkConfig) {
        logger.warning(warn);
    }
    if (config.getAdvancedNetworkConfig() != null && config.getAdvancedNetworkConfig().getEndpointConfigs() != null && usesAdvancedNetworkConfig) {
        for (EndpointConfig endpointConfig : config.getAdvancedNetworkConfig().getEndpointConfigs().values()) {
            if (endpointConfig.getSymmetricEncryptionConfig() != null && endpointConfig.getSymmetricEncryptionConfig().isEnabled()) {
                logger.warning(warn);
                // Write error message once if more than one endpoint use symmetric encryption
                break;
            }
        }
    }
}
Also used : EndpointConfig(com.hazelcast.config.EndpointConfig) ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig)

Example 10 with EndpointConfig

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

the class YamlMemberDomConfigProcessor method handleWanEndpointConfig.

@Override
protected void handleWanEndpointConfig(Node node) throws Exception {
    for (Node wanEndpointNode : childElements(node)) {
        EndpointConfig config = new EndpointConfig();
        config.setProtocolType(ProtocolType.WAN);
        String endpointName = wanEndpointNode.getNodeName().trim();
        handleEndpointConfig(config, wanEndpointNode, endpointName);
    }
}
Also used : Node(org.w3c.dom.Node) YamlNode(com.hazelcast.internal.yaml.YamlNode) EndpointConfig(com.hazelcast.config.EndpointConfig) ServerSocketEndpointConfig(com.hazelcast.config.ServerSocketEndpointConfig)

Aggregations

EndpointConfig (com.hazelcast.config.EndpointConfig)11 ServerSocketEndpointConfig (com.hazelcast.config.ServerSocketEndpointConfig)6 EndpointQualifier (com.hazelcast.instance.EndpointQualifier)5 AdvancedNetworkConfig (com.hazelcast.config.AdvancedNetworkConfig)4 RestServerEndpointConfig (com.hazelcast.config.RestServerEndpointConfig)3 WanBatchPublisherConfig (com.hazelcast.config.WanBatchPublisherConfig)2 WanReplicationConfig (com.hazelcast.config.WanReplicationConfig)2 AuditlogConfig (com.hazelcast.config.AuditlogConfig)1 Config (com.hazelcast.config.Config)1 EncryptionAtRestConfig (com.hazelcast.config.EncryptionAtRestConfig)1 InvalidConfigurationException (com.hazelcast.config.InvalidConfigurationException)1 MemberAddressProviderConfig (com.hazelcast.config.MemberAddressProviderConfig)1 NetworkConfig (com.hazelcast.config.NetworkConfig)1 PersistenceConfig (com.hazelcast.config.PersistenceConfig)1 SSLConfig (com.hazelcast.config.SSLConfig)1 SecurityConfig (com.hazelcast.config.SecurityConfig)1 TcpIpConfig (com.hazelcast.config.TcpIpConfig)1 ProtocolType (com.hazelcast.instance.ProtocolType)1 ServerSocketHelper.createServerSocketChannel (com.hazelcast.instance.impl.ServerSocketHelper.createServerSocketChannel)1 ChannelInitializer (com.hazelcast.internal.networking.ChannelInitializer)1