Package org.elasticsearch.common.transport

Examples of org.elasticsearch.common.transport.InetSocketTransportAddress


        sPort = hostPort[1];
 
        Builder globalSettings = ImmutableSettings.settingsBuilder();
        Settings snode = globalSettings.put("cluster.name", _clusterName).build();
        TransportClient tmp = new TransportClient(snode);
        _elasticClient = new CrossVersionClient(tmp.addTransportAddress(new InetSocketTransportAddress(sHostname, Integer.parseInt(sPort))));
      }
     
    } //TESTED
    else { // Create a "no data" cluster
     
View Full Code Here


    }

    public static Client createClient(String cluster, String url, int port) {
        Settings s = ImmutableSettings.settingsBuilder().put("cluster.name", cluster).build();
        TransportClient tmp = new TransportClient(s);
        tmp.addTransportAddress(new InetSocketTransportAddress(url, port));
        return tmp;
    }
View Full Code Here

        TransportClient tc = new TransportClient(settings);
        for (String host : hosts) {
            String[] parts = host.split(":");
            String address = parts[0];
            Integer port = Integer.parseInt(parts[1]);
            tc.addTransportAddress(new InetSocketTransportAddress(address, port));
        }
        client = tc;
    }
View Full Code Here

                nodeBuilder().client(true).node().close();
            }
        });

        final Client client = new TransportClient()
                .addTransportAddress(new InetSocketTransportAddress(
                        config.getString("restopengov.elasticsearch-host"),
                        config.getInt("restopengov.elasticsearch-port")));


        if(args[0].equals("ckan")) {
View Full Code Here

          throw new RuntimeException("Invalid Host: " + host);
        }
        Logger.info("Transport Client - Host: %s Port: %s", parts[0], parts[1]);
        if (Integer.valueOf(parts[1]) == 9200)
          Logger.info("Note: Port 9200 is usually used by the HTTP Transport. You might want to use 9300 instead.");
        c.addTransportAddress(new InetSocketTransportAddress(parts[0], Integer.valueOf(parts[1])));
        done = true;
      }
      if (done == false) {
        throw new RuntimeException("No Hosts Provided for Elastic Search!");
      }
View Full Code Here

                String[] split = address.split(":");

                String hostname = split[0];
                int port = (split.length == 1 ? 9300 : Integer.getInteger(split[1]));

                transportAddresses.add(new InetSocketTransportAddress(hostname, port));
            }
        }

        // Recall super method to get any additional addresses
        super.initTransportAddresses(config);
View Full Code Here

                JsonObject transportAddress = jsonArray.get(i);
                String hostname = transportAddress.getString(CONFIG_HOSTNAME);

                if (hostname != null && !hostname.isEmpty()) {
                    int port = transportAddress.getInteger(CONFIG_PORT, 9300);
                    transportAddresses.add(new InetSocketTransportAddress(hostname, port));
                }
            }
        }

        // If no addresses are configured, add local host on the default port
        if (transportAddresses.size() == 0) {
            transportAddresses.add(new InetSocketTransportAddress("localhost", 9300));
        }

    }
View Full Code Here

        createIndex(Config.APP_NAME_NS);
      }
    } else {
      searchClient = new TransportClient();
        ((TransportClient) searchClient).addTransportAddress(
            new InetSocketTransportAddress("localhost", 9300));
    }

    Para.addDestroyListener(new Para.DestroyListener() {
      public void onDestroy() {
        shutdownClient();
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

      }
      if (Utils.isEmpty(a.get("port"))) {
        throw new SettingsException(
            "es_connection/addresses/port element of configuration structure not found or is empty");
      }
      transportAddresses[i++] = new InetSocketTransportAddress((String) a.get("host"), Utils.nodeIntegerValue(a
          .get("port")));
    }

    settingsConf = (Map<String, String>) sourceClientSettings.get("settings");
    if (settingsConf == null) {
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.