Hello Community!
I am trying to connect to MariaDB nomad job from Drupal job using the sidecar proxy.
Here is my setup:
Name Address Port Status Leader Raft Version Build Datacenter Region
new-app1-t.global 10.1.0.2 4648 alive true 3 1.7.5 hetzner-dev global
new-app2-t.global 10.1.0.3 4648 alive false 3 1.7.5 hetzner-dev global
new-app3-t.global 10.1.0.4 4648 alive false 3 1.7.5 hetzner-dev global
---------
ID Node Pool DC Name Class Drain Eligibility Status
8***3 default hetzner-dev new-client3-t <none> false eligible ready
4***b default hetzner-dev new-client2-t <none> false eligible ready
5***a10 default hetzner-dev new-client1-t <none> false eligible ready
---------
Node Address Status Type Build Protocol DC Partition Segment
new-server1-t 10.1.0.2:8301 alive server 1.17.1 2 hetzner-dev default <all>
new-server2-t 10.1.0.3:8301 alive server 1.17.1 2 hetzner-dev default <all>
new-server3-t 10.1.0.4:8301 alive server 1.17.1 2 hetzner-dev default <all>
new-client1-t 10.1.0.5:8301 alive client 1.17.1 2 hetzner-dev default <default>
new-client2-t 10.1.0.6:8301 alive client 1.17.1 2 hetzner-dev default <default>
new-client3-t 10.1.0.7:8301 alive client 1.17.1 2 hetzner-dev default <default>
When I use mariadb client from drupal container, the connection just hangs:
/opt/drupal# mariadb -u root -p -P 33306 -h 127.0.0.1
Enter password:
(yes, local_bind_port = 33306)
Here is what I get when I use curl to test the connection:
root@a855670c044b:/opt/drupal# curl 127.0.0.1:33306
upstream connect error or disconnect/reset before headers. reset reason: protocol error
Now, when I use telnet, I get the most useful(IMO) reply:
root@a855670c044b:/opt/drupal# telnet 127.0.0.1 33306
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
1234test (this is my test input, just to get any answer from the service)
HTTP/1.1 400 Bad Request
content-length: 11
content-type: text/plain
date: Wed, 20 Mar 2024 21:17:31 GMT
server: envoy
connection: close
Bad RequestConnection closed by foreign host.
So, since I get reply from Envoy and not MariaDB server, it seems like Consul and Envoy try to handle it at L7 instead of L4.
So the question is: how do I force L4 (TCP) instead of L7 (HTTP) for my sidecar?
Here is what I have tried:
service {
name = "web-svc"
port = "web"
provider = "consul"
connect {
sidecar_service {
proxy {
config {
protocol = "tcp"
}
upstreams {
destination_name = "mariadb"
local_bind_port = 33306
}
}
}
}
Pleas advise!