Unregistering a RedisGears registration using inline redis-cli command results in "ERR unknown command `RG_UNREGISTER`" - redis

When using redis-cli, I can unregister a RedisGears registration like this:
127.0.0.1:16379> RG.UNREGISTER "0000000000000000000000000000000000000000-4"
OK
When running this command as an inline redis-cli command, it fails:
$ redis-cli "RG_UNREGISTER 0000000000000000000000000000000000000000-6"
(error) ERR unknown command `RG_UNREGISTER 0000000000000000000000000000000000000000-6`, with args beginning with:
$ echo "RG_UNREGISTER 0000000000000000000000000000000000000000-6" | redis-cli
(error) ERR unknown command `RG_UNREGISTER`, with args beginning with: `0000000000000000000000000000000000000000-6`,
How do I run RG_UNREGISTER as an inline redis-cli command?

Also:
redis-cli "RG.UNREGISTER" 0000000000000000000000000000000000000000-6

This will unregister a RedisGears registration as an inline redis-cli command:
$ echo "RG.UNREGISTER 0000000000000000000000000000000000000000-8" | redis-cli
This also works:
$ echo "0000000000000000000000000000000000000000-1" redis-cli -x "RG.UNREGISTER"

Related

Why do I get "(error) ERR unknown command: redis-cli" when in the REDIS console?

I am trying to delete some keys but cannot execute any redis-cli commands:
redis-cli --scan --patter 'assetInfo*' | xargs redis-cli del
The error is:
(error) ERR unknown command: redis-cli
I am using REDIS version 3.2.7. Does this version not support redis-cli?
What gives?
Update: When I do this without 'redis-cli' I get this:
Azure Redis Health Dev:0>--scan --pattern 'spout*' | xargs redis-cli del
ERR unknown command: --scan
The error you're getting is a Redis error, which means you're already connected (and probably inside the cli). redis-cli is a command line (i.e. shell) utility for opening a connection to Redis and running commands.
P.S. your --pattern switch is missing an "n"

Redis: (error) ERR unknown command 'redis-benchmark'

I'm trying to run some redis benchmark tests, but they're all giving the same error, unknown command redis-benchmark:
C:\>redis-cli
127.0.0.1:6379> redis-benchmark -t set,get -r 1000000 -q
(error) ERR unknown command 'redis-benchmark'
You cannot run the redis-benchmark command inside a redis-cli shell. It's not part of the redis-cli commands. Try a regular prompt instead:
Not working:
C:\>redis-cli
127.0.0.1:6379> redis-benchmark -t set,get -r 1000000 -q
Working:
C:\>redis-benchmark -t set,get -r 1000000 -q
Outputs something like:
SET: 111856.82 requests per second
GET: 108225.10 requests per second

How to enable sshpass output to console

Using scp and interactively entering the password the file copy progress is sent to the console but there is no console output when using sshpass in a script to scp files.
$ sshpass -p [password] scp [file] root#[ip]:/[dir]
It seems sshpass is suppressing or hiding the console output of scp. Is there a way to enable the sshpass scp output to console?
After
sudo apt-get install expect
the file send-files.exp works as desired:
#!/usr/bin/expect -f
spawn scp -r $FILES $DEST
match_max 100000
expect "*?assword:*"
send -- "12345\r"
expect eof
Not exactly what was desired, but better than silence:
SSHPASS="12345" sshpass -e scp -v -r $FILES $DEST 2>&1 | grep -v debug1
Note that -e is considered a bit safer than -p.
Output:
Executing: program /usr/bin/ssh host servername, user username, command scp -v -t /src/path/dst_file.txt
OpenSSH_6.6.1, OpenSSL 1.0.1i-fips 6 Aug 2014
Authenticated to servername ([10.11.12.13]:22).
Sending file modes: C0600 590493 src_file.txt
Sink: C0600 590493 src_file.txt
Transferred: sent 594696, received 2600 bytes, in 0.1 seconds
Bytes per second: sent 8920671.8, received 39001.0
In this way:
output=$(sshpass -p $PASSWD scp -v $filename root#192.168.8.1:/root 2>&1)
echo "Output = $output"
you redirect the console output in variable output.
Or, if you only want to see the console output of scp command, you should add only -v command in your ssh pass cmd:
sshpass -p $PASSWD scp -v $filename root#192.168.8.1:/root

using different database at redis command prompt

dThe following works as expected. But how do I insert the data into forth database instead of default "0" from command prompt?
# echo -n "testing" | /home/shantanu/redis-2.4.2/src/redis-cli -x set my_pass
OK
# echo -n "testing" | /home/shantanu/redis-2.4.2/src/redis-cli -x select 4; set my_pass
(error) ERR wrong number of arguments for 'select' command
Just use the -n argument to choose DB number. It available since Redis 2.4.2.
echo -n "testing" | redis-cli -n 4 -x set my_pass
or
redis-cli -n 4 set my_pass testing
Launch the CLI by issuing command:
redis-cli
Then use the following command:
select <db number>
For example:
select 4

Pipe data to redis

When I pipe the echo to redis client, I get an error.
[root#server ~]$ echo "abc43345" | redis-cli set my_passwd2
(error) ERR wrong number of arguments for 'set' command
But the following works as expected.
[root#server ~]$ redis-cli set my_passwd2 `echo "abc43345"`
OK
Is there any way to make the first example work?
It can actually be achieved using "-x" flag
echo "abc43345" | redis-cli -x set my_passwd2