Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Server at xyz not available\n at Client.memcachedCommand [as command] in nodejs with Memcached #646

Open
cmreddyv opened this issue Aug 12, 2021 · 3 comments

Comments

@cmreddyv
Copy link

getting the error:

Getting data from memCache failed severity:error f.err:{"stack":"Error: Server at xyz not available\n at Client.memcachedCommand [as command] (/service/node_modules/memcached/lib/memcached.js:306:70)\n at Client.get (/service/node_modules/memcached/lib/memcached.js:830:10)\n at /service/repository/data/Repo.js:32:35\n at new Promise ()\n at Repo.get (/service/repository/data/Repo.js:13:16)\n

Client which is connecting is npm memcached
Twemproxy version: 0.5.0
Environemnt: Running twemproxy inside kubernetes

When checked for twemproxy stats no server ejections all the memcached servers are operating normally.

Any lead on how to solve the above error would be really helpful

@TysonAndre
Copy link
Collaborator

  1. Can you post the config file used for twemproxy with as much detail as possible?
  2. Did you disable tls for the elasticache cluster? - See Does twemproxy support connection to tls redis server ? #583 - twemproxy currently does not support tls (for memcached and redis)
  3. Are you able to connect to those memcache hosts directly from the kubernetes cluster?
  4. Can you post logs, preferably at loglevel 6(informational) or a numerically larger value (nutcracker -v 6 -o /var/log/nutcracker.log)

@TysonAndre TysonAndre changed the title Error: Server at xyz not available\n at Client.memcachedCommand [as command] Error: Server at xyz not available\n at Client.memcachedCommand [as command] in nodejs with Memcached in elasticache Aug 12, 2021
@cmreddyv
Copy link
Author

cmreddyv commented Aug 12, 2021

Twemproxy conf file

memcached:
listen: 0.0.0.0:22121
hash: fnv1a_64
distribution: ketama
preconnect: true
auto_eject_hosts: true
server_retry_timeout: 2000
server_failure_limit: 2
timeout: 1000
tcpkeepalive: true
backlog: 1024
servers:
- 0.xyz-service.svc.cluster.local:11211:1 0
- 1.xyz-service.svc.cluster.local:11211:1 1
- 2.xyz-service.svc.cluster.local:11211:1 2
- 3.xyz-service.svc.cluster.local:11211:1 3
- 4.xyz-service.svc.cluster.local:11211:1 4
- 5.xyz-service.svc.cluster.local:11211:1 5

We are not using elasticcache cluster... it is like having a onprem memcached on kubernetes and twemproxy in kubernetes.

Yes i am able to connect to memcached hosts.

Strange part is after some time, not sure about the time, the error is going away... looks like the server reconnect feature.

When i checked the npm module code

https://github.com/3rd-Eden/memcached/blob/master/lib/memcached.js

Line number: 311,312,313 this the causing the error.

Is there anything to do with the server retries or our config is correct and we have set the following in the client

poolsize: 70
retries: 3,
retry: 1000,
reconnect: 60000

Please guide us if we are using the correct twem proxy config and client config

@TysonAndre TysonAndre changed the title Error: Server at xyz not available\n at Client.memcachedCommand [as command] in nodejs with Memcached in elasticache Error: Server at xyz not available\n at Client.memcachedCommand [as command] in nodejs with Memcached Aug 12, 2021
@TysonAndre
Copy link
Collaborator

Do you start twemproxy and your application at the same time? Are you sure twemproxy has finished starting up when you connect to it (should finish in a few seconds)

Also, what do the logs from twemproxy say (can be enabled with nutcracker -v 6 -o /path/to/logfile.log)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants