Redis在留言板示例中给出错误

时间:2017-04-13 09:23:09

标签: php kubernetes

我一直在使用本地群集运行kubernetes e2e一致性测试。当我运行留言板测试时,我可以看到所有的pod正在运行:

```

[root@localhost kubernetes]# cluster/kubectl.sh get pods --all-namespaces
NAMESPACE                 NAME                            READY     STATUS    RESTARTS   AGE
e2e-tests-kubectl-6z70j   frontend-1478469098-3hc82       1/1       Running   0          22s
e2e-tests-kubectl-6z70j   frontend-1478469098-673gg       1/1       Running   0          22s
e2e-tests-kubectl-6z70j   frontend-1478469098-hblqz       1/1       Running   0          22s
e2e-tests-kubectl-6z70j   redis-master-1101892589-vd4gm   1/1       Running   0          21s
e2e-tests-kubectl-6z70j   redis-slave-2881398718-58fq2    1/1       Running   0          21s
e2e-tests-kubectl-6z70j   redis-slave-2881398718-vqdvf    1/1       Running   0          21s
kube-system               kube-dns-3884805971-4sh48       3/3       Running   0          2h

```

但测试失败并出现错误:

```

Apr 13 04:08:29.608: INFO: Failed to get response from guestbook. err: <nil>, response: <br />
<b>Fatal error</b>:  Uncaught exception 'Predis\Response\ServerException' with message 'DENIED Redis is running in protected mode because protected mode is enabled, no bind address was specified, no authentication password is requested to clients. In this mode connections are only accepted from the loopback interface. If you want to connect from external computers to Redis you may adopt one of the following solutions: 1) Just disable protected mode sending the command 'CONFIG SET protected-mode no' from the loopback interface by connecting to Redis from the same host the server is running, however MAKE SURE Redis is not publicly accessible from internet if you do so. Use CONFIG REWRITE to make this change permanent. 2) Alternatively you can just disable the protected mode by editing the Redis configuration file, and setting the protected mode option to 'no', and then restarting the server. 3) If you started the server manually just for testing, restart it with the '--protected-mode no' option. 4) Setup a bind address or an authen in <b>/usr/local/lib/php/Predis/Client.php</b> on line <b>370</b><br />

```

现在,我手动登录到redis-slave容器并在guestbook.php上执行了wget:

```

root@redis-slave-2881398718-vqdvf:/data# wget http://10.0.0.175:80/guestbook.php
converted 'http://10.0.0.175:80/guestbook.php' (ANSI_X3.4-1968) -> 'http://10.0.0.175:80/guestbook.php' (UTF-8)
--2017-04-13 09:08:41--  http://10.0.0.175/guestbook.php
Connecting to 10.0.0.175:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: 'guestbook.php'

guestbook.php                                     [ <=>                                                                                             ]  82.54K  --.-KB/s   in 0s     

2017-04-13 09:08:41 (224 MB/s) - 'guestbook.php' saved [84518]

```

以下是redis-slave上的env变量:

```

root@redis-slave-2881398718-vqdvf:/data# env
FRONTEND_PORT_80_TCP_ADDR=10.0.0.175
REDIS_SLAVE_PORT_6379_TCP=tcp://10.0.0.80:6379
REDIS_SLAVE_SERVICE_HOST=10.0.0.80
HOSTNAME=redis-slave-2881398718-vqdvf
REDIS_DOWNLOAD_URL=http://download.redis.io/releases/redis-3.2.0.tar.gz
KUBERNETES_PORT=tcp://10.0.0.1:443
KUBERNETES_PORT_443_TCP_PORT=443
TERM=xterm
FRONTEND_PORT_80_TCP_PORT=80
REDIS_SLAVE_PORT=tcp://10.0.0.80:6379
KUBERNETES_SERVICE_PORT=443
KUBERNETES_SERVICE_HOST=10.0.0.1
GET_HOSTS_FROM=dns
FRONTEND_PORT_80_TCP_PROTO=tcp
REDIS_MASTER_PORT_6379_TCP_ADDR=10.0.0.153
REDIS_MASTER_PORT_6379_TCP=tcp://10.0.0.153:6379
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
REDIS_SLAVE_PORT_6379_TCP_PROTO=tcp
REDIS_MASTER_SERVICE_PORT=6379
PWD=/data
REDIS_SLAVE_SERVICE_PORT=6379
FRONTEND_PORT=tcp://10.0.0.175:80
FRONTEND_SERVICE_PORT=80
REDIS_MASTER_SERVICE_HOST=10.0.0.153
SHLVL=1
HOME=/root
FRONTEND_SERVICE_HOST=10.0.0.175
REDIS_SLAVE_PORT_6379_TCP_ADDR=10.0.0.80
KUBERNETES_PORT_443_TCP_PROTO=tcp
REDIS_DOWNLOAD_SHA1=0c1820931094369c8cc19fc1be62f598bc5961ca
REDIS_VERSION=3.2.0
KUBERNETES_SERVICE_PORT_HTTPS=443
REDIS_MASTER_PORT_6379_TCP_PORT=6379
FRONTEND_PORT_80_TCP=tcp://10.0.0.175:80
REDIS_SLAVE_PORT_6379_TCP_PORT=6379
REDIS_MASTER_PORT_6379_TCP_PROTO=tcp
GOSU_VERSION=1.7
REDIS_MASTER_PORT=tcp://10.0.0.153:6379
KUBERNETES_PORT_443_TCP_ADDR=10.0.0.1
KUBERNETES_PORT_443_TCP=tcp://10.0.0.1:443
_=/usr/bin/env

```

你能帮我调试一下这个问题吗? TIA。

0 个答案:

没有答案