Open saschathiergart opened 5 years ago
@pritstift
1) try to delete
srv_dns_protocol = "udp"
seems like you can`t connect to dns via udp
2) please check api for backend server pools , or enable logging verbosity and check does discovery was successful
config looks fine for me .
@nickdoikov Thanks for your response.
Regarding 1.: I have the srv_dns_protocol ="udp"
nowhere in my config.
Regarding 2.: How do i enable verbose logging in gobetween. I could not find any info in the docs. The -h
option doesn't tell me how either.
@nickdoikov Apparently it works if i use the IP address of the DNS server instead of its domain name:
srv_lookup_server = "172.33.0.2:53"
. Is this behaviour intended? It seems like gobetween does not or cannot resolve the name of the DNS server.
I had that issue too and the workaround that worked for me was installing dnsmasq
and setting srv_lookup_server = "127.0.0.1:53"
in gobetween.
It's a bit weird on AWS, so that
ping 66101ea210104b18a7c77a5e83307807.tftp.core-test.
will say Name or service not known
,
but host
and dig
can resolve successfully.
Hello, I trying run gobetween in EC2 (via docker). I want forward requests to domains and ports (in SRV record).
[servers.sample]
bind = "localhost:3000"
protocol = "tcp"
balance = "weight"
[servers.sample.discovery]
failpolicy = "keeplast"
kind = "srv"
srv_lookup_server = "127.0.0.1:53"
srv_lookup_pattern = "my-domain.local."
Log:
lb | gobetween v0.8.0+snapshot
lb | 2019-08-14 07:25:50 [INFO ] (api): API disabled
lb | 2019-08-14 07:25:50 [INFO ] (manager): Initializing...
lb | 2019-08-14 07:25:50 [INFO ] (metrics): Metrics disabled
lb | 2019-08-14 07:25:50 [INFO ] (server): Creating 'sample': localhost:3000 weight srv none
lb | 2019-08-14 07:25:50 [INFO ] (scheduler): Starting scheduler sample
lb | 2019-08-14 07:25:50 [INFO ] (srvFetch): Fetching 127.0.0.1:53 my-domain.local.
lb | 2019-08-14 07:25:50 [ERROR] (discovery): srv error read udp 127.0.0.1:51221->127.0.0.1:53: read: connection refused retrying in 2s
lb | 2019-08-14 07:25:50 [INFO ] (discovery): Applying failpolicy keeplast
lb | 2019-08-14 07:25:50 [INFO ] (manager): Initialized
lb | 2019-08-14 07:25:52 [INFO ] (srvFetch): Fetching 127.0.0.1:53 my-domain.local.
lb | 2019-08-14 07:25:52 [ERROR] (discovery): srv error read udp 127.0.0.1:56556->127.0.0.1:53: read: connection refused retrying i
What am I doing wrong?
@MatthewPattell Looks like your dns server is not listening on 127.0.0.1:53. Check the output of netstat:
sudo netstat -lnu
@illarion thanks for the answer. Here is the result sudo netstat -lnu
:
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
udp 0 0 10.0.5.134:123 0.0.0.0:*
udp 0 0 127.0.0.1:123 0.0.0.0:*
udp 0 0 0.0.0.0:123 0.0.0.0:*
udp 0 0 0.0.0.0:68 0.0.0.0:*
udp 0 0 fe80::1e:50ff:fe72:baa8:546 :::*
Maybe I didn’t understand something correctly. SRV records creates in Route 53 via ECS Service Discovery. How to specify in srv_lookup_server
Route 53 DNS?
I try use NS record srv_lookup_server = ns-***.awsdns-**.co.uk:53
:
lb | 2019-08-14 11:23:24 [INFO ] (srvFetch): Fetching ns-***.awsdns-**.co.uk:53 my-domain.local.
lb | 2019-08-14 11:23:24 [INFO ] (manager): Initialized
lb | 2019-08-14 11:23:24 [WARNI] (srvFetch): Empty response fromns-***.awsdns-**.co.uk:53my-domain.local.
Output nslookup nslookup -type=srv my-domain.local
:
Server: 10.0.0.2
Address: 10.0.0.2#53
Non-authoritative answer:
my-domain.local service = 1 1 32782 c763b65e-938e-410b-ab20-99e01e4bdfb0.my-domain.local.
Curl output curl 10.0.0.2:53
:
curl: (52) Empty reply from server
Ok, I set srv_lookup_server = 10.0.0.2:53
:
2019-08-14 11:54:20 [INFO ] (api): API disabled
2019-08-14 11:54:20 [INFO ] (metrics): Metrics disabled
2019-08-14 11:54:20 [INFO ] (manager): Initializing...
2019-08-14 11:54:20 [INFO ] (server): Creating 'sample': localhost:3000 weight srv none
2019-08-14 11:54:20 [INFO ] (scheduler): Starting scheduler sample
2019-08-14 11:54:20 [INFO ] (srvFetch): Fetching 10.0.0.2:53 my-domain.local.
2019-08-14 11:54:20 [INFO ] (manager): Initialized
What's next? My docker compose file:
version: '2'
services:
dbgproxy:
image: yyyar/gobetween
container_name: lb
hostname: lb
ports:
- 89:3000
volumes:
- /home/ec2-user/gobetween:/etc/gobetween/conf
And curl 127.0.0.1:89
:
curl: (56) Recv failure: Connection reset by peer
I found my mistake. Need use 0.0.0.0 ip in config server, if you use docker.
@MatthewPattell I am curious as to what finally worked? (i.e. how does the config look?)
Also, was there a DNS server running on the host machine at all? The netstat
output indicates that there is no DNS server listening
@shantanugadgil yes, it works.
Example (ssh to EC2):
mkdir -p /home/ec2-user/gobetween/conf
touch /home/ec2-user/gobetween/conf/gobetween.toml
touch /home/ec2-user/gobetween/docker-compose.yml
Find DNS private ip:
cat /etc/resolv.conf | grep -i '^nameserver' | head -n1 | cut -d ' ' -f2
In /home/ec2-user/gobetween/conf/gobetween.toml
:
[servers.sample]
bind = "0.0.0.0:3000"
protocol = "tcp"
balance = "weight"
[servers.sample.discovery]
failpolicy = "keeplast"
kind = "srv"
srv_lookup_server = "10.0.0.2:53"
srv_lookup_pattern = "my-domain.local."
In /home/ec2-user/gobetween/docker-compose.yml
:
version: '2'
services:
lb:
image: yyyar/gobetween
container_name: lb
hostname: lb
ports:
- 89:3000
volumes:
- /home/ec2-user/gobetween/conf:/etc/gobetween/conf
docker-compose up -d
You can also run through ECS.
I am trying to get gobetween running on AWS ECS. My ECS services run tasks in bridge mode using the service discovery feature provided by AWS. In my gobetween config, i have
Doing
dig tftp.core-test SRV
in the running container instance gives me:However, in the log i can see:
Maybe i don't get how to properly set the
srv_lookup_server
andsrv_lookup_pattern
properties. Any idea what i am missing out here?