我正在从nodejs脚本运行此函数:
const redis = require('redis')
const redisOptions = {
url: '*****',
password: '******'
}
const checkMessageStatus = (cachedMessageId, callback = () => {}) => {
const client = redis.createClient(redisOptions)
client.get('*', (err, cachedMessage) => {
// returns error if it exists
// figure out why this gets called twice
if(err) return console.log('redis err',err)
// returns true if message is cached
if(cachedMessage) return
// sets message as ID in database if the message hasn't been sent already
client.set(cachedMessageId, JSON.stringify(cachedMessageId), 'EX', 120 * 60, (redisSetError, redisSetResponse) => {
// console.error(redisSetError)
// console.log(redisSetResponse)
client.quit(callback)
})
})
}
我收到这个错误:
ReplyError: ERR max number of clients reached
数据库是通过redis实验室托管的,我可以有30个连接。
我跑了:
CLIENT KILL TYPE normal
CLIENT KILL TYPE slave
CLIENT KILL TYPE pubsub
当我跑的时候 info clients
:
# Clients
connected_clients:1
client_longest_output_list:0
client_biggest_input_buf:0
blocked_clients:0
问题:即使只有一个连接的客户端,我仍然会遇到此错误:
ReplyError: ERR max number of clients reached
暂无答案!
目前还没有任何答案,快来回答吧!