Package org.elasticsearch.common.transport

Examples of org.elasticsearch.common.transport.InetSocketTransportAddress


                } catch(NumberFormatException e) {
                    logger.warn("Unable to parse port [{}]", splitAddress[1], e);
                }
            }

            transportAddresses[i] = new InetSocketTransportAddress(host, port);
        }
        return newTransportClient(transportAddresses);
    }
View Full Code Here


                String[] parts = hostname.split(":");
                int port = 9300;
                if (parts.length == 2) {
                    port = Integer.parseInt(parts[1]);
                }
                client.addTransportAddress(new InetSocketTransportAddress(parts[0], port));
            }
        }

        elasticSearchClient.admin().cluster().prepareHealth()
                .setWaitForYellowStatus()
View Full Code Here

                    .put("client.transport.ignore_cluster_name", false)
                    .put("node.client", true)
                    .put("client.transport.sniff", true)
                    .build();
            Client client = new TransportClient(settings)
                    .addTransportAddress(new InetSocketTransportAddress(configuration.getIp(), configuration.getPort()));
            this.client = client;
        } else {
            node = configuration.buildNode();
            client = node.client();
        }
View Full Code Here

    public static void main(String[] args) throws Exception {
        new LogfileStreamer().run();
    }

    public LogfileStreamer() {
        client = new TransportClient(ImmutableSettings.settingsBuilder().put("cluster.name", clusterName).build()).addTransportAddress(new
                InetSocketTransportAddress("localhost", 9300));
        reset();
    }
View Full Code Here

      logger.debug("bindAddress " + bindAddress);
      logger.debug("publishAddress " + publishAddress);

      boundAddress = new BoundTransportAddress(
          new InetSocketTransportAddress(bindAddress),
          new InetSocketTransportAddress(publishAddress));

    } catch (final Exception e) {
      throw new ElasticsearchException("Unable to start Tomcat", e);
    }
View Full Code Here

                        .build();
        elasticsearchEndpoint = configuration.ELASTICSEARCH_ENDPOINT;
        elasticsearchPort = configuration.ELASTICSEARCH_PORT;
        LOG.info("ElasticsearchEmitter using elasticsearch endpoint " + elasticsearchEndpoint + ":" + elasticsearchPort);
        elasticsearchClient = new TransportClient(settings);
        elasticsearchClient.addTransportAddress(new InetSocketTransportAddress(elasticsearchEndpoint, elasticsearchPort));
    }
View Full Code Here

        TransportClient transportClient = new TransportClient( settings );
        for ( String node : nodes ) {
            String[] split = node.split( ":" );
            String host = split[0];
            int port = Integer.valueOf( split[1] );
            transportClient.addTransportAddress( new InetSocketTransportAddress( host, port ) );
        }

        client = transportClient;
    }
View Full Code Here

    port = job.getInt(ElasticConstants.PORT, -1);
   
    // Prefer TransportClient
    if (host != null && port > 1) {
      Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", clusterName).build();
      client = new TransportClient(settings).addTransportAddress(new InetSocketTransportAddress(host, port));
    } else if (clusterName != null) {
      node = nodeBuilder().clusterName(clusterName).client(true).node();
      client = node.client();
    }
View Full Code Here

        try {
            publishAddress = new InetSocketAddress(networkService.resolvePublishHostAddress(publishHost), boundAddress.getPort());
        } catch (Exception e) {
            throw new BindTransportException("Failed to resolve publish address", e);
        }
        this.boundAddress = new BoundTransportAddress(new InetSocketTransportAddress(boundAddress), new InetSocketTransportAddress(publishAddress));
    }
View Full Code Here

            Set<String> ports = Strings.commaDelimitedListToSet(address.substring(index + 1, address.indexOf(']')));
            List<TransportAddress> addresses = Lists.newArrayList();
            for (String port : ports) {
                int[] iPorts = new PortsRange(port).ports();
                for (int iPort : iPorts) {
                    addresses.add(new InetSocketTransportAddress(host, iPort));
                }
            }
            return addresses.toArray(new TransportAddress[addresses.size()]);
        } else {
            index = address.lastIndexOf(':');
            if (index == -1) {
                List<TransportAddress> addresses = Lists.newArrayList();
                int[] iPorts = new PortsRange(this.port).ports();
                for (int iPort : iPorts) {
                    addresses.add(new InetSocketTransportAddress(address, iPort));
                }
                return addresses.toArray(new TransportAddress[addresses.size()]);
            } else {
                String host = address.substring(0, index);
                int port = Integer.parseInt(address.substring(index + 1));
                return new TransportAddress[]{new InetSocketTransportAddress(host, port)};
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.elasticsearch.common.transport.InetSocketTransportAddress

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.