Can't connect to private serivce from another service

Hi! Just setting up my first project on Render for a client. I created a private memcached server:

 - type: pserv
   name: xyz-memcached 
   env: docker
   plan: starter plus
   dockerfilePath: ./memcached/Dockerfile
   envVars:
     - key: SASL_CONF_PATH
       value: /home/memcache/memcached.conf
     - key: MEMCACHED_SASL_PWDB
       value: /home/memcache/memcached-sasl-db
     - key: MEMCACHED_PASSWORD
       generateValue: true

Did the other requisite things, following the zulip example.

The service host and port displayed in the web UI is xyz-memcached:11211

But I can’t connect to it, neither from my app or from cli. In my Rails app logs I see a lot of these:

down_retry_delay not reached for tapetorama-memcached:11211 (41.503 seconds left)

And when I try to curl from a shell in my Rails service I get:

$ curl -v telnet://tapetorama-memcached:11211
* Expire in 0 ms for 6 (transfer 0x564bd2990fb0)
...
* Expire in 7 ms for 1 (transfer 0x564bd2990fb0)
* Could not resolve host: tapetorama-memcached
* Expire in 8 ms for 1 (transfer 0x564bd2990fb0)
* Closing connection 0
curl: (6) Could not resolve host: tapetorama-memcached

I tried some other ways to ping the service, but don’t have access to telnet etc inside of my shells. The service seems to be running as far as I can tell (using ps aux), although the logs show:

Apr 27 04:17:32 PM  Signal handled: Terminated.
May 2 04:50:22 PM  Signal handled: Terminated.
May 2 05:21:30 PM  Signal handled: Terminated.
May 2 05:24:14 PM  Signal handled: Terminated.

Whether the service or up or not - how can I check for sure whether the hostname xyz-memcached resolves? And how can I solve my problem of the app not being to connect to the memcached server?

Thanks!

Hi felixhgren,

Thanks for reaching out! Can you try renaming your private memcached server from xyz-memcached to tapetorama-memcached? Your rails app seems to be trying to reach a service called tapetorama-memcached and same with your curl command.

Thanks!
Jennifer

Hi Jennifer,

Oh the xyz was just a failed attempt on my part to anonymize a bit when I posted. The memcached service is already called tapetorama-memcached. Another thing to note (although probably unrelated) is that the port was at first set to 1000 instead of 11211 in the tapetorama-stage service and I had to change it manually. I used this in my yaml for setting up the services:

     - key: MEMCACHED_LOCATION
       fromService:
         name: tapetorama-memcached
         type: pserv
         property: hostport
     - key: MEMCACHED_PASSWORD
       fromService:
         name: tapetorama-memcached
         type: pserv
         envVarKey: MEMCACHED_PASSWORD

Following up over DM!

For future readers:
The underlying issue was that the 2 services were not in the same region (one was in frankfurt and the other was in oregon). Currently, all services that are not “web services” that need to communicate with each other need to be in the same region.

2 Likes