-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
connect-redis throws error when custom ioredis client is passed in config/session.js #4262
Comments
@utsavkansara Thanks for posting, we'll take a look as soon as possible. For help with questions about Sails, click here. If you’re interested in hiring @sailsbot and her minions in Austin, click here. |
@utsavkansara Please see #4256 |
@sgress454 Based on your suggestion I provided url argument to my session config which points to redis sentinel. module.exports.session = { Question 1: Why do we need to provide url if we are already providing connection info in redis client |
@utsavkansara Did the above config solve your problem? I understand the confusion -- it's probably redundant for Sails to have to make a client connection to Redis at all when it's only using pub/sub and you're already providing separate connections for that, but at the moment the adapter's not quite smart enough to figure that out. So I think any |
@sgress454 Sails is able to come up but its not able to store session in redis. { ReplyError: ERR unknown command 'set' The ultimate goal of using sentinel is we don't have to connect to redis instance directly. Instead, we connect to sentinel and it will provide current redis master's info and client should be able to connect to current master. Did I make myself clear ? |
Hey @sgress454, |
@utsavkansara sorry for the delay, traveling at the moment. I think we might have gotten steered wrong here -- the link I provided above referred to sockets configure, not session. It's hard for me to access at the moment but in our Gitter chat I think I dug up the correct syntax for specifying a custom Redis client for session, please take a look at that and see if it helps. |
@sgress454 Thanks for responding. Yes you are right. My particular request was for session not sockets. I am passing custom client for session based on your recommendation only. I have attached configuration information in ticket also. Please check whenever you get free. |
@sgress454 Awaiting your reply. :-) |
Sorry -- I've been traveling, but will try to look back into this on
today's long plane ride...
…On Sun, Jan 7, 2018 at 12:51 PM utsavkansara ***@***.***> wrote:
@sgress454 <https://github.com/sgress454> Awaiting your reply. :-)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#4262 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAhx1BeSudm9ddVRU310Np9aVptQzI18ks5tID9MgaJpZM4RCzhc>
.
|
@utsavkansara, ok, I think I have this figured out. In order to use ioredis, rather than setting
works for me. It should work with the |
@sgress454 works as expected as per your suggested change. |
🎉 Closing now that v1.0 is officially released. |
Sails version:1.0.0-40
Node version:8.9.0
NPM version:5.5.1
DB adapter name: connect-redis
DB adapter version: 3.2.0
Operating system:MacOS Sierra
I am trying to make redis work with sentinel. The only way possible with SailsV1 is to create and pass custom ioredis client in config.
I am doing following in my config/session.js
var Redis = require('ioredis');
var redis = new Redis({
sentinels: [{ host: 'localhost', port: 26379 }],
name: 'mymaster'
});
module.exports.session = {
secret: '73ae3b02fa3a0d4d4dd56ab28c1f09bb',
adapter: 'connect-redis',
client: redis,
ttl: 5000,
db: 0,
pass: '',
prefix: 'session:',
}
My redis instance is running at localhost:6380
My sentinel is running at: 26379
Info on sentinel : master0:name=mymaster,status=ok,address=127.0.0.1:6380,slaves=0,sentinels=1
After doing this configuration I am hitting sails-lift which gives me following error
info: Starting app...
error: A hook (
session
) failed to load!error:
error: Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
at Object._errnoException (util.js:1024:11)
at _exceptionWithHostPort (util.js:1046:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1182:14)
error: Could not load Sails app.
error:
error: Tips:
error: • First, take a look at the error message above.
error: • Check that you're using the latest stable version of Sails.
error: • Have a question or need help? (http://sailsjs.com/support)
First question comes to my mind is why it is trying to hit 127.0.0.1:6379 ?
The text was updated successfully, but these errors were encountered: