Wednesday 17 May 2017

How to connect to elasticache in my case?

I am trying to connect to aws elasticache from my app.

I know the endpoint and the port but for some reason I can't connect to it.

I used this npm package: https://www.npmjs.com/package/node-memcached-client

code:

const Memcached = require('node-memcached-client');
const client = new Memcached({
  host: 'mycache.aa11c.0001.use2.cache.amazonaws.com', //fake aws cache endpoint
  port: 11211
});
console.log(client); // I can see it outputs stuff

client.connect()
    .then(c => {
        console.log('connected');
        console.log(c);

    }).catch(function(err){
        console.log('error connecting');
        console.log(err);
    });

For some reason when I run the codes, all I see is

[Memcached] INFO: Nothing any connection to mycache.aa11c.0001.use2.cache.amazonaws.com:11211, created sid:1

no errors or connected message in the console.log. Am I doing something wrong here?

Thanks!



via Jwqq

No comments:

Post a Comment