2

我试图将部署在Google Container Engine中的Rails应用连接到托管在Google Cloud SQL中的数据库。Rails 5,Google Container Engine和Google Cloud SQL

我跟随this documentation。根据它,我的豆荚有两个容器:spike和cloudsql-proxy。

在这个页面中,我们可以看到下面一行:

提供127.0.0.1:3306作为你的应用程序用于访问数据库的主机地址。

在这个过程的尽头,我得到这个:

回报kubectl logs [pod_name] cloudsql-proxy

2017/05/03 09:50:43 Listening on 127.0.0.1:3306 for [instance_connection_name] 
2017/05/03 09:50:43 Ready for new connections 

而在kubectl exec -it [pod_name] -- /bin/bashcat log/production.log

ActionView::Template::Error (Unknown MySQL server host '127.0.0.1:3306' (25)) 

回报是不是好玩吗?

回答

2

我在this answer找到灵感。

原来,在database.yml中,而不是

production: 
host: 127.0.0.1:3306 

应该

production: 
host: 127.0.0.1 
相关问题