Skip to content

Commit

Permalink
Sentinel doesn't support AUTH command. #393
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita committed Feb 4, 2016
1 parent e81f148 commit 349f9e9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
Expand Up @@ -31,12 +31,12 @@ public final <T extends RedisConnection> void onConnect(Promise<T> connectionFut
listener.executeCommands(); listener.executeCommands();
} }


protected void doConnect(MasterSlaveServersConfig config, NodeType serverMode, FutureConnectionListener<? extends RedisConnection> connectionListener) protected void doConnect(MasterSlaveServersConfig config, NodeType nodeType, FutureConnectionListener<? extends RedisConnection> connectionListener)
throws RedisException { throws RedisException {
if (config.getPassword() != null) { if (config.getPassword() != null) {
connectionListener.addCommand(RedisCommands.AUTH, config.getPassword()); connectionListener.addCommand(RedisCommands.AUTH, config.getPassword());
} }
if (config.getDatabase() != 0 && serverMode != NodeType.SENTINEL) { if (config.getDatabase() != 0) {
connectionListener.addCommand(RedisCommands.SELECT, config.getDatabase()); connectionListener.addCommand(RedisCommands.SELECT, config.getDatabase());
} }
if (config.getClientName() != null) { if (config.getClientName() != null) {
Expand Down
Expand Up @@ -40,14 +40,12 @@
import org.redisson.client.protocol.pubsub.PubSubType; import org.redisson.client.protocol.pubsub.PubSubType;
import org.redisson.cluster.ClusterSlotRange; import org.redisson.cluster.ClusterSlotRange;
import org.redisson.connection.ClientConnectionsEntry.FreezeReason; import org.redisson.connection.ClientConnectionsEntry.FreezeReason;
import org.redisson.connection.ClientConnectionsEntry.NodeType;
import org.redisson.misc.URIBuilder; import org.redisson.misc.URIBuilder;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;


import io.netty.util.concurrent.Future; import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.FutureListener; import io.netty.util.concurrent.FutureListener;
import io.netty.util.concurrent.Promise;
import io.netty.util.internal.PlatformDependent; import io.netty.util.internal.PlatformDependent;


public class SentinelConnectionManager extends MasterSlaveConnectionManager { public class SentinelConnectionManager extends MasterSlaveConnectionManager {
Expand All @@ -72,9 +70,6 @@ public SentinelConnectionManager(SentinelServersConfig cfg, Config config) {
if (!connection.isActive()) { if (!connection.isActive()) {
continue; continue;
} }
Promise<RedisConnection> f = newPromise();
connectListener.onConnect(f, connection, NodeType.SENTINEL, c);
f.syncUninterruptibly();


// TODO async // TODO async
List<String> master = connection.sync(RedisCommands.SENTINEL_GET_MASTER_ADDR_BY_NAME, cfg.getMasterName()); List<String> master = connection.sync(RedisCommands.SENTINEL_GET_MASTER_ADDR_BY_NAME, cfg.getMasterName());
Expand Down

0 comments on commit 349f9e9

Please sign in to comment.