itzg / mc-router

Routes Minecraft client connections to backend servers based upon the requested server address

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Unable to find registered backend

maxfield-allison opened this issue · comments

My mc-router compose.yml

version: '3.7'
services:
  router:
    container_name: mc-router
    image: itzg/mc-router
    ports:
      - 25565:25565
    command: --mapping=one.example.net=one:25565,two.example.net=two:25565,three.example.net=three:25565
    restart: unless-stopped
    networks:
      - t2_proxy
########################### NETWORKS
networks:
  t2_proxy:
    external:
      name: t2_proxy
  default:
    driver: bridge

my three compose.yml

version: '3.7'

services:
  three:
    container_name: three
    image: itzg/minecraft-server:multiarch
    environment:
      NAME: "three- FTB Infinity Evolved"
      EULA: "TRUE"
      GAMEMODE: survival
      DIFFICULTY: normal
      SERVER_NAME: "three FTB Infinity Evolved"
      ONLINE_MODE: "true"
      UID: ${PUID}
      GID: ${PGID}
      MAX_MEMORY: 12G
      MAX_BUILD_HEIGHT: 256
      VIEW_DISTANCE: 10
      ENABLE_QUERY: "true"
      TYPE: FTBA
      FTB_MODPACK_ID: 23
      SERVER_PORT: 25565
      QUERY_PORT: 25565
      ENABLE_RCON: "true"
      RCON_PORT: 25575
      JVM_DD_OPTS: fml.queryResult:confirm
    expose:
      - 25565
#    ports:
#      - 25566:25566
    volumes:
      - /data:/data
      - /etc/timezone:/etc/timezone:ro
    networks:
      - t2_proxy
    security_opt:
      - no-new-privileges:true
    tty: true
    stdin_open: true
    restart: unless-stopped

########################### NETWORKS
networks:
  t2_proxy:
    external:
      name: t2_proxy
  default:
    driver: bridge

and in the logs for mc-router all I see is

time="2020-08-02T21:56:17Z" level=info msg="Got connection" client="10.1.0.221:65295"
time="2020-08-02T21:56:17Z" level=warning msg="Unable to find registered backend" serverAddress=three.example.net.

I've double and triple checked my DNS A records and SRV records and they are correct in cloudflare. No dns proxy and the SRV is pointed at the correct port and IP. My firewall isn't blocking anything on port 25565. All 3 servers are giving me the same errors when attempting to connect. The only thing that has changed is my WAN connection on the firewall and a few reboots of the host server, one of which was for a kernel update. However the issue began some time after that. After posting I will be trying to update the kernel to the latest available and if that doesn't work, I'll roll back to the mainline release and see how that fairs.

Kernel changes made no difference

Yep, your DNS definitely seems fine since it made it to the mc-router container in the first place. Instead, what you're running into is container host resolution due to the two separate compose files. I see that you've added both to the same "external network"; however, apparently that's not enough to register the container-host for each other. I couldn't find any obvious solutions or descriptions here https://docs.docker.com/compose/networking/ either.

It's not ideal, but what has definitely worked for me is to place both the mc-router and the backend servers all in the same compose file. Personally I deploy on kubernetes and it is much more intuitive with container-hostname resolution.

What's strange is that it worked just fine for several weeks. And I can't figure what if anything had changed. I couldn't figure out how to enable debug in the compose file either so I could take a slightly deeper look at what's going on behind the scenes.

That is indeed strange. Perhaps there was a Docker upgrade in between. Again, this sounds like a Docker networking / hosts management issue.

Most likely, I'll place everything into the same compose file and test today. I'll let you know if that works and also try to dig into the docker docs and changelogs. Additionally, can you clarify how to enable debug logging and the REST API using a compose file? I had assumed it was something like

    environment:
      - DEBUG: "true"

but that gave me no joy.
Thank you for your help!

No luck running in the same stack either =[

time="2020-08-03T13:35:31Z" level=warning msg="Unable to find registered backend" serverAddress=mcj.bluewillows.net.
time="2020-08-03T13:35:33Z" level=info msg="Got connection" client="10.1.0.221:23699"
time="2020-08-03T13:35:33Z" level=warning msg="Unable to find registered backend" serverAddress=mcj.bluewillows.net.
time="2020-08-03T13:36:53Z" level=info msg="Got connection" client="10.1.0.221:23936"
time="2020-08-03T13:36:53Z" level=warning msg="Unable to find registered backend" serverAddress=mcj.bluewillows.net.
time="2020-08-03T13:36:53Z" level=info msg="Got connection" client="10.1.0.221:23937"
time="2020-08-03T13:36:53Z" level=warning msg="Unable to find registered backend" serverAddress=mcj.bluewillows.net.

You're mixing syntax there, but yes DEBUG should be the variable to enable debug logs in mc-router. To clarify it should be:

  environment:
    DEBUG: "true"

Like I said, I deploy using kubernetes myself, so I'll have to re-test with a single compose file myself and see if I can recreate the issue.

time="2020-08-03T13:51:15Z" level=info msg="Got connection" client="10.1.0.221:26207"
time="2020-08-03T13:51:15Z" level=debug msg="Reading packet" client="10.1.0.221:26207"
time="2020-08-03T13:51:15Z" level=debug msg="Reading frame" client="10.1.0.221:26207"
time="2020-08-03T13:51:15Z" level=debug msg="Read frame length" client="10.1.0.221:26207" length=27
time="2020-08-03T13:51:15Z" level=debug msg="Reading frame content" client="10.1.0.221:26207" length=27 total=27
time="2020-08-03T13:51:15Z" level=debug msg="Read frame" client="10.1.0.221:26207" frame="Frame:[len=27, payload=0X00E005146D636A2E626C756577696C6C6F77732E6E65742E63DD01]"
time="2020-08-03T13:51:15Z" level=debug msg="Read packet" client="10.1.0.221:26207" packet="Frame:[len=27, packetId=0, data=0XE005146D636A2E626C756577696C6C6F77732E6E65742E63DD01]"
time="2020-08-03T13:51:15Z" level=debug msg="Got packet" client="10.1.0.221:26207" length=27 packetID=0
time="2020-08-03T13:51:15Z" level=debug msg="Got handshake" client="10.1.0.221:26207" handshake="&{736 mcj.bluewillows.net. 25565 1}"
time="2020-08-03T13:51:15Z" level=warning msg="Unable to find registered backend" serverAddress=mcj.bluewillows.net.
time="2020-08-03T13:51:15Z" level=debug msg="Closing frontend connection" client="10.1.0.221:26207"
time="2020-08-03T13:51:15Z" level=info msg="Got connection" client="10.1.0.221:26208"
time="2020-08-03T13:51:15Z" level=debug msg="Reading packet" client="10.1.0.221:26208"
time="2020-08-03T13:51:15Z" level=debug msg="Reading legacy server list ping" client="10.1.0.221:26208"
time="2020-08-03T13:51:15Z" level=debug msg="Got packet" client="10.1.0.221:26208" length=0 packetID=254
time="2020-08-03T13:51:15Z" level=debug msg="Got legacy server list ping" client="10.1.0.221:26208" handshake="&{127 mcj.bluewillows.net. 25565}"
time="2020-08-03T13:51:15Z" level=warning msg="Unable to find registered backend" serverAddress=mcj.bluewillows.net.
time="2020-08-03T13:51:15Z" level=debug msg="Closing frontend connection" client="10.1.0.221:26208"

Also, How can I enable the REST API to either manually set the routes or pull the current ones?

Aha, the debug logs helped a lot. I now see that it's probably because you left off the final dot in the hostname after .net it's actually .net. since it is a fully, fully qualified domain name. Make sure you're declared backends matches exactly what it's trying to lookup there.

As for the REST API, configuring the API binding is what activates that
https://github.com/itzg/mc-router#usage

HOLY CRAP THAT DID IT! lol thats amazing. I swear it's always something super simple like that lol. Thank you so much for your help! I'll fork and pull request some things for the readme that may help others in the future once I have some time today.