Redis CLI Rename Key - ERR unknown command RENAME with args - redis

I have a redis-cli script that I can run locally (from Win10) but it fails when I run it against the server (Linux) with rename command.
After connecting with redis-cli (from Win10), I run the following:
SET "someinstance.domain.us:mytenant:MyDailyData:2018.1.10" "Hello123"
GET "someinstance.domain.us:mytenant:MyDailyData:2018.1.10"
RENAME "someinstance.domain.us:mytenant:MyDailyData:2018.1.10" "TEMP:someinstance.domain.us:mytenant:MyDailyData:2018.1.10"
DEL "TEMP:someinstance.domain.us:mytenant:MyDailyData:2018.1.10"
GET "TEMP:someinstance.domain.us:mytenant:MyDailyData:2018.1.10"
while locally everything is OK, when I run it against the server, I get the following output:
my-redis-address:6379> SET "someinstance.domain.us:mytenant:MyDailyData:2018.1.10" "Hello123"
OK
my-redis-address:6379> GET "someinstance.domain.us:mytenant:MyDailyData:2018.1.10"
"Hello123"
my-redis-address:6379> RENAME "someinstance.domain.us:mytenant:MyDailyData:2018.1.10" "TEMP:someinstance.domain.us:mytenant:MyDailyData:2018.1.10"
(error) ERR unknown command `RENAME`, with args beginning with: `someinstance.domain.us:mytenant:MyDailyData:2018.1.10`, `TEMP:someinstance.domain.us:mytenant:MyDailyData:2018.1.10`,
my-redis-address:6379> DEL "TEMP:someinstance.domain.us:mytenant:MyDailyData:2018.1.10"
(integer) 0
my-redis-address:6379> GET "TEMP:someinstance.domain.us:mytenant:MyDailyData:2018.1.10"
(nil)
my-redis-address:6379>
(error) ERR unknown command RENAME, with args beginning with: someinstance.domain.us:mytenant:MyDailyData:2018.1.10, TEMP:someinstance.domain.us:mytenant:MyDailyData:2018.1.10,
redis server details:
gcc_version 5.4.0
os Linux 4.4.0-176-generic x86_64
redis_build_id 452d9690a8de23a2
redis_mode standalone
redis_version 5.0.7
What am I doing wrong here? Is it that I am running Win10 cli against Linux Redis server that causes it?
thanks!

Conclusion
The RENAME command has been rename to something meaningless on your server.
Solution
Check the redis.conf file on the server whether there is a line rename-command RENAME xxx. If so, comment it and restart the Redis server.(if the server is online, contact the administrator first)
From redis.conf:
# It is possible to change the name of dangerous commands in a shared
# environment. For instance the CONFIG command may be renamed into something
# hard to guess so that it will still be available for internal-use tools
# but not available for general clients.
#
# Example:
#
# rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52

Related

Redis installed on FreeBSD via pkg or ports can not run

I had installed redis on FreeBSD via pkg yesterday.And also add redis_enable="YES"in my /etc/rc.conf.
When I run service redis start,It displays Starting redis,but when run service redis status,displays redis is not running.
After run redis-server,It runs,but use redis-cli cannot connect the server.
When run redis-cli or redis-cli ping,it will jammed with no error.
The redis log file also has no error.
I cannot find the solution with google or others。How should I do to use redis?
The same with installed redis via ports
The followings are the base information about my company:
FreeBSD version: 10.3-RELEASE-p18
Pkg version: 1.10.1
Redis version: 3.29
I would suggest to update, reinstall by doing this:
# pkg update
then:
# pkg upgrade -y
To reinstall redis:
# pkg remove -y redis
To install it again:
# pkg install -y redis
At this point you should see this in the terminal:
===> CONFIGURATION NOTE:
To setup "redis" you need to edit the configuration file:
/usr/local/etc/redis.conf
To run redis from startup, add redis_enable="YES"
in your /etc/rc.conf.
To ensure redis is enabled on startup use sysrc
# sysrc redis_enable="YES"
Not this time try to starting calling the script directly:
# /usr/local/etc/rc.d/redis start
You could use sockstat to check if is up and listenin:
# sockstat -4l
USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS
redis redis-serv 9553 4 tcp4 127.0.0.1:6379 *:*
After this, redis-cli, or telnet 0 6379 should be working:
# telnet 0 6379
Trying 0.0.0.0...
Connected to 0.
Escape character is '^]'.
If that still not working, maybe ktrace can help to find more details:
To trace a PID:
$ ktrace -p 9553
To stop tracing:
# ktrace -C
use kdump to display kernel trace data
# kdump -f my-ktrace.out | less
The first thing to do on BSD when a command "hungs" is to press ^T (ie ctrl-t). Can you do that and paste the output?

Redis as service fails with error code 87

I have installed Redis-64 using the chocolately package. When I try and install redis as a service on windows with command:
redis-server.exe --service-install
I get the following error:
# HandleServiceCommands: system error caught. error code=1073, message = CreateService failed: unknown error
I have also tried just executing the exe on its own, but get another different error:
# Creating Server TCP listening socket *:6379: bind: No such file or directory
Has anyone else got this error before?
Go to redis path and then
1) C:\Program Files\Redis>redis.windows.conf it will open file
2) Change port to 16379(higher) then run
3) C:\Program Files\Redis>redis-server.exe redis.windows.conf
I had the same error when running the exe. (No such file or directory)
It worked when using a higher port in redis.windows.conf:
port 16379
and then run
c:\Program Files\Redis>redis-server.exe redis.windows.conf
What is meant by run
cd to c:\Program Files\Redis
then:
run redis-server.exe redis.windows.conf on command prompt
Changing the port to higher has solved the error for me.
Change the port in two files
redis.windows-service.conf and redis.windows.conf
And then run
c:\Program Files\Redis>redis-server.exe redis.windows.conf
c:\Program Files\Redis>redis-server.exe redis.windows-service.conf
After run you can see below description
For me the default port was already in use. I checked this by:
Pressing Windows + R
Typing resmon.exe
Going to Network > Listening Ports
There I saw that I already had a redis process running on port 6379, so I:
Opened Task Manager
Found redis-server.exe
Right click > End task
You can also end the process by running redis-server --service-stop.
Then redis-server --service-start worked as expected, no need to change config files.

