【问题标题】:Why are the env variables for the Datastore Emulator incorrectly detected?为什么错误地检测到数据存储模拟器的环境变量?
【发布时间】:2017-01-18 08:11:45
【问题描述】:

我运行 Datastore 模拟器,得到以下明显正确的控制台日志

> gcloud beta emulators datastore start --project=myproj --data-dir "./gcloud_datastore"

[datastore] If you are using a library that supports the DATASTORE_EMULATOR_HOST environment variable, run:
[datastore]
[datastore]   export DATASTORE_EMULATOR_HOST=localhost:8232
[datastore]
[datastore] Dev App Server is now running.

在另一个 cmd 窗口中,当模拟器运行时,我运行以下命令,或者我先停止模拟器。无论哪种方式,它都会产生不同的端口和不同的项目:

> gcloud beta emulators datastore env-init

set DATASTORE_DATASET=anotherproj
set DATASTORE_EMULATOR_HOST=localhost:8297
set DATASTORE_EMULATOR_HOST_PATH=localhost:8297/datastore
set DATASTORE_HOST=http://localhost:8297
set DATASTORE_PROJECT_ID=anotherproj

出了什么问题?我该如何解决这个问题?

【问题讨论】:

    标签: google-app-engine google-cloud-datastore gcloud


    【解决方案1】:

    运行env-init 命令时使用相同的数据目录。例如:

    gcloud beta emulators datastore env-init --data-dir=./gcloud_datastore 
    

    当您使用start 命令启动模拟器时,它会在指定的数据目录中创建/更新一个文件env.yaml。该文件包含环境信息(例如端口、项目名称),我相信这些信息是由env-init 命令使用的。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-06
      • 2019-08-31
      • 1970-01-01
      • 2012-03-07
      • 1970-01-01
      • 1970-01-01
      • 2016-11-09
      • 2015-06-20
      相关资源
      最近更新 更多