# Separate XtraDB Clusters managed via HAProxy?

**URL:** <https://forums.percona.com/t/separate-xtradb-clusters-managed-via-haproxy/3047>\
**Category:** Percona XtraDB Cluster 5.x\
**Created:** [October 29, 2013, 1:07pm UTC](https://forums.percona.com/t/separate-xtradb-clusters-managed-via-haproxy/3047 "2013-10-29T13:07:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmollet](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@cmollet](https://forums.percona.com/u/cmollet)\
**Post date:** [October 29, 2013, 1:07pm UTC](https://forums.percona.com/t/separate-xtradb-clusters-managed-via-haproxy/3047/1 "2013-10-29T13:07:29Z")

</div>

I’d like to use HAProxy to direct traffic between completely separate MySQL environments within 1 HAProxy installation, but without having to deviate from the standard port.

Is it possible for HAProxy to direct TCP traffic on multiple addresses but on the same port?

When I try the config below, I get a “cannot bind socket” error, as the address/port is already being used.

In TCP mode, can haproxy distinguish between hostnames?

Thanks in advance!

Example:

#-------------------

# PRODUCTION CLUSTER

#-------------------  
listen prod\_cluster  
bind [production.example.com:3306](http://production.example.com:3306)  
mode tcp  
balance roundrobin  
option httpchk

server prodDB1 [proddb1.example.com:3306](http://proddb1.example.com:3306) check port 9200 inter 2000 rise 3 fall 3  
server prodDB2 [proddb2.example.com:3306](http://proddb2.example.com:3306) check port 9200 inter 2000 rise 3 fall 3 backup  
server prodDB3 [proddb3.example.com:3306](http://proddb3.example.com:3306) check port 9200 inter 2000 rise 3 fall 3 backup

​  
#-------------------

# STAGE CLUSTER

#-------------------  
listen stage\_cluster  
bind [staging.example.com:3306](http://staging.example.com:3306)  
mode tcp  
balance roundrobin  
option httpchk

server stageDB1 [stagedb1.example.com:3306](http://stagedb1.example.com:3306) check port 9200 inter 2000 rise 3 fall 3  
server stageDB2 [stagedb2.example.com:3306](http://stagedb2.example.com:3306) check port 9200 inter 2000 rise 3 fall 3 backup  
server stageDB3 [stagedb3.example.com:3306](http://stagedb3.example.com:3306) check port 9200 inter 2000 rise 3 fall 3 backup

​

---

<div class="post-metadata">

**Author:** ![ashokkumar2003](https://avatars.discourse-cdn.com/v4/letter/a/a698b9/32.png) [@ashokkumar2003](https://forums.percona.com/u/ashokkumar2003)\
**Post date:** [November 6, 2013, 12:47am UTC](https://forums.percona.com/t/separate-xtradb-clusters-managed-via-haproxy/3047/2 "2013-11-06T00:47:28Z")

</div>

1. You can not do HA proxy port3306 on same servers which running one cluster server. You need to assigned different port to HAproxy.

2. You can use same port3306 in HAProxy if you are running HAproxy on different servers.

---

<div class="post-metadata">

**Author:** ![marko\_s](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@marko\_s](https://forums.percona.com/u/marko_s)\
**Post date:** [November 7, 2013, 1:48am UTC](https://forums.percona.com/t/separate-xtradb-clusters-managed-via-haproxy/3047/3 "2013-11-07T01:48:48Z")

</div>

Did you try binding pure IP address (not FQDN)?
