9

NodeJS で Redis DB を使用しています。時折、例外が発生し、サーバー (NodeJS) がクラッシュして再起動するだけです。

Error: Redis connection to localhost:6380 failed - getaddrinfo ENOTFOUND

誰かがなぜこれが起こるのか説明できますか? 以下の設定はこれと関係がありますか?

# Set the max number of connected clients at the same time. By default
# this limit is set to 10000 clients, however if the Redis server is not
# able ot configure the process file limit to allow for the specified limit
# the max number of allowed clients is set to the current file limit
# minus 32 (as Redis reserves a few file descriptors for internal uses).
#
# Once the limit is reached Redis will close all the new connections sending
# an error 'max number of clients reached'.
#
# maxclients 10000
4

1 に答える 1

7

これは単に、redis サーバーが実行されていないことを意味します。少なくともそのアドレス/ポートではありません。

を使用してサーバーを起動します

$ redis-server path/to/redis.conf

また、デフォルトの redis ポートは6379です。スクリプトで 6380 を使用している場合は、redis がそのポートでリッスンしていることを確認してください。


スクリプト内の何かが redis サーバーのクラッシュの原因となっている場合は、エラーをリッスンして、より適切な出力を得ることができます。

var redis  = require("redis"),
    client = redis.createClient(6380, "localhost");

client.on("error", function (err) {
  console.log("Redis error encountered", err);
});

client.on("end", function() {
  console.log("Redis connection closed");
});
于 2013-11-05T08:38:01.570 に答える