GET 24/7 LIVE HELP NOW

Announcement

Announcement Module
Collapse
No announcement yet.

Error Drupal with Haproxy

Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error Drupal with Haproxy

    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.

  • #2
    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 drupal-user -P'secret'

    Comment


    • #3
      Madhusudan;

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

      Comment


      • #4
        good.. That means I guess some other process was occupying that port..?.

        Comment


        • #5
          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.

          Comment

          Working...
          X