我正在尝试使用 docker-compose 通过 Docker 连接 golang 和 reds,但我运气不佳。我已经在https://github.com/davidwilde/docker-compose-golang-redis/tree/stackoverflow_question 上发布了我的尝试,并在下面列出了日志。
Redis 说它已准备好接受连接,但我使用gopkg.in/redis.v3 的golang 应用程序说不。
~/workspace/composetest master ● docker-compose up
Starting composetest_db_1...
Starting composetest_web_1...
.
.
.
ur kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
db_1 | 1:M 20 Nov 05:58:33.371 * DB loaded from disk: 0.000 seconds
db_1 | 1:M 20 Nov 05:58:33.371 * The server is now ready to accept connections on port 6379
web_1 | panic: dial tcp [::1]:6379: getsockopt: connection refused
web_1 |
web_1 | goroutine 1 [running]:
web_1 | main.main()
web_1 | /go/src/app/app.go:19 +0x131
web_1 |
web_1 | goroutine 17 [syscall, locked to thread]:
web_1 | runtime.goexit()
web_1 | /usr/local/go/src/runtime/asm_amd64.s:1696 +0x1
web_1 | panic: dial tcp [::1]:6379: getsockopt: connection refused
web_1 |
web_1 | goroutine 1 [running]:
web_1 | main.main()
web_1 | /go/src/app/app.go:19 +0x131
web_1 |
web_1 | goroutine 17 [syscall, locked to thread]:
web_1 | runtime.goexit()
web_1 | /usr/local/go/src/runtime/asm_amd64.s:1696 +0x1
HUWWW
相关分类