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
{"This operation has been disabled in the command-map and cannot be used: SET"} #1580
Comments
Sentinel Connect connects *to* a sentinel, not *via* a sentinel.
So: if the address you have is for a sentinel service, and you want to
connect to redis: you also need the service name. If you specify that on
the connection string, you should be redirected via the sentinel to the
actual redis server.
…On Thu, 8 Oct 2020, 01:47 jeremiahedge, ***@***.***> wrote:
I keep running into an issue when i use sentinelconnect, i get all the
commandmaps added without me doing it. I've use the latest from the myget
stackoverflow package
my code
` ConfigurationOptions sentinelConfig = new ConfigurationOptions();
sentinelConfig.EndPoints.Add("localhost", 26379);
sentinelConfig.TieBreaker = "";
sentinelConfig.AbortOnConnectFail = false;
// its important to set the Sentinel commands supported
ConnectionMultiplexer redis = ConnectionMultiplexer.SentinelConnect(sentinelConfig, Console.Out);
IDatabase db = redis.GetDatabase();
db.StringSet("key", "value");
`
First output in the console is this:
localhost:26379,abortConnect=False,$NONE=,$APPEND=,$ASKING=,$BGREWRITEAOF=,$BGSAVE=,$BITCOUNT=,$BITOP=,$BITPOS=,$BLPOP=,$BRPOP=,$BRPOPLPUSH=,$CLIENT=,$CLUSTER=,$CONFIG=,$DBSIZE=,$DEBUG=,$DECR=,$DECRBY=,$DEL=,$DISCARD=,$DUMP=,$ECHO=,$EVAL=,$EVALSHA=,$EXEC=,$EXISTS=,$EXPIRE=,$EXPIREAT=,$FLUSHALL=,$FLUSHDB=,$GEOADD=,$GEODIST=,$GEOHASH=,$GEOPOS=,$GEORADIUS=,$GEORADIUSBYMEMBER=,$GET=,$GETBIT=,$GETRANGE=,$GETSET=,$HDEL=,$HEXISTS=,$HGET=,$HGETALL=,$HINCRBY=,$HINCRBYFLOAT=,$HKEYS=,$HLEN=,$HMGET=,$HMSET=,$HSCAN=,$HSET=,$HSETNX=,$HSTRLEN=,$HVALS=,$INCR=,$IN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ZSCORE=,$ZUNIONSTORE=,$UNKNOWN=
As you can see, I'm not adding a map, however sentinelconnect adds all of
these to the connection string.
I've also tried this
ConnectionMultiplexer sentinelConnection =
ConnectionMultiplexer.SentinelConnect(sentinelConfig); // Create master
service configuration ConfigurationOptions masterConfig = new
ConfigurationOptions { ServiceName = "mymaster" }; // Get master Redis
connection var redisMasterConnection =
sentinelConnection.GetSentinelMasterConnection(masterConfig);
Console.WriteLine("trying db set"); IDatabase db =
redisMasterConnection.GetDatabase(); db.StringSet("key", "value");
and the error i get is the connection is not a sentinel connection when
the line with "GetSentinelMasterConnection" runs
Please help
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#1580>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAEHMFPFGRBYOEWDIHSMJDSJUD3ZANCNFSM4SICUC5Q>
.
|
Thanks for the response! I actually left a line out, I did have the service name
This wouldn't work until i added CommandMap = CommandMap.Default to
|
I'm not sure of the intent here - if you connect to the sentinel normally, we'll connect down to the master, are you wanting to do something with knowledge of the master underneath? Or do you just want to connect to whatever the master is and switch when Sentinel says to? If it's the latter, that's built-in and much simpler :) |
Instead of building the config object and call the
|
I think we may be talking past each other. In a current version of the client, you need only connect to the Sentinel instance (any of them) and provide a service name on the connection string. The client already handles connecting to the master and switching when it changes. If you're doing this manually: alrighty, and good luck, but there's no need - it's built-in now. |
@NickCraver, the problem is that some libraries like StackExchange.Redis.Extensions use the signature with Possible workaround : private static async Task<ConnectionMultiplexer> SentinelMasterConnectAsync(ConfigurationOptions configuration, TextWriter log = null)
{
var sentinelConnection = await SentinelConnectAsync(configuration, log).ForAwait();
// This line fix the problem
configuration.CommandMap = CommandMap.Default;
var muxer = sentinelConnection.GetSentinelMasterConnection(configuration, log);
// set reference to sentinel connection so that we can dispose it
muxer.sentinelConnection = sentinelConnection;
return muxer;
} |
What I'd really like to do there is get a reliable example that fails in
the way you say. Unfortunately the sentinel tests are a bit... "Brittle",
at the moment...
…On Thu, 26 Nov 2020, 17:46 Quentin JOSEPH, ***@***.***> wrote:
@NickCraver <https://github.com/NickCraver>, the problem is that some
libraries like StackExchange.Redis.Extensions use the signature with
ConfigurationOption parameter instead of connection string parameter and
so there is a problem when try to retrieve the MasterConnection with
CommandMap.Sentinel configured.
Possible workaround :
private static async Task<ConnectionMultiplexer> SentinelMasterConnectAsync(ConfigurationOptions configuration, TextWriter log = null)
{
var sentinelConnection = await SentinelConnectAsync(configuration, log).ForAwait();
// This line fix the problem
configuration.CommandMap = CommandMap.Default;
var muxer = sentinelConnection.GetSentinelMasterConnection(configuration, log);
// set reference to sentinel connection so that we can dispose it
muxer.sentinelConnection = sentinelConnection;
return muxer;
}
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#1580 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAEHMEDXTMO3X525ZUI5VLSR2IAFANCNFSM4SICUC5Q>
.
|
@qjoseph I have the same problem. |
As Marc said here - we'd need an example here. The bug report here is basically "another library you don't control does something I don't expect" - okay, understood, but that's not something we're going to spend a half day chasing down. If anyone can provide a repro, we'd be happy to take a look. The time investment is high otherwise (you ma be familiar with this library, and it may be quick to reproduce...but we are not, and we don't have your setup, so chasing down the scenario based on limited into is a large and possibly fruitless time sink). I don't know how this library is connecting in code or what configuration they're doing on the way in. It seems like the command map is off but it's unclear how, or even exactly what you're trying to do here (e.g. which connection we're after). |
@jeremiahedge Did you ever solve this? I've got the same problem. Exception gets thrown: var configurationOptions = new ConfigurationOptions
{
AllowAdmin = false,
AbortOnConnectFail = false,
ServiceName = "mymaster",
EndPoints =
{
options.Value.RedisConnectionString,
},
};
_conn = ConnectionMultiplexer.SentinelConnect(configurationOptions, Console.Out);
_db = _conn.GetDatabase(0); At this point I expect to be able to use |
Never mind. I figured it out. This is what I ended up doing: var sentinelConfig = new ConfigurationOptions
{
AllowAdmin = false,
AbortOnConnectFail = false,
CommandMap = CommandMap.Sentinel,
EndPoints =
{
options.Value.RedisConnectionString,
},
};
var masterConfig = new ConfigurationOptions
{
CommandMap = CommandMap.Default,
ServiceName = "mymaster",
};
var sentinel = ConnectionMultiplexer.SentinelConnect(sentinelConfig, Console.Out);
_conn = sentinel.GetSentinelMasterConnection(masterConfig, Console.Out);
_db = _conn.GetDatabase(0); |
It looks like there's a workaround above. If there's another library we can advise on how to better use us/configure the command map, I'm still happy to help but cannot do more without more info here. Let us know if there's more to go on! |
Это все еще не работает! |
I keep running into an issue when i use sentinelconnect, i get all the commandmaps added without me doing it. I've use the latest from the myget stackoverflow package
my code
First output in the console is this: localhost:26379,abortConnect=False,$NONE=,$APPEND=,$ASKING=,$BGREWRITEAOF=,$BGSAVE=,$BITCOUNT=,$BITOP=,$BITPOS=,$BLPOP=,$BRPOP=,$BRPOPLPUSH=,$CLIENT=,$CLUSTER=,$CONFIG=,$DBSIZE=,$DEBUG=,$DECR=,$DECRBY=,$DEL=,$DISCARD=,$DUMP=,$ECHO=,$EVAL=,$EVALSHA=,$EXEC=,$EXISTS=,$EXPIRE=,$EXPIREAT=,$FLUSHALL=,$FLUSHDB=,$GEOADD=,$GEODIST=,$GEOHASH=,$GEOPOS=,$GEORADIUS=,$GEORADIUSBYMEMBER=,$GET=,$GETBIT=,$GETRANGE=,$GETSET=,$HDEL=,$HEXISTS=,$HGET=,$HGETALL=,$HINCRBY=,$HINCRBYFLOAT=,$HKEYS=,$HLEN=,$HMGET=,$HMSET=,$HSCAN=,$HSET=,$HSETNX=,$HSTRLEN=,$HVALS=,$INCR=,$INCRBY=,$INCRBYFLOAT=,$KEYS=,$LASTSAVE=,$LATENCY=,$LINDEX=,$LINSERT=,$LLEN=,$LPOP=,$LPUSH=,$LPUSHX=,$LRANGE=,$LREM=,$LSET=,$LTRIM=,$MEMORY=,$MGET=,$MIGRATE=,$MONITOR=,$MOVE=,$MSET=,$MSETNX=,$MULTI=,$OBJECT=,$PERSIST=,$PEXPIRE=,$PEXPIREAT=,$PFADD=,$PFCOUNT=,$PFMERGE=,$PSETEX=,$PTTL=,$PUBLISH=,$PUBSUB=,$QUIT=,$RANDOMKEY=,$READONLY=,$READWRITE=,$RENAME=,$RENAMENX=,$REPLICAOF=,$RESTORE=,$RPOP=,$RPOPLPUSH=,$RPUSH=,$RPUSHX=,$SADD=,$SAVE=,$SCAN=,$SCARD=,$SCRIPT=,$SDIFF=,$SDIFFSTORE=,$SELECT=,$SET=,$SETBIT=,$SETEX=,$SETNX=,$SETRANGE=,$SINTER=,$SINTERSTORE=,$SISMEMBER=,$SLAVEOF=,$SLOWLOG=,$SMEMBERS=,$SMOVE=,$SORT=,$SPOP=,$SRANDMEMBER=,$SREM=,$STRLEN=,$SUNION=,$SUNIONSTORE=,$SSCAN=,$SWAPDB=,$SYNC=,$TIME=,$TOUCH=,$TTL=,$TYPE=,$UNLINK=,$UNWATCH=,$WATCH=,$XACK=,$XADD=,$XCLAIM=,$XDEL=,$XGROUP=,$XINFO=,$XLEN=,$XPENDING=,$XRANGE=,$XREAD=,$XREADGROUP=,$XREVRANGE=,$XTRIM=,$ZADD=,$ZCARD=,$ZCOUNT=,$ZINCRBY=,$ZINTERSTORE=,$ZLEXCOUNT=,$ZPOPMAX=,$ZPOPMIN=,$ZRANGE=,$ZRANGEBYLEX=,$ZRANGEBYSCORE=,$ZRANK=,$ZREM=,$ZREMRANGEBYLEX=,$ZREMRANGEBYRANK=,$ZREMRANGEBYSCORE=,$ZREVRANGE=,$ZREVRANGEBYLEX=,$ZREVRANGEBYSCORE=,$ZREVRANK=,$ZSCAN=,$ZSCORE=,$ZUNIONSTORE=,$UNKNOWN=
As you can see, I'm not adding a map, however sentinelconnect adds all of these to the connection string.
I've also tried this
and the error i get is the connection is not a sentinel connection when the line with "GetSentinelMasterConnection" runs
Please help
The text was updated successfully, but these errors were encountered: