postgresql - 无法从 redash 连接到 localhost
问题描述
我正在尝试从 Redash 连接到本地 postgres。(来自 redash.io 和http://0.0.0.0:5000/)但无法连接到它。我可以连接本地主机的其他工具,但从 Redash 我得到错误:
Connection Test Failed:
could not connect to server: Connection refused Is the server running
on host "localhost" (::1) and accepting TCP/IP connections on port
5432? could not connect to server: Connection refused Is the server
running on host "localhost" (127.0.0.1) and accepting TCP/IP
connections on port 5432?
任何想法可能是什么问题?我正在为我的本地 Redash 使用 docker,这可能会导致问题,但我也从 redash.io 收到相同的错误。
这是我的 docker-compose 文件:
# This configuration file is for **development** setup. For production, refer to
# docker-compose.production.yml.
version: '2'
services:
server:
build: .
command: dev_server
depends_on:
- postgres
- redis
ports:
- "5000:5000"
volumes:
- ".:/app"
environment:
PYTHONUNBUFFERED: 0
REDASH_LOG_LEVEL: "INFO"
REDASH_REDIS_URL: "redis://redis:6379/0"
REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
worker:
build: .
command: scheduler
volumes_from:
- server
depends_on:
- server
environment:
PYTHONUNBUFFERED: 0
REDASH_LOG_LEVEL: "INFO"
REDASH_REDIS_URL: "redis://redis:6379/0"
REDASH_DATABASE_URL: "postgresql://postgres@postgres/postgres"
QUEUES: "queries,scheduled_queries,celery"
WORKERS_COUNT: 2
redis:
image: redis:3.0-alpine
restart: unless-stopped
postgres:
image: postgres:9.5.6-alpine
# The following turns the DB into less durable, but gains significant performance improvements for the tests run (x3
# improvement on my personal machine). We should consider moving this into a dedicated Docker Compose configuration for
# tests.
command: "postgres -c fsync=off -c full_page_writes=off -c synchronous_commit=OFF"
restart: unless-stopped
你可以在这个 repo中看到整个项目。谢谢。
解决方案
更改localhost
为host.docker.internal
使其工作。
推荐阅读
- typescript - 使用其他界面键的打字稿界面
- docker - pytest:在 setup/teardown 捕获 stdout/stderr
- java - Parcelable 在读取 Serializable 对象时遇到 IOException
- sql - SQL - 朱利安日期 (CYYDDD) 至今
- javascript - *javascript* 将所有 for 循环值提取为不同的变量
- c# - Asp.Net 生产上的调试设置
- python-3.x - 匿名文件,带有指定单词的数组,Python
- wix - 如果在安装程序中修改和升级,如何限制用户更改功能?
- c# - 使用 MD5CryptoServiceProvider、TripleDESCryptoServiceProvider 和 ICryptoTransform 解密文件
- git - Git如何重置远程