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
i had a backup from dump.rdb database in my last server and i just copied it with scp command to new server and i restore it like this :
service redis-server stop
cp -r /root/dump.rdb/ /var/lib/redis/
cd /var/lib/redis && chown redis:redis dump.rdb
service redis-server start
but after using the last command i got this error :
Job for redis-server.service failed because a configured resource limit was exceeded. See "systemctl status redis-server.service" and "journalctl -xe" for details.
as i know it maybe from redis version but i dont know what version is my Dump.rdb is for .
do you have any solution for this ?
at least i found this out that my redis version was lower than Database's Saved redis version .
you can load the lower redis databases on high versions but you can't lost higher versions in lower versions .
and when i use sudo apt-get install redis-server it just installs the lower versions of redis which is commited in ubuntu community .
so i installed the new one with the commands :
wget redis-4.0.8.tar.gz
tar -xzf redis-4.0.8.tar.gz
cd redis-4.0.8
make
make install
make test
then i have to edit redis.conf like this :
nano redis.conf
i set the database name like this :
dbfilename dump.rdb
and at least i set the database directory :
dir /var/lib/redis/
then press CTRL + X then Y then ENTER .
then use these commands :
cd src
redis-server
now just close the terminal without anything .
now reconnect and test :
redis-cli get PING
it have to treat like this :
127.0.0.1:6379> "PONG"
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?
I started redis server on ubuntu by typing this on terminal: $redis-server
This results in following > http://paste.ubuntu.com/12688632/
aruns ~ $ redis-server
27851:C 05 Oct 15:16:17.955 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf
27851:M 05 Oct 15:16:17.957 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
27851:M 05 Oct 15:16:17.957 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
27851:M 05 Oct 15:16:17.958 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
27851:M 05 Oct 15:16:17.958 # Creating Server TCP listening socket *:6379: bind: Address already in use
How can I fix this problem, it there any manual or automated process to fix this binding.
$ ps aux | grep redis
Find the port that its running on.. In my case..
MyUser 8821 0.0 0.0 2459704 596 ?? S 4:54PM 0:03.40 redis-server *:6379
And then close the port manually
$ kill -9 8821
Re-run redis
$ redis-server
sudo service redis-server stop
I solved this problem on Mac by just typing redis-cli shutdown, after this just
re open the terminal and type redis-server and it will work .
for me, after lots of problems, this solved my issue:
root#2c2379a99b47:/home/ ps -aux | grep redis
redis 3044 0.0 0.0 37000 8780 ? Ssl 14:59 0:00 /usr/bin/redis-server *:6379
after finding redis, kill it!
root#2c2379a99b47:/home# sudo kill -9 3044
root#2c2379a99b47:/homek# sudo service redis-server restart
Stopping redis-server: redis-server.
Starting redis-server: redis-server.
root#2c2379a99b47:/home# sudo service redis-server status
redis-server is running
So as it says, the process is already running so the best to do is to stop it, analyse and restart it and todo so here are the following commands :
redis-cli ping #should return 'PONG'
And this solved my issue:
$ ps -ef |grep redis
root 6622 4836 0 11:07 pts/0 00:00:00 grep redis
redis 6632 1 0 Jun23 ? 04:21:50 /usr/bin/redis-server *:6379
Locate redis process, and stop it!
$ kill -9 6632
$ service redis restart
Stopping redis-server: [ OK ]
Starting redis-server: [ OK ]
$ service redis status
Otherwise if all this doesn't work just try to type redis-cli
Hope it helps :)
This works for me:
$ killall redis-server
And combining everything in one line:
$ killall redis-server; redis-server
I read the documentation on http://www.redis.io , I opened the redis.conf file to configure the redis-server, its located at /etc/redis/redis.conf
$ sudo subl /etc/redis/redis.conf
Instead of sublime editor you can use editor of your choice, viz. nano, vi, emacs, vim, gedit.
In this file I uncommented the #bind 127.0.0.1 line. Hence, instead of 0.0.0.0:6379 now its 127.0.0.1:6379
Restart the redis server
$ sudo service redis-server restart
It will state, The server is now ready to accept connections on port 6379
This will put your server up, For any more detailed configuration and settings you can follow this redis-server on ubuntu
I prefer to use the command param -ef,
ps -ef|grep redis
the -efmeans
-A Display information about other users' processes, including those
without controlling terminals.
-e Identical to -A.
-f Display the uid, pid, parent pid, recent CPU usage, process start
time, controlling tty, elapsed CPU usage, and the associated com-
mand. If the -u option is also used, display the user name
rather then the numeric uid. When -o or -O is used to add to the
display following -f, the command field is not truncated as se-
verely as it is in other formats.
then kill the pid
kill -9 $pid
You may try
$ make
then
$ sudo cp src/redis-cli /usr/local/bin/ on terminal to install the redis and it's redis-cli command.
finally, you can use the redis-cli shutdown command. Hope this answer could help you.
Killing the process that was running after booting in the OS worked for me. To prevent redis from starting at startup in Ubuntu OS:
sudo systemctl disable redis-server
In my case, I tried several times to kill the port manually and didn't work. So I took the easy path, reinstallation and worked like charm after that. If you're in Debian/Ubuntu:
sudo apt remove redis-server // No purge needed
sudo apt update
sudo apt install redis-server // Install once again
sudo systemctl status redis-server // Check status of the service
redis-server // initializes redis
Not the most technical-wise path, but nothing else worked.
It may also happen if you installed Redis via snap and are trying to run it from somewhere else.
If this is the case, you can stop the service via sudo snap stop redis.
I'm not sure, but when I first time installed redis and faced this message, turned out that's due to the redis-server first of all takes configure parameters or path/to/redis.conf, so when I passed nothing after "redis-server" it was trying to execute default redis.conf (bind 127.0.0.1, port 6379 ...) thereby overwrite the existing default redis.conf (which contains same "bind" and "port"!!). That's why I've seen this error, but it's possibly you have another reasons
The problem shows that the default port that redis uses 6379is already in use by some other process.
So simply change the port of redis server
redis-server --port 7000 will start a Redis server using port number 7000.
and then
redis-cli -p 7000 - Now use this to make your client listen at this port.
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/