redis make test报错couldn't open socket: Name or service not known.

2023-07-13 13:49:55 浏览数 (1)

环境

suse12.5

redis5.0.8

报错

在make test的时候报错如下:(端口不一定是11112, 也可能是11111)

代码语言:javascript复制
Starting test server at port 11112
Executing test client: couldn't open socket: Name or service not known.
couldn't open socket: Name or service not known
    while executing
"socket localhost $server_port"
    (procedure "test_client_main" line 2)
    invoked from within
"test_client_main $::test_server_port "
Executing test client: couldn't open socket: Name or service not known.

分析和解决

看起来是不能解析 localhost , 但该域名是代表本机啊, 测试(make test)的时候不能连接本机.

然后我修改 /etc/hosts(确实没有解析localhost) 添加 localhost解析127.0.0.1   localhost 后就可以了.

深层次的原因: 系统创建的时候把 >> 写为了 >

代码语言:javascript复制
echo "${IP} `hostname`" >> /etc/hosts
写为了
echo "${IP} `hostname`" > /etc/hosts   #追加变覆盖....

0 人点赞