I downloaded redis in docker. After configuration, I used redis-cli command to report the error COULD NOT CONNECT to Redisat 127.0.0.1: 6379
This is the first time to use docker. The following steps are all followed in the book. I don’t know what went wrong.
1. Download redis
sudo docker pull redis:latest
2. Start the redis Mirror Container and start the redis-server persistence service
sudo docker run --name redis-server -d redis redis-server --appendonly yes
3. Start Redis Mirror Container as a client to connect to redis-server
sudo docker run --rm=true -it --link redis-server:redis redis /bin/bash
After that, he entered bash inside Container.
REDIS_PORT_6379_TCP_PROTO=tcp
REDIS_PORT=tcp://172.17.0.2:6379
REDIS_NAME=/stupefied_bhaskara/redis
HOSTNAME=24f9eeb3e8e6
REDIS_PORT_6379_TCP_ADDR=172.17.0.2
REDIS_DOWNLOAD_SHA=fc53e73ae7586bcdacb4b63875d1ff04f68c5474c1ddeda78f00e5ae2eed1bbb
REDIS_PORT_6379_TCP=tcp://172.17.0.2:6379
REDIS_VERSION=4.0.11
REDIS_ENV_REDIS_DOWNLOAD_URL=http://download.redis.io/releases/redis-4.0.11.tar.gz
PWD=/data
HOME=/root
GOSU_VERSION=1.10
REDIS_DOWNLOAD_URL=http://download.redis.io/releases/redis-4.0.11.tar.gz
REDIS_PORT_6379_TCP_PORT=6379
TERM=xterm
REDIS_ENV_REDIS_DOWNLOAD_SHA=fc53e73ae7586bcdacb4b63875d1ff04f68c5474c1ddeda78f00e5ae2eed1bbb
REDIS_ENV_GOSU_VERSION=1.10
SHLVL=1
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
REDIS_ENV_REDIS_VERSION=4.0.11
_=/usr/bin/env
5. Use redis-cli to Report Errors in 5.bash
root@24f9eeb3e8e6:/data# redis-cli
Could not connect to Redis at 127.0.0.1:6379: Connection refused
Could not connect to Redis at 127.0.0.1:6379: Connection refused
Modify the preparation document “00-system.conf”,
net.ipv4.ip_forward=1
Solve the problem