问题描述
我正在尝试使用Google Cloud SQL(MySQL)在gcloud引擎上设置元数据库.
I'm trying to set up Metabase on a gcloud engine using Google Cloud SQL (MySQL).
我已经使用 此 git和这个app.yaml:
I've got it running using this git and this app.yaml:
runtime: custom
env: flex
# Metabase does not support horizontal scaling
# https://github.com/metabase/metabase/issues/2754
# https://cloud.google.com/appengine/docs/flexible/java/configuring-your-app-with-app-yaml
manual_scaling:
instances: 1
env_variables:
# MB_JETTY_PORT: 8080
MB_DB_TYPE: mysql
MB_DB_DBNAME: [db_name]
# MB_DB_PORT: 5432
MB_DB_USER: [db_user]
MB_DB_PASS: [db_password]
# MB_DB_HOST: 127.0.0.1
CLOUD_SQL_INSTANCE: [project-id]:[location]:[instance-id]
我有2个问题:
-
元数据库无法连接到Cloud SQL-Cloud SQL是同一项目的一部分,并且App Engine被授权.
The Metabase fails in connecting to the Cloud SQL - the Cloud SQL is part of the same project and App Engine is authorized.
在Metabase中创建我的管理员用户后,我只能登录几秒钟(并且有时仅登录几秒钟),但是它总是让我进入/setup
或/auth/login
,提示密码不正确. t匹配(匹配时).
After I create my admin user in Metabase, I am only able to login for a few seconds (and only sometimes), but it keeps throwing me to either /setup
or /auth/login
saying the password doesn't match (when it does).
我希望有人能提供帮助-谢谢!
I hope someone can help - thank you!
推荐答案
因此,我们刚刚在配置了PostgreSQL的Cloud SQL实例的Google App Engine中运行了元数据库,这是我们要完成的步骤.
So, we just got metabase running in Google App Engine with a Cloud SQL instance running PostgreSQL and these are the steps we went through.
首先,创建一个Dockerfile:
First, create a Dockerfile:
FROM gcr.io/google-appengine/openjdk:8
EXPOSE 8080
ENV JAVA_OPTS "-XX:+IgnoreUnrecognizedVMOptions -Dfile.encoding=UTF-8 --add-opens=java.base/java.net=ALL-UNNAMED --add-modules=java.xml.bind"
ENV JAVA_TOOL_OPTIONS "-Xmx1g"
ADD https://downloads.metabase.com/enterprise/v1.1.6/metabase.jar $APP_DESTINATION
我们尝试将内存进一步降低,但似乎1 GB是最佳选择.转到app.yaml
:
We tried pushing the memory further down, but 1 GB seemed to be the sweet spot. On to the app.yaml
:
runtime: custom
env: flex
manual_scaling:
instances: 1
resources:
cpu: 1
memory_gb: 1
disk_size_gb: 10
readiness_check:
path: "/api/health"
check_interval_sec: 5
timeout_sec: 5
failure_threshold: 2
success_threshold: 2
app_start_timeout_sec: 600
beta_settings:
cloud_sql_instances: <Instance-Connection-Name>=tcp:5432
env_variables:
MB_DB_DBNAME: 'metabase'
MB_DB_TYPE: 'postgres'
MB_DB_HOST: '172.17.0.1'
MB_DB_PORT: '5432'
MB_DB_USER: '<username>'
MB_DB_PASS: '<password>'
MB_JETTY_PORT: '8080'
请注意底部的beta_settings
字段,该字段处理akilesh raj
手动执行的操作.另外,由于元数据库尚不支持unix套接字,因此必须尾随=tcp:5432
.
Note the beta_settings
field at the bottom, which handles what akilesh raj
was doing manually. Also, the trailing =tcp:5432
is required, since metabase does not support unix sockets yet.
相关文档可以在此处找到.
Relevant documentation can be found here.
这篇关于Google App Engine上的配置数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!