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
Related
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"
I have the script below.
OUTPUT_FOLDER=/home/user/output
LOGFILE=/root/log/test.log
HOST_FILE=/home/user/host_file.txt
mkdir -p $OUTPUT_FOLDER
rm -f $OUTPUT_FOLDER/*
pssh -h $HOST_FILE -o $OUTPUT_FOLDER "cat $LOGFILE | tail -n 100 | grep foo"
When I run this script on its own, it works fine and the $OUTPUT_FOLDER contains the output from the servers in the $HOST_FILE. However, when I ran the script as a cronjob, the $OUTPUT_FOLDER is created, but it's always empty. It's as if the pssh command was never executed.
Why is this? How do I resolve this?
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
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
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