ERROR 2013 when connecting to mysql via HAProxyHaProxy + IIS pages gradually get slowerHaProxy - Http and SSL pass through configHAProxy, client timeouts when connecting from JDBC poolHaproxy logging not workHA-Proxy 301 re-direct: https to https://wwwHaProxy giving - 503 Service UnavailableHAProxy not logging all requestsRedis & HAProxy - updated configuration settings?SASL auth to LDAP behind HAPROXY with name mismatchesopenldap with haproxy - (ldap_result() failed: Can't contact LDAP server)

Should I move out from my current apartment before the contract ends to save more money?

Why not make one big cpu core?

Does PC weight have a mechanical effect?

Reflecting Telescope Blind Spot?

How long would it take for sucrose to undergo hydrolysis in boiling water?

Co-worker is now managing my team, does this mean that I'm being demoted?

Relationship between a determinant and the roots of a cubic equation

Why is gun control associated with the socially liberal Democratic party?

100-doors puzzle

Approach sick days in feedback meeting

...and then she held the gun

Can an escape pod land on Earth from orbit and not be immediately detected?

How did the European Union reach the figure of 3% as a maximum allowed deficit?

Is it possible to install Firefox on Ubuntu with no desktop enviroment?

How can I find out about the game world without meta-influencing it?

Is there an easy way to remember if you add magnetic declination to magnetic bearings or true bearings?

Why is Skinner so awkward in Hot Fuzz?

What did the 8086 (and 8088) do upon encountering an illegal instruction?

How can religions without a hell discourage evil-doing?

How to search for Android apps without ads?

The title "Mord mit Aussicht" explained

How can I detect if I'm in a subshell?

My players want to use called-shots on Strahd

mathrm in LaTeX



ERROR 2013 when connecting to mysql via HAProxy


HaProxy + IIS pages gradually get slowerHaProxy - Http and SSL pass through configHAProxy, client timeouts when connecting from JDBC poolHaproxy logging not workHA-Proxy 301 re-direct: https to https://wwwHaProxy giving - 503 Service UnavailableHAProxy not logging all requestsRedis & HAProxy - updated configuration settings?SASL auth to LDAP behind HAPROXY with name mismatchesopenldap with haproxy - (ldap_result() failed: Can't contact LDAP server)






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








6















I am trying to use HAProxy as a load balancer for 2 mysql nodes. I have HAProxy listening on 3307 and it routes requests to the DBs on 3306. When the client is trying to connect to the Proxy (mysql -u ... -h .. -P3307 -p...) it gets the following error:




ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system >error: 0




When the client is trying to connect directly to the DB it works fine. I have no idea why its failing when traffic goes via the Proxy.



Here's what I've already checked:



  1. /etc/hosts.allow includes "mysqld: ALL : allow "


  2. MySQL config file (my.cnf) doesn't have a bind address line (open to
    all).


I am using HAProxy 1.5dev, Mysql 5.1.x and the whole enchilada is running in ec2 on Amazon linux.



Here's the HAProxy config file:



 global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
user haproxy
group haproxy
maxconn 4096
daemon
#debug
#quiet

defaults
log global
mode tcp
option tcplog
option dontlognull
retries 3
option redispatch
maxconn 4096
contimeout 5000
clitimeout 50000
srvtimeout 50000

frontend mysql_cluster
bind 10.0.0.150:3307
default_backend mysql_cluster

backend mysql_cluster
mode tcp
balance roundrobin
option tcpka
option httpchk
server lb1 10.0.0.140:3306 check port 9200 inter 5s rise 2 fall 2
server lb2 10.0.0.214:3306 check port 9200 inter 5s rise 2 fall 2

listen stats 10.0.0.150:8081
mode http
option httpclose
balance roundrobin
stats uri /
stats realm Haproxy Statistics
stats auth ***:***


Has anyone tackled this problem before? Any ideas how to solve this?



Any help much appreciated










share|improve this question













migrated from stackoverflow.com Sep 29 '11 at 11:28


This question came from our site for professional and enthusiast programmers.


















  • Can you add your haproxy config file?

    – James Little
    Sep 28 '11 at 20:02











  • Are you running replication or anything like that on MySQL? How are they in sync to load balance between them?

    – Paul Kroon
    Sep 29 '11 at 18:20











  • Paul - DB instances are synced using drbd

    – A.RG
    Sep 30 '11 at 0:01











  • probably a red herring, but you don't need the option httpchk on a tcp backend, also in my own config I've commented out the option tcpka line. It was long enough ago that I can't remember why :)

    – Richard Benson
    Sep 30 '11 at 9:51

















6















I am trying to use HAProxy as a load balancer for 2 mysql nodes. I have HAProxy listening on 3307 and it routes requests to the DBs on 3306. When the client is trying to connect to the Proxy (mysql -u ... -h .. -P3307 -p...) it gets the following error:




ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system >error: 0




When the client is trying to connect directly to the DB it works fine. I have no idea why its failing when traffic goes via the Proxy.



Here's what I've already checked:



  1. /etc/hosts.allow includes "mysqld: ALL : allow "


  2. MySQL config file (my.cnf) doesn't have a bind address line (open to
    all).


I am using HAProxy 1.5dev, Mysql 5.1.x and the whole enchilada is running in ec2 on Amazon linux.



Here's the HAProxy config file:



 global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
user haproxy
group haproxy
maxconn 4096
daemon
#debug
#quiet

defaults
log global
mode tcp
option tcplog
option dontlognull
retries 3
option redispatch
maxconn 4096
contimeout 5000
clitimeout 50000
srvtimeout 50000

frontend mysql_cluster
bind 10.0.0.150:3307
default_backend mysql_cluster

backend mysql_cluster
mode tcp
balance roundrobin
option tcpka
option httpchk
server lb1 10.0.0.140:3306 check port 9200 inter 5s rise 2 fall 2
server lb2 10.0.0.214:3306 check port 9200 inter 5s rise 2 fall 2

listen stats 10.0.0.150:8081
mode http
option httpclose
balance roundrobin
stats uri /
stats realm Haproxy Statistics
stats auth ***:***


Has anyone tackled this problem before? Any ideas how to solve this?



Any help much appreciated










share|improve this question













migrated from stackoverflow.com Sep 29 '11 at 11:28


This question came from our site for professional and enthusiast programmers.


















  • Can you add your haproxy config file?

    – James Little
    Sep 28 '11 at 20:02











  • Are you running replication or anything like that on MySQL? How are they in sync to load balance between them?

    – Paul Kroon
    Sep 29 '11 at 18:20











  • Paul - DB instances are synced using drbd

    – A.RG
    Sep 30 '11 at 0:01











  • probably a red herring, but you don't need the option httpchk on a tcp backend, also in my own config I've commented out the option tcpka line. It was long enough ago that I can't remember why :)

    – Richard Benson
    Sep 30 '11 at 9:51













6












6








6








I am trying to use HAProxy as a load balancer for 2 mysql nodes. I have HAProxy listening on 3307 and it routes requests to the DBs on 3306. When the client is trying to connect to the Proxy (mysql -u ... -h .. -P3307 -p...) it gets the following error:




ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system >error: 0




When the client is trying to connect directly to the DB it works fine. I have no idea why its failing when traffic goes via the Proxy.



Here's what I've already checked:



  1. /etc/hosts.allow includes "mysqld: ALL : allow "


  2. MySQL config file (my.cnf) doesn't have a bind address line (open to
    all).


I am using HAProxy 1.5dev, Mysql 5.1.x and the whole enchilada is running in ec2 on Amazon linux.



Here's the HAProxy config file:



 global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
user haproxy
group haproxy
maxconn 4096
daemon
#debug
#quiet

defaults
log global
mode tcp
option tcplog
option dontlognull
retries 3
option redispatch
maxconn 4096
contimeout 5000
clitimeout 50000
srvtimeout 50000

frontend mysql_cluster
bind 10.0.0.150:3307
default_backend mysql_cluster

backend mysql_cluster
mode tcp
balance roundrobin
option tcpka
option httpchk
server lb1 10.0.0.140:3306 check port 9200 inter 5s rise 2 fall 2
server lb2 10.0.0.214:3306 check port 9200 inter 5s rise 2 fall 2

listen stats 10.0.0.150:8081
mode http
option httpclose
balance roundrobin
stats uri /
stats realm Haproxy Statistics
stats auth ***:***


Has anyone tackled this problem before? Any ideas how to solve this?



Any help much appreciated










share|improve this question














I am trying to use HAProxy as a load balancer for 2 mysql nodes. I have HAProxy listening on 3307 and it routes requests to the DBs on 3306. When the client is trying to connect to the Proxy (mysql -u ... -h .. -P3307 -p...) it gets the following error:




ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system >error: 0




When the client is trying to connect directly to the DB it works fine. I have no idea why its failing when traffic goes via the Proxy.



Here's what I've already checked:



  1. /etc/hosts.allow includes "mysqld: ALL : allow "


  2. MySQL config file (my.cnf) doesn't have a bind address line (open to
    all).


I am using HAProxy 1.5dev, Mysql 5.1.x and the whole enchilada is running in ec2 on Amazon linux.



Here's the HAProxy config file:



 global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
#log loghost local0 info
user haproxy
group haproxy
maxconn 4096
daemon
#debug
#quiet

defaults
log global
mode tcp
option tcplog
option dontlognull
retries 3
option redispatch
maxconn 4096
contimeout 5000
clitimeout 50000
srvtimeout 50000

frontend mysql_cluster
bind 10.0.0.150:3307
default_backend mysql_cluster

backend mysql_cluster
mode tcp
balance roundrobin
option tcpka
option httpchk
server lb1 10.0.0.140:3306 check port 9200 inter 5s rise 2 fall 2
server lb2 10.0.0.214:3306 check port 9200 inter 5s rise 2 fall 2

listen stats 10.0.0.150:8081
mode http
option httpclose
balance roundrobin
stats uri /
stats realm Haproxy Statistics
stats auth ***:***


Has anyone tackled this problem before? Any ideas how to solve this?



Any help much appreciated







mysql haproxy






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Sep 28 '11 at 19:25









A.RGA.RG

5624




5624




migrated from stackoverflow.com Sep 29 '11 at 11:28


This question came from our site for professional and enthusiast programmers.









migrated from stackoverflow.com Sep 29 '11 at 11:28


This question came from our site for professional and enthusiast programmers.














  • Can you add your haproxy config file?

    – James Little
    Sep 28 '11 at 20:02











  • Are you running replication or anything like that on MySQL? How are they in sync to load balance between them?

    – Paul Kroon
    Sep 29 '11 at 18:20











  • Paul - DB instances are synced using drbd

    – A.RG
    Sep 30 '11 at 0:01











  • probably a red herring, but you don't need the option httpchk on a tcp backend, also in my own config I've commented out the option tcpka line. It was long enough ago that I can't remember why :)

    – Richard Benson
    Sep 30 '11 at 9:51

















  • Can you add your haproxy config file?

    – James Little
    Sep 28 '11 at 20:02











  • Are you running replication or anything like that on MySQL? How are they in sync to load balance between them?

    – Paul Kroon
    Sep 29 '11 at 18:20











  • Paul - DB instances are synced using drbd

    – A.RG
    Sep 30 '11 at 0:01











  • probably a red herring, but you don't need the option httpchk on a tcp backend, also in my own config I've commented out the option tcpka line. It was long enough ago that I can't remember why :)

    – Richard Benson
    Sep 30 '11 at 9:51
















Can you add your haproxy config file?

– James Little
Sep 28 '11 at 20:02





Can you add your haproxy config file?

– James Little
Sep 28 '11 at 20:02













Are you running replication or anything like that on MySQL? How are they in sync to load balance between them?

– Paul Kroon
Sep 29 '11 at 18:20





Are you running replication or anything like that on MySQL? How are they in sync to load balance between them?

– Paul Kroon
Sep 29 '11 at 18:20













Paul - DB instances are synced using drbd

– A.RG
Sep 30 '11 at 0:01





Paul - DB instances are synced using drbd

– A.RG
Sep 30 '11 at 0:01













probably a red herring, but you don't need the option httpchk on a tcp backend, also in my own config I've commented out the option tcpka line. It was long enough ago that I can't remember why :)

– Richard Benson
Sep 30 '11 at 9:51





probably a red herring, but you don't need the option httpchk on a tcp backend, also in my own config I've commented out the option tcpka line. It was long enough ago that I can't remember why :)

– Richard Benson
Sep 30 '11 at 9:51










4 Answers
4






active

oldest

votes


















2














OK, I solved it. I had a problem with my xinetd script.



It failed to bind on 9200 - fixed it in /etc/services file.






share|improve this answer






























    0














    It usually occurs when your xinetd health check service responses error.

    you can debug xinetd by telnet like this:



    telnet IPADDR PORT # IPADDR: one of the IPs of your nodes
    # PORT: the port that node is listening.


    the output tells you about the problem.






    share|improve this answer






























      0














      On my setup, I wasnt running xinetd, but found that the mysql-check option was causing issues. So I was at least able to get haproxy up and running by commenting it out. I suspect that mysql-check has something to do with either wrong mysql user being used or missing grants.






      share|improve this answer






























        -1














        Thanks dear , great,



        HAproxy need xinetd to be configured properly to work else below error appears ,



        ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0



        Xinetd to be restated if running already .



        https://docs.openstack.org/ha-guide/shared-database-manage.html






        share|improve this answer























          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "2"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f316788%2ferror-2013-when-connecting-to-mysql-via-haproxy%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          4 Answers
          4






          active

          oldest

          votes








          4 Answers
          4






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          OK, I solved it. I had a problem with my xinetd script.



          It failed to bind on 9200 - fixed it in /etc/services file.






          share|improve this answer



























            2














            OK, I solved it. I had a problem with my xinetd script.



            It failed to bind on 9200 - fixed it in /etc/services file.






            share|improve this answer

























              2












              2








              2







              OK, I solved it. I had a problem with my xinetd script.



              It failed to bind on 9200 - fixed it in /etc/services file.






              share|improve this answer













              OK, I solved it. I had a problem with my xinetd script.



              It failed to bind on 9200 - fixed it in /etc/services file.







              share|improve this answer












              share|improve this answer



              share|improve this answer










              answered Sep 30 '11 at 23:01









              A.RGA.RG

              5624




              5624























                  0














                  It usually occurs when your xinetd health check service responses error.

                  you can debug xinetd by telnet like this:



                  telnet IPADDR PORT # IPADDR: one of the IPs of your nodes
                  # PORT: the port that node is listening.


                  the output tells you about the problem.






                  share|improve this answer



























                    0














                    It usually occurs when your xinetd health check service responses error.

                    you can debug xinetd by telnet like this:



                    telnet IPADDR PORT # IPADDR: one of the IPs of your nodes
                    # PORT: the port that node is listening.


                    the output tells you about the problem.






                    share|improve this answer

























                      0












                      0








                      0







                      It usually occurs when your xinetd health check service responses error.

                      you can debug xinetd by telnet like this:



                      telnet IPADDR PORT # IPADDR: one of the IPs of your nodes
                      # PORT: the port that node is listening.


                      the output tells you about the problem.






                      share|improve this answer













                      It usually occurs when your xinetd health check service responses error.

                      you can debug xinetd by telnet like this:



                      telnet IPADDR PORT # IPADDR: one of the IPs of your nodes
                      # PORT: the port that node is listening.


                      the output tells you about the problem.







                      share|improve this answer












                      share|improve this answer



                      share|improve this answer










                      answered Jun 20 '17 at 12:11









                      Ghasem PahlavanGhasem Pahlavan

                      13219




                      13219





















                          0














                          On my setup, I wasnt running xinetd, but found that the mysql-check option was causing issues. So I was at least able to get haproxy up and running by commenting it out. I suspect that mysql-check has something to do with either wrong mysql user being used or missing grants.






                          share|improve this answer



























                            0














                            On my setup, I wasnt running xinetd, but found that the mysql-check option was causing issues. So I was at least able to get haproxy up and running by commenting it out. I suspect that mysql-check has something to do with either wrong mysql user being used or missing grants.






                            share|improve this answer

























                              0












                              0








                              0







                              On my setup, I wasnt running xinetd, but found that the mysql-check option was causing issues. So I was at least able to get haproxy up and running by commenting it out. I suspect that mysql-check has something to do with either wrong mysql user being used or missing grants.






                              share|improve this answer













                              On my setup, I wasnt running xinetd, but found that the mysql-check option was causing issues. So I was at least able to get haproxy up and running by commenting it out. I suspect that mysql-check has something to do with either wrong mysql user being used or missing grants.







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered May 30 at 13:43









                              ChristianChristian

                              1011




                              1011





















                                  -1














                                  Thanks dear , great,



                                  HAproxy need xinetd to be configured properly to work else below error appears ,



                                  ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0



                                  Xinetd to be restated if running already .



                                  https://docs.openstack.org/ha-guide/shared-database-manage.html






                                  share|improve this answer



























                                    -1














                                    Thanks dear , great,



                                    HAproxy need xinetd to be configured properly to work else below error appears ,



                                    ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0



                                    Xinetd to be restated if running already .



                                    https://docs.openstack.org/ha-guide/shared-database-manage.html






                                    share|improve this answer

























                                      -1












                                      -1








                                      -1







                                      Thanks dear , great,



                                      HAproxy need xinetd to be configured properly to work else below error appears ,



                                      ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0



                                      Xinetd to be restated if running already .



                                      https://docs.openstack.org/ha-guide/shared-database-manage.html






                                      share|improve this answer













                                      Thanks dear , great,



                                      HAproxy need xinetd to be configured properly to work else below error appears ,



                                      ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 0



                                      Xinetd to be restated if running already .



                                      https://docs.openstack.org/ha-guide/shared-database-manage.html







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Jun 1 '17 at 4:51









                                      Sainudheen SahibSainudheen Sahib

                                      1




                                      1



























                                          draft saved

                                          draft discarded
















































                                          Thanks for contributing an answer to Server Fault!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid


                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.

                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function ()
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f316788%2ferror-2013-when-connecting-to-mysql-via-haproxy%23new-answer', 'question_page');

                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          How to write a 12-bar blues melodyI-IV-V blues progressionHow to play the bridges in a standard blues progressionHow does Gdim7 fit in C# minor?question on a certain chord progressionMusicology of Melody12 bar blues, spread rhythm: alternative to 6th chord to avoid finger stretchChord progressions/ Root key/ MelodiesHow to put chords (POP-EDM) under a given lead vocal melody (starting from a good knowledge in music theory)Are there “rules” for improvising with the minor pentatonic scale over 12-bar shuffle?Confusion about blues scale and chords

                                          What if the end-user didn't have the required library?What is setup.py?What is a clean, pythonic way to have multiple constructors in Python?What does Ruby have that Python doesn't, and vice versa?What is the reason for having '//' in Python?How do I create a namespace package in Python?How to package shared objects that python modules depend on?setuptools vs. distutils: why is distutils still a thing?Navigation in Windows 10 vs code not going to virtualenv library when the same library is installed at user levelPython create package for local usePackaging a project that uses multiple python versionsWhy is permission denied on pip install except for when “--user” is included at end of command?

                                          Why did Thanos need his ship to help him in the battle scene?Which actor plays Thanos in the Avengers mid-credits scene?Are there economic implications portrayed in comics where the buildings and cities are ruined almost daily?Old X-Men comic where team travels to alien world with a ring-like sun that needs recharging?Why does Ego need help sleeping?Is there an objective answer to who “the strongest Avenger” is?How did Banner get unstuck?Why did Thanos get hit?How did Thanos (or anyone) know the Infinity Stones would give him this power?Did Thanos leave Eitri alive for his after-sales service?In Avengers 1, why does Thanos need Loki?