के साथ Redis auth त्रुटि मैं अपने नोड ऐप को पासवर्ड के बिना ठीक से रेडिस से जोड़ सकता हूं, लेकिन जब मैं पासवर्ड जोड़ता हूं, तो कुछ भी नहीं करता है।Node.js और socket.io
यहाँ मेरी कोड अभी, an example से सही लिया है: एप्लिकेशन चला पर
var redis = require('redis')
, sio = require('socket.io')
, RedisStore = sio.RedisStore
, io = sio.listen();
var port = 6379
, hostname = 'localhost'
, password = 'password';
var redisClient = redis.createClient(port, hostname);
redisClient.auth(password, function (err) { if (err) throw err; });
var redisSubscriber = redis.createClient(port, hostname);
redisSubscriber.auth(password, function (err) { if (err) throw err; });
io.set('store', new RedisStore({ redisPub: redisClient, redisSub: redisSubscriber, redisClient: redisClient }));
, मैं इस स्टैक ट्रेस मिलती है:
/home/eric/christmas/sockets/node_modules/socket.io/node_modules/redis/index.js:506
throw callback_err;
^
Error: Ready check failed: ERR operation not permitted
at RedisClient.on_info_cmd (/home/eric/christmas/sockets/node_modules/socket.io/node_modules/redis/index.js:319:35)
at Command.RedisClient.ready_check.send_anyway [as callback] (/home/eric/christmas/sockets/node_modules/socket.io/node_modules/redis/index.js:367:14)
at RedisClient.return_error (/home/eric/christmas/sockets/node_modules/socket.io/node_modules/redis/index.js:502:25)
at RedisReplyParser.RedisClient.init_parser (/home/eric/christmas/sockets/node_modules/socket.io/node_modules/redis/index.js:262:14)
at RedisReplyParser.EventEmitter.emit (events.js:93:17)
at RedisReplyParser.send_error (/home/eric/christmas/sockets/node_modules/socket.io/node_modules/redis/lib/parser/javascript.js:266:14)
at RedisReplyParser.execute (/home/eric/christmas/sockets/node_modules/socket.io/node_modules/redis/lib/parser/javascript.js:125:22)
at RedisClient.on_data (/home/eric/christmas/sockets/node_modules/socket.io/node_modules/redis/index.js:478:27)
at Socket.<anonymous> (/home/eric/christmas/sockets/node_modules/socket.io/node_modules/redis/index.js:79:14)
at Socket.EventEmitter.emit (events.js:93:17)
लाइन पैदा करने के लिए इस अंतिम एक है - अगर मैं RedisStore सेट करने के प्रयास पर टिप्पणी करता हूं, मुझे कोई त्रुटि नहीं मिलती है।
मुझे यकीन है कि पासवर्ड सही है (मैं इसे लाल-क्ली में सत्यापित कर सकता हूं, और यदि मैं गलत होने के लिए पासवर्ड बदलता हूं तो मैं सत्यापित कर सकता हूं कि ऑथ कॉलबैक आग नहीं है)। यह कोड भी काम करता है अगर मैं पासवर्ड हटा देता हूं और दो ऑथ लाइनों पर टिप्पणी करता हूं।
ब्लॉग पोस्ट और दस्तावेज़ों और इस तरह के शो पर सभी काम करने वाले उदाहरणों को यह काम करना चाहिए, और मुझे नहीं पता कि मेरा क्यों नहीं है। मुझे नहीं पता कि ढेर के किस हिस्से को देखने के लिए।
1353227107.912512 [0 127.0.0.1:56759] "auth" "password"
1353227107.912719 [0 127.0.0.1:56758] "auth" "password"
1353227107.913470 [0 127.0.0.1:56759] "info"
1353227107.913639 [0 127.0.0.1:56758] "info"
और यहाँ क्या redis-CLI की निगरानी से पता चलता है कि अगर मैं पासवर्ड बंद कर देते हैं, इसके बाद के संस्करण बाहर टिप्पणी प्रमाणन लाइनों है, और:
यहाँ redis-CLI पर नजर रखने की तरह जब मैं ऊपर कोड चलाने दिखता है सफलतापूर्वक अनुप्रयोग चलाने:
1353227252.401667 [0 127.0.0.1:56771] "info"
1353227252.402020 [0 127.0.0.1:56770] "info"
1353227252.402131 [0 127.0.0.1:56769] "info"
1353227252.402423 [0 127.0.0.1:56768] "info"
1353227252.402611 [0 127.0.0.1:56767] "info"
1353227252.406254 [0 127.0.0.1:56770] "subscribe" "handshake"
1353227252.406287 [0 127.0.0.1:56770] "subscribe" "connect"
1353227252.406314 [0 127.0.0.1:56770] "subscribe" "open"
1353227252.406321 [0 127.0.0.1:56770] "subscribe" "join"
1353227252.406326 [0 127.0.0.1:56770] "subscribe" "leave"
1353227252.406337 [0 127.0.0.1:56770] "subscribe" "close"
1353227252.406354 [0 127.0.0.1:56770] "subscribe" "dispatch"
1353227252.406372 [0 127.0.0.1:56770] "subscribe" "disconnect"
सफल (passwordless) कनेक्शन 5 "जानकारी" आदेशों बनाता है, और मेरी असफल (passworded) आदेश 2 बनाता है - और फिर एक "on_info_cmd" विधि के लिए एक कॉल पर मर जाता है।
क्या कोई इस बारे में समझ सकता है? आपके द्वारा दी जा सकने वाली कोई भी सहायता के लिए शुक्रिया।
मैंने इसे हल किया (नीचे जवाब), और सॉकेट.ओ विकी को प्राधिकरण के साथ RedisStore का एक उदाहरण प्रदान करने के लिए अद्यतन किया: https://github.com/LearnBoost/socket.io/wiki/Configuring-Socket.IO – Konklone