我正在尝试将数据存储区实体的备份还原到在localhost上运行的模拟器中。
我正在使用此位置https://cloud.google.com/datastore/docs/tools/emulator-export-import上的指南 到目前为止,这是我设法做到的。
import DATA from './src/components/data'
<DATA state="ALABAMA" />
#start the emulator
gcloud beta emulators datastore start --store-on-disk --data-dir "./datastore-emulator" --project=my-project
这时我可以看到模拟器检测到连接,这是日志片段
# set the environment
$(gcloud beta emulators datastore env-init)
# initiate the restore operation
curl -X POST localhost:8081/v1/projects/my-project:import \
-H 'Content-Type: application/json' \
-d '{"input_url":"/home/bogdan/workspace/myCopy/2019-08-19-23-00/2019-08-19-23-00.overall_export_metadata"}'
等待约5分钟后
[datastore] Dev App Server is now running.
[datastore]
[datastore] The previous line was printed for backwards compatibility only.
[datastore] If your tests rely on it to confirm emulator startup,
[datastore] please migrate to the emulator health check endpoint (/). Thank you!
[datastore] The health check endpoint for this emulator instance is http://localhost:8081/Sep 02, 2019 3:45:11 PM io.gapi.emulators.grpc.GrpcServer$3 operationComplete
[datastore] INFO: Adding handler(s) to newly registered Channel.
[datastore] Sep 02, 2019 3:45:11 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
[datastore] INFO: Detected non-HTTP/2 connection.
[datastore] Sep 02, 2019 3:45:11 PM io.gapi.emulators.grpc.GrpcServer$3 operationComplete
[datastore] INFO: Adding handler(s) to newly registered Channel.
[datastore] Sep 02, 2019 3:45:11 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
[datastore] INFO: Detected HTTP/2 connection.
还不是在[datastore] Exception in thread "grpc-default-executor-0" java.lang.OutOfMemoryError: GC overhead limit exceeded
[datastore] at java.util.Collections.unmodifiableList(Collections.java:1289)
[datastore] at com.google.storage.onestore.v3.proto2api.OnestoreEntity$Path.<init>(OnestoreEntity.java:8573)
[datastore] at com.google.storage.onestore.v3.proto2api.OnestoreEntity$Path.<init>(OnestoreEntity.java:8504)
[datastore] at com.google.storage.onestore.v3.proto2api.OnestoreEntity$Path$1.parsePartialFrom(OnestoreEntity.java:10145)
[datastore] at com.google.storage.onestore.v3.proto2api.OnestoreEntity$Path$1.parsePartialFrom(OnestoreEntity.java:10133)
[datastore] at com.google.protobuf.CodedInputStream$ArrayDecoder.readMessage(CodedInputStream.java:969)
[datastore] at com.google.storage.onestore.v3.proto2api.OnestoreEntity$EntityProto.<init>(OnestoreEntity.java:13508)
[datastore] at com.google.storage.onestore.v3.proto2api.OnestoreEntity$EntityProto.<init>(OnestoreEntity.java:13407)
[datastore] at com.google.storage.onestore.v3.proto2api.OnestoreEntity$EntityProto$1.parsePartialFrom(OnestoreEntity.java:15888)
[datastore] at com.google.storage.onestore.v3.proto2api.OnestoreEntity$EntityProto$1.parsePartialFrom(OnestoreEntity.java:15876)
[datastore] at com.google.protobuf.AbstractParser.parsePartialFrom(AbstractParser.java:57)
[datastore] at com.google.protobuf.AbstractParser.parsePartialFrom(AbstractParser.java:20)
[datastore] at com.google.cloud.datastore.emulator.impl.LevelDBLogReaderChannel.readProtoMessage(LevelDBLogReaderChannel.java:65)
[datastore] at com.google.cloud.datastore.emulator.impl.ExportImportUtil.parseEntityProtoFile(ExportImportUtil.java:157)
[datastore] at com.google.cloud.datastore.emulator.impl.ExportImportUtil.fetchEntities(ExportImportUtil.java:59)
[datastore] at com.google.cloud.datastore.emulator.admin.v1.DatastoreAdminV1Emulator.importEntities(DatastoreAdminV1Emulator.java:115)
[datastore] at com.google.cloud.datastore.emulator.admin.v1.DatastoreAdminGrpcAdapter$1.importEntities(DatastoreAdminGrpcAdapter.java:55)
[datastore] at com.google.datastore.admin.v1.DatastoreAdminGrpc$MethodHandlers.invoke(DatastoreAdminGrpc.java:1040)
[datastore] at io.grpc.stub.ServerCalls$UnaryServerCallHandler$UnaryServerCallListener.onHalfClose(ServerCalls.java:171)
[datastore] at io.grpc.internal.ServerCallImpl$ServerStreamListenerImpl.halfClosed(ServerCallImpl.java:283)
[datastore] at io.grpc.internal.ServerImpl$JumpToApplicationThreadServerStreamListener$1HalfClosed.runInContext(ServerImpl.java:711)
[datastore] at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:37)
[datastore] at io.grpc.internal.SerializingExecutor.run(SerializingExecutor.java:123)
[datastore] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[datastore] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[datastore] at java.lang.Thread.run(Thread.java:748)
[datastore] Sep 02, 2019 3:47:35 PM io.gapi.emulators.netty.HttpHandler$1 onError
[datastore] INFO: Exception when handling request: UNKNOWN
创建的数据库文件