# Error Drupal with Haproxy

**URL:** <https://forums.percona.com/t/error-drupal-with-haproxy/3160>\
**Category:** Percona XtraDB Cluster 5.x\
**Created:** [December 20, 2013, 11:14am UTC](https://forums.percona.com/t/error-drupal-with-haproxy/3160 "2013-12-20T11:14:50Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![AdriannaXTS](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@AdriannaXTS](https://forums.percona.com/u/AdriannaXTS)\
**Post date:** [December 20, 2013, 11:14am UTC](https://forums.percona.com/t/error-drupal-with-haproxy/3160/1 "2013-12-20T11:14:50Z")

</div>

Hello ,

I would like connect my web servers to the Haproxy which will distribute the request on my 3 nodes PXC.

But when I test my website I have this error :

> [@](#):
>
> PDOException: SQLSTATE[HY000] [1129] Host ‘haproxy’ is blocked because of many connection errors; unblock with ‘mysqladmin flush-hosts’ in lock\_may\_be\_available()  
> (line 167 of /var/www/myproject/includes/lock.inc).

After adding max\_connections=10000 and max\_connect\_errors=10000 in mysql configuration file (/etc/my.cnf) ; and doing the following command mysqladmin -uroot -ppasswd flush-hosts I restart mysql service.

I get this following error when I test the website again :

> [@](#):
>
> PDOException: SQLSTATE[28000] [1045] Access denied for user ‘\*\*\*\*\*\*’@‘localhost’ (using password: YES) in lock\_may\_be\_available()/var/www/myproject/includes/lock.inc).

Here is my haproxy conf

> [@](#):
>
> frontend pxc-front  
> bind \*:3307  
> mode tcp  
> default\_backend pxc-back
> 
> frontend stats-front  
> bind \*:8080  
> mode http  
> default\_backend stats-back
> 
> frontend pxc-onenode-front  
> bind \*:3306  
> mode tcp  
> #option mysql-check user root  
> default\_backend pxc-onenode-back
> 
> backend pxc-back  
> mode tcp  
> balance leastconn  
> option httpchk  
> server node1 @ip:3306 check port 9200 inter 12000 rise 3 fall 3  
> server node2 @ip:3306 check port 9200 inter 12000 rise 3 fall 3  
> server node3 @ip:3306 check port 9200 inter 12000 rise 3 fall 3
> 
> backend stats-back  
> mode http  
> balance roundrobin  
> stats uri /haproxy/stats  
> stats refresh 10s
> 
> backend pxc-onenode-back  
> mode tcp
> 
> balance leastconn  
> option httpchk  
> server node1 @IP:3306 check port 9200 inter 12000 rise 3 fall 3 backup  
> server node2 @IP:3306 check port 9200 inter 12000 rise 3 fall 3  
> server node3 @IP:3306 check port 9200 inter 12000 rise 3 fall 3 backup

And web service configuration (settings.php)

> [@](#):
>
> $databases = array (  
> ‘default’ =\>  
> array (  
> ‘default’ =\>  
> array (  
> ‘database’ =\> ‘Drupal’,  
> ‘username’ =\> ‘drupal-user’,  
> ‘password’ =\> ‘secret’,  
> ‘host’ =\> ‘haproxy’, //@IP Haproxy  
> ‘port’ =\> ‘3306’,  
> ‘driver’ =\> ‘mysql’,  
> ‘prefix’ =\> ‘’,  
> ),  
> ),  
> );

Is that I forgot something on these configurations? How can I solve that . Thanks in advance for your help.

---

<div class="post-metadata">

**Author:** ![madhusudan](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@madhusudan](https://forums.percona.com/u/madhusudan)\
**Post date:** [December 24, 2013, 4:10am UTC](https://forums.percona.com/t/error-drupal-with-haproxy/3160/2 "2013-12-24T04:10:26Z")

</div>

Are you sure Mysql credentials are correct…? check with command line… and see whether you are able to login on all nodes with same credentials.

mysql -u [COLOR=#252C2F]drupal-user -P’secret’

---

<div class="post-metadata">

**Author:** ![AdriannaXTS](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@AdriannaXTS](https://forums.percona.com/u/AdriannaXTS)\
**Post date:** [December 24, 2013, 7:54am UTC](https://forums.percona.com/t/error-drupal-with-haproxy/3160/3 "2013-12-24T07:54:03Z")

</div>

Madhusudan;

The credentials are ok. I change the port in settings.php to 3307. Now the system goes well . Thanks for your answer.

---

<div class="post-metadata">

**Author:** ![madhusudan](https://avatars.discourse-cdn.com/v4/letter/m/76d3ee/32.png) [@madhusudan](https://forums.percona.com/u/madhusudan)\
**Post date:** [December 25, 2013, 3:55am UTC](https://forums.percona.com/t/error-drupal-with-haproxy/3160/4 "2013-12-25T03:55:30Z")

</div>

good… That means I guess some other process was occupying that port…?.

---

<div class="post-metadata">

**Author:** ![AdriannaXTS](https://avatars.discourse-cdn.com/v4/letter/a/b487fb/32.png) [@AdriannaXTS](https://forums.percona.com/u/AdriannaXTS)\
**Post date:** [December 27, 2013, 4:11am UTC](https://forums.percona.com/t/error-drupal-with-haproxy/3160/5 "2013-12-27T04:11:32Z")

</div>

Hello Madhusudan;

The only process which use this port is haproxy . I configure it to listen on ports 3306 and 3307. But I did not install mysql client.

I saw in pxc with haproxy configuration that it is not necessary to do like that. Perhaps this is not the good solution.

I will continue to think about the question.