REDIS (error) ERR unknown command 'set' on Redis 3.0.4

I just installed Redis 3.0.4 on Ubuntu Server 11.04.3 LTS
I'm running redis-cli but when I type
127.0.0.1:6379> set myKey hello
or
127.0.0.1:6379> set myKey 'hello'
or
127.0.0.1:6379> set myKey "hello"
it displays
(error) ERR unknown command 'set'
if I type
127.0.0.1:6379> help set
it displays
SET key value [EX seconds] [PX milliseconds] [NX|XX]
summary: Set the string value of a key
since: 1.0.0
group: string
I leave here the info that Redis gave me for more help
127.0.0.1:6379> info
# Server
redis_version:3.0.4
redis_git_sha1:00000000
redis_git_dirty:0
redis_build_id:ca8b1c102698f8cb
redis_mode:sentinel
os:Linux 3.19.0-25-generic x86_64
arch_bits:64
multiplexing_api:epoll
gcc_version:4.8.4
process_id:1196
run_id:28b1360b9c9c17d2c4645a0b541a080c6c35a263
tcp_port:6379
uptime_in_seconds:3212
uptime_in_days:0
hz:18
lru_clock:1675551
config_file:/etc/redis.conf
thanks for any help
You probably ran as redis-sentinal <...redis.conf> but your redis master is not running or unavailable or was never configured. sentinal is a failover mechanism and mostly runs on different node than master.
If you want to run the redis server in standalone mode you can just run this
redis-server < path to redis.conf>. This will let you connect and get going.
I found a solution to the problem
at the config file redis.conf I put a valid path to the directive "dir" under SNAPSHOTTING
dir /some/valid/path/
also have to change the default value of 128 on /proc/sys/net/core/somaxconn to 511
and just restart the service and it worked
In my case the redis.conf file had
############################### Disable some dangerous commands ##############
rename-command CONFIG ""
by commenting that line and restarted redis solved it

Docker-machine : ca.pem not found

Here i am creating a test machine(dev) using the docker machine.
$ docker-machine create -d virtualbox dev
Creating CA: C:\Users\xxx\.docker\machine\certs\ca.pem
Creating client certificate: C:\Users\xxx\.docker\machine\certs\cert.pem
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
The vm gets created and runs with out flaws.
And here is the error when i run the following command:
$ docker-machine env dev
open C:\Users\xxx\.docker\machine\machines\dev\ca.pem: The system cannot fin
d the file specified.
I have no idea how to deal with this problem. Tried restarting boot2docker.
You should try using docker-machine regenerate-certs dev. The problem i think is that somehow your .pem file got deleted or was not created. I had the same issue and regenerating the certs fixed the problem (reboot did not help btw).
I guess you are getting Docker-machine : ca.pem not found error even when you use docker info or any command with docker
Try this command: docker-machine env -u
output will be similar to:
unset DOCKER_TLS_VERIFY
unset DOCKER_HOST
unset DOCKER_CERT_PATH
unset DOCKER_MACHINE_NAME
# Run this command to configure your shell:
# eval $(docker-machine env -u)
now enter eval $(docker-machine env -u)
this should do the work. Try docker info to be sure finally.
I was getting the exact same error. It turned out to be the Cisco AnyConnect client affecting my networking settings. It's not enough to quit AnyConnect, you have to reboot your machine to restore your settings.
If someone knows more about how AnyConnect is affecting things and if there are solutions better than rebooting, I'd love to hear about it!
Copy certificates from "C:\Users\xxx\.docker\machine\certs"
Paste certificates to "C:\Users\xxx\.docker\machine\machines\dev"
NOTE: This error was on Windows 10 Docker
Here was my error:
#user ➜ git-repo git(users/user/dev) ✗ docker
unable to resolve docker endpoint: open C:\Users\user\.docker\ca.pem: The system cannot find the file specified.
Here is the link to the shell file I used to recreate the certificates I named it generate_docker_cert.sh:
https://gist.github.com/bradrydzewski/a6090115b3fecfc25280
So I went to that directory that the error output:
cd C:\Users\user\.docker\
Created that file:
notepad generate_docker_cert.sh
Copied the values from the link into there and saved.
Then ran that .sh file:
.\generate_docker_cert.sh
Then the docker command worked:
#user ➜ git-repo git(users/user/dev) ✗ docker
Usage: docker [OPTIONS] COMMAND
A self-sufficient runtime for containers
...

Redis "Fatal error, can't open config file 'restart'" after a crash

So after restarting my httpd redis crashed (due to the number of sudden requests sent via httpd and written on redis) and now when I try to restart redis on my centos 6.5 server I get the following error:
[root#host /]# /usr/sbin/redis-server restart
[1705] 17 Apr 00:30:49 # Fatal error, can't open config file 'restart'
I have also tried to login to redis using redis-cli and I get an error stating the connection to the server failed.
What options do I have to safely restart the server?
From the /src directory where you downloaded and unzipped your redis source, run the following. This is for RHEL based systems.
make install
# (OR)
sudo cp src/redis-server /usr/local/bin/
sudo cp src/redis-cli /usr/local/bin/