Question

On local development, you start a redis server using the "redis-server" command. However when I deploy the project to nodejitsu (using jitsu deploy), there isn't an interface to run this command, and launching the deployed app gives the following error:

Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED

How do I startup redis on a nodejitsu server? Is this enabled by default, or is there some config I have to change to get this working? Searched around but couldnt find any clues on this at all, is there something obvious I am missing out? Would appreciate any help at all.

Était-ce utile?

La solution

Yupp you guys are right - irc channel found the right people instantly.

So the answer from @AvianFlu is that nodejitsu doesn't host databases. However you can create couch, redis or mongo database instances with:

jitsu databases create <database type> <database name>

That will create databases hosted on eg. RedisToGo, CouchIris, or MongoHQ that you can use with your nodejitsu app. More details on DB connection - https://github.com/nodejitsu/handbook/#databases

If you are using the trial servers you won't be able to create databases (the small memory allocated makes it unfeasible to run the database on the same server), however you can still connect to your existing Redis/Couch/Mongo DB using the following code:

// Given this Redis conection string: 
// "redis://myDb:1234c6607579e81ff116374dc0cc4321@abc.redistogo.com:10108/"
// you can connect to your redistogo instance like so:

var client = redis.createClient(10108, 'abc.redistogo.com');
client.auth("1234c6607579e81ff116374dc0cc4321", function(err) {
  if (err) {
    throw err;
  }
});
client.on('ready', function () { // without this part, redis connection will fail
  // do stuff with your redis
});

@blakmatrix from nodejitsu replied my ticket with an excellent template for database connection, using an external config file. Super handy for multi-environments. https://github.com/nodeapps/boilerplates/tree/databases/helloredis

I can confirm that this works, even with a trial nodejitsu server and redistogo instance. Awesome.

Autres conseils

Have you tried the jitsu databases command? Have you actively set any configurations for redis?

FYI: the Nodejitsu platform is very new. The public beta announcement was one month ago. There are probably a few hundred people using the nodejitsu product right now.

Your best bet here is to go directly to the source. They have a IRC channel on freenode: #nodejitsu, they also publish their e-mail on their support page.

If you plan to use this product, I strongly suggest getting on IRC. This is likely just the first of several hurdles you will have to work through.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top