2013-09-25 2 views
1

누구든지이 테스트 코드에 어떤 문제가 있다고 말할 수 있습니까? 이 프로그램은 초기에는 잘 작동하지만 필연적으로 몇 시간 동안 사용하지 않으면 Redis 시간 초과 오류가 발생합니다. 참고로이 게시물의 redis 호스트와 암호를 잘못된 정보로 변경했습니다.Redis timeout error

node-redis 또는 iris-redis 드라이버 사용 여부에 관계없이 동일한 오류가 발생합니다.

var express = require('express'); 
var app = express(); 

// Redis Data Store 
var redis = require("iris-redis"); 
var client = redis.createClient(6379, "nodejitsudb5555563948.redis.irstack.com"); 
client.auth("fehehyrj971946ef332e975fbebb4"); 

client.on("ready", function() { 
    client.iris_config(function(er, config) { 
     if(er) throw er; 
     console.log("Got my server config: %j", config) 
//  client.quit() 
    }); 
}); 


// Define a test route 
app.get('/test', function(req, res) { 
    client.incr("seq:test", function(err, reply) { 
    console.log("Incremented redis counter: " + reply); 
    var body = "Incremented Redis Counter: " + reply; 
    res.setHeader('Content-Type', 'text/plain'); 
    res.setHeader('Content-Length', body.length); 
    res.end(body); 
    }); 
}); 

app.listen(8001); 
console.log('Listening on port 8001'); 
+0

:

CONFIG SET timeout 0 

이 그런 다음 레디 스 설정 파일에 다음 줄을 설정하는 것을 잊지 마세요 redis 서버에서 CONFIG GET timeout의 결과는 무엇입니까? –

답변

1

은 아마 당신이 timeoutredis-server0로 설정되지 않았습니다. 응용 프로그램이 오랜 시간 유휴 상태 일 경우 timeout0으로 설정해야합니다. 당신이 (가)를 설정하기 위해 다음을 수행 할 수 있습니다,이 프로덕션 서버에 이미있는 경우

CONFIG GET timeout 

당신은 잠시 동안 그것을 내려 놓고 할 수 없습니다 : 당신은 당신의 설정 파일을 확인하거나 다음 redis-cli를 통해 사용할 수 있습니다 레디 스 timeout 동적 redis-cli를 사용하여 :

timeout 0 
관련 문제