Closed QuinDennis closed 9 years ago
Interesting, this is not a problem I've had -- what do your logs say? Is the Redis server on the same machine and up/available before this process?
thanks for helping, i've done a lot of coding (mostly Win, lately 'nix) but a little new to unix administration.
Redis is on the same server, it's log shows no issues. the LSB should make it wait for the redis-server, as I understand LSBs
are there specific logs i should be looking into?
#------------------------simulation LSB
#/etc/init.d/simulation
### BEGIN INIT INFO
# Provides: simulation
# Required-Start: redis-server
# Required-Stop: redis-server
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: LMPC Sim
# Description: Simulator for L-MPC Demo
### END INIT INFO
#---------------------------------- redis-server LSB
#/bin/sh
#Configurations injected by install_server below....
EXEC=/usr/local/bin/redis-server
CLIEXEC=/usr/local/bin/redis-cli
PIDFILE=/var/run/redis_6379.pid
CONF="/etc/redis/6379.conf"
REDISPORT="6379"
###############
### BEGIN INIT INFO
# Provides: redis-server
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: A persistent key-value database
# Description: A persistent key-value database
### END INIT INFO
oops, should have pasted as text, i think
Hi Bryce,
Thanks for responding. I'm using (trying to) LSB boot sequencing on Debian Squeeze and insserv, with LSB in redis init.d defining redis-server, then in my node app, required 'redis-server', so it should wait for redis. Redis logs look clean. I'm using node-forever to run my apps (in their init.d scripts, but welcome advice). I'm not sure what other logs to look at. :-)
On Wed, Nov 20, 2013 at 10:36 PM, Bryce Baril notifications@github.comwrote:
Interesting, this is not a problem I've had -- what do your logs say? Is the Redis server on the same machine and up/available before this process?
— Reply to this email directly or view it on GitHubhttps://github.com/mranney/node_redis/issues/516#issuecomment-28957598 .
Quin Dennis | 512-392-8619
Hmm, I'm not certain with your setup, but I'd start with /var/log/syslog
just after it fails to see if that has any information as to what went wrong.
My best guess is that the redis server isn't fully started up and ready in time for the node job and the client gives up on waiting for it.
Hi Bryce,
As we knew, Redis wasn't ready. I wrapped it in the following loop and got an error log. Now, what to do about it? I thought the try-catch would have handled everything.
========Error Message from Log ===========================
events.js:66
throw arguments[1]; // Unhandled 'error' event
^
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
at RedisClient.on_error
(/usr/local/mpcSite/public/node_modules/redis/index.js:163:24)
at Socket.
setInterval(simLoop, 3000);
var client, redis;
function simLoop() { try { if (redis == null) redis = require("redis"); if (client == null) client = redis.createClient();
getData();
} catch (e) { return; } }
On Sat, Nov 23, 2013 at 12:42 PM, Bryce Baril notifications@github.comwrote:
Hmm, I'm not certain with your setup, but I'd start with /var/log/syslogjust after it fails to see if that has any information as to what went wrong.
My best guess is that the redis server isn't fully started up and ready in time for the node job and the client gives up on waiting for it.
— Reply to this email directly or view it on GitHubhttps://github.com/mranney/node_redis/issues/516#issuecomment-29138546 .
Quin Dennis | 512-392-8619
debian squeeze, i have an /etc/init.d script that works fine from cmd line for a 'plain' node app and one which connects to redis. i've used insserv to set up booting. the 'plain' app starts at boot fine but not the one with redis.
i even created another 'start.js' app to wait 10 seconds, then exec the init.d script, but just can't get the node-redis client to auto-start
var redis = require("redis"), client = redis.createClient();
var http = require('http'); var https = require('https');
//pullData();
client.on("connect",getData); //client.on("connect",runSimulation); ....more