redis-server in ubuntu14.04: Bind address already in use

非 Y 不嫁゛ 提交于 2019-11-28 21:23:59
$ 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

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
aruns

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 solved this problem on Mac by just typing redis-cli shutdown, after this just re open the terminal and type redid-server and it will work .

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
sudo service redis-server stop

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 :)

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!