1

In our K8 cluster, we use haproxy app for connecting to Galera cluster.

Our haproxy.cnf file looks like

global
    maxconn 2048
    external-check
    stats socket /var/run/haproxy.sock mode 600 expose-fd listeners level user
    user haproxy
    group haproxy

defaults
    log global
    mode tcp
    retries 10
    timeout client 30000
    timeout connect 100500
    timeout server 30000

frontend mysql-router-service
    bind *:6446
    mode tcp
    option tcplog
    default_backend galera_cluster_backend

# MySQL Cluster BE configuration
backend galera_cluster_backend
    mode tcp
    option tcpka
    option mysql-check user haproxy
    balance source
    server pitipana-opsdb1 192.168.144.82:3306  check weight 1
    server pitipana-opsdb2 192.168.144.83:3306  check weight 1
    server pitipana-opsdb3 192.168.144.84:3306  check weight 1

Dockerfile for creating haproxy image

FROM haproxy:2.3
COPY haproxy.cfg /usr/local/etc/haproxy/haproxy.cfg

In my Galera nodes, I get constant warning in /var/log/mysql/error.log

2021-12-20 21:16:47 5942 [Warning] Aborted connection 5942 to db: 'ourdb' user: 'ouruser' host: '192.168.1.2' (Got an error reading communication packets)
2021-12-20 21:16:47 5943 [Warning] Aborted connection 5943 to db: 'ourdb' user: 'ouruser' host: '192.168.1.2' (Got an error reading communication packets)
2021-12-20 21:16:47 5944 [Warning] Aborted connection 5944 to db: 'ourdb' user: 'ouruser' host: '192.168.1.2' (Got an error reading communication packets)

I had increased max_packet_size to 64MB and max_connections to 1000.

When I take a tcpdump from galera node :

Frame 16: 106 bytes on wire (848 bits), 106 bytes captured (848 bits)
Linux cooked capture
Internet Protocol Version 4, Src: 192.168.1.2, Dst: 192.168.10.3
Transmission Control Protocol, Src Port: 62495, Dst Port: 3306, Seq: 1, Ack: 1, Len: 50
    Source Port: 62495
    Destination Port: 3306
    [Stream index: 2]
    [TCP Segment Len: 50]
    Sequence number: 1    (relative sequence number)
    [Next sequence number: 51    (relative sequence number)]
    Acknowledgment number: 1    (relative ack number)
    0101 .... = Header Length: 20 bytes (5)
    Flags: 0x018 (PSH, ACK)
        000. .... .... = Reserved: Not set
        ...0 .... .... = Nonce: Not set
        .... 0... .... = Congestion Window Reduced (CWR): Not set
        .... .0.. .... = ECN-Echo: Not set
        .... ..0. .... = Urgent: Not set
        .... ...1 .... = Acknowledgment: Set
        .... .... 1... = Push: Set
        .... .... .0.. = Reset: Not set
        .... .... ..0. = Syn: Not set
        .... .... ...0 = Fin: Not set
        [TCP Flags: ·······AP···]
    Window size value: 507
    [Calculated window size: 64896]
    [Window size scaling factor: 128]
    Checksum: 0x3cec [unverified]
    [Checksum Status: Unverified]
    Urgent pointer: 0
    [SEQ/ACK analysis]
    [Timestamps]
    TCP payload (50 bytes)
    [PDU Size: 45]
    [PDU Size: 5]
MySQL Protocol
    Packet Length: 41
    Packet Number: 1
    Request Command SLEEP
        Command: SLEEP (0)
        Payload: 820000008000012100000000000000000000000000000000...
            [Expert Info (Warning/Protocol): Unknown/invalid command code]
                [Unknown/invalid command code]
                [Severity level: Warning]
                [Group: Protocol]
MySQL Protocol
    Packet Length: 1
    Packet Number: 0
    Request Command Quit
        Command: Quit (1)

Here 192.168.1.2 is a K8 worker node and 192.168.10.3 is the galera node.

When I connect our applications in K8, we can access to applications, but when we try to edit, we get stuck.

Any suggestion to fix this?

Sachith Muhandiram
  • 2,819
  • 10
  • 45
  • 94

0 Answers0