'config set' returns 'unknown command'

188 views
Skip to first unread message

Eugenia Shraiman

unread,
Apr 25, 2018, 4:59:56 PM4/25/18
to Redis DB

I am developing an application which has to get event notifications when some object expires. 
To get notifications I have to set the 'notify-keyspace-events' filter or events won't be delivered.

I can set the filter from the redis CLI or redis.conf file and then my application can subscribe and start getting notifications. 
But I really need to set this filter dynamically, yes it will be set from another process, which will set the filter, create a redis object and set expiration time for this object.

My code is in C++ and I am using redisclient. My Redis server version 4.0.8

I use the redisclient command() function and the 'config set' command which works for me on the CLI::
    redisClient.command("config set", {"notify-keyspace-events", "KEA"},
               std::bind(&Worker::onConfig, this, std::placeholders::_1));
The above gives me an error:  "ERR unknown command 'config set'".

When I look at the implementation of command() and doAsyncCommand() functions they are very generic and just post the request to the redis server. 

Is there anything I am doing wrong? Why the same command that works from the CLI does not work from redisclient?

Thank you for your help.

Itamar Haber

unread,
Apr 26, 2018, 3:05:30 AM4/26/18
to Redis DB
Hello Eugenia,

I don't have a definite answer, but rather a strong hunch. Note that the command's name is "config", "get" is a subcommand or an argument. What happens when you treat it like that?

Cheers,
Itamar

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at https://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

Eugenia Shraiman

unread,
Apr 26, 2018, 8:02:19 AM4/26/18
to redi...@googlegroups.com
Hi Itamar,

Thank you for answering. Yes I thought about it, the only command I am trying to use that has two words to it. I am not sure I know how to use it as a subcommand. Can you, please, give me an example.

Thanks again, Eugenia.

On Thu, Apr 26, 2018 at 3:05 AM, Itamar Haber <ita...@redislabs.com> wrote:
Hello Eugenia,

I don't have a definite answer, but rather a strong hunch. Note that the command's name is "config", "get" is a subcommand or an argument. What happens when you treat it like that?

Cheers,
Itamar
On Wed, Apr 25, 2018, 13:59 Eugenia Shraiman <eshr...@mutualink.net> wrote:

I am developing an application which has to get event notifications when some object expires. 
To get notifications I have to set the 'notify-keyspace-events' filter or events won't be delivered.

I can set the filter from the redis CLI or redis.conf file and then my application can subscribe and start getting notifications. 
But I really need to set this filter dynamically, yes it will be set from another process, which will set the filter, create a redis object and set expiration time for this object.

My code is in C++ and I am using redisclient. My Redis server version 4.0.8

I use the redisclient command() function and the 'config set' command which works for me on the CLI::
    redisClient.command("config set", {"notify-keyspace-events", "KEA"},
               std::bind(&Worker::onConfig, this, std::placeholders::_1));
The above gives me an error:  "ERR unknown command 'config set'".

When I look at the implementation of command() and doAsyncCommand() functions they are very generic and just post the request to the redis server. 

Is there anything I am doing wrong? Why the same command that works from the CLI does not work from redisclient?

Thank you for your help.

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+unsubscribe@googlegroups.com.

To post to this group, send email to redi...@googlegroups.com.
Visit this group at https://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+unsubscribe@googlegroups.com.

Eugenia Shraiman

unread,
Apr 26, 2018, 8:09:33 AM4/26/18
to redi...@googlegroups.com
Hi, pls disregard my previous question. I tried to use 'set' as an argument and it worked fine:

 redisClient.command("config", {"set", "notify-keyspace-events", "KEA"},
                     
std::bind(&Worker::onConfig, this, std::placeholders::_1));
Thanks for your help, Eugenia.
Reply all
Reply to author
Forward
0 new messages