# TransportClient design for Multiple Clusters

**URL:** <https://discuss.elastic.co/t/transportclient-design-for-multiple-clusters/73047>\
**Category:** Elasticsearch\
**Created:** [January 27, 2017, 5:10pm UTC](https://discuss.elastic.co/t/transportclient-design-for-multiple-clusters/73047 "2017-01-27T17:10:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![catdt](https://avatars.discourse-cdn.com/v4/letter/c/898d66/32.png) [@catdt](https://discuss.elastic.co/u/catdt)\
**Post date:** [January 27, 2017, 5:10pm UTC](https://discuss.elastic.co/t/transportclient-design-for-multiple-clusters/73047/1 "2017-01-27T17:10:05Z")

</div>

Hi ES experts,

For a system that you anticipate there will grow in # of clusters, how will you design it in a Machine learning way, that it knows the # of clusters has increased and it will create an additional transport client?

Here is my 1st attempt:

```auto
void config(){
      //create placeholders for setting and transportclient
      List<Setting> = new ArrayList<Setting>();
      List<TransportClient> = new ArrayList<TransportClient>();
      
      //retrieve properties value from config.properties
         PropertiesConfiguration prop = new PropertiesConfiguration("config.properties");
        String[] clusterArray = prop.getStringArray("cluster.name");
      
    //loop through clusterArray and pass setting config to createTransportClient()
     for(String cluster: clusterArray){
         Settings settings = Settings.builder()
        .put("cluster.name", cluster).build();
        
        createTransportClient(setting);
    }
}
void createTransportClient(Setting setting){
      TransportClient client = new PreBuiltTransportClient(settings);
}

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 24, 2017, 5:10pm UTC](https://discuss.elastic.co/t/transportclient-design-for-multiple-clusters/73047/2 "2017-02-24T17:10:14Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
