CHINA PHP CODER

CHINA PHP CODER

Who am I?

I am a china php coder.


What I write about


Recent Posts

unable to bind socket的解决方法

  执行redis-server命令启动redis的时候,会报这个错误。百度google之后也没有找到解决方法。最终发现是因为配置文件某个参数不正确而引起的。

Creating Server TCP listening socket *:6379: unable to bind socket

错误的原因是由于没有指定bind参数。

在配置文件中加入

bind 127.0.0.1

如果需要监听多个ip,bind后面可以跟多个ip

bind 127.0.0.1 10.11.0.1 192.168.1.1

如果需要监听本机所有ip

bind *

以上3种写法都是正确,但是不写bind参数就会报错

# Creating Server TCP listening socket *:6379: unable to bind socket

# By default, if no "bind" configuration directive is specified, Redis listens
# for connections from all the network interfaces available on the server.
# It is possible to listen to just one or multiple selected interfaces using
# the "bind" configuration directive, followed by one or more IP addresses.