Search code examples
google-cloud-platformgoogle-cloud-datastoredatastore

Datastore Emulator Query/Issue


I have installed google datastore emulator in my local machine along with it written a sample spring boot application which performs crud operations on datastore. When i hit the rest endpoints through postman i can actually see the data gets inserted in datastore in gcp console

can someone help me by clearing below queries:

1>Even though using an emulator in local , whether data gets inserted to actual datastore in cloud (gcp)

2>what is the purpose of emulator (if qn 1 is correct)


Solution

    1. No data is inserted on Datastore servers, everything is local as mentioned here

    The emulator simulates Datastore by creating /WEB-INF/appengine-generated/local_db.bin in a specified data directory and storing data in local_db.bin. By default, the emulator uses the data directory ~/.config/gcloud/emulators/datastore/. The local_db.bin file persists between sessions of the emulator. You can set up multiple data directories and think of each as a separate, local Datastore mode instance. To clear the contents of a local_db.bin file, stop the emulator and manually delete the file.

    1. There are multiple uses for example:
    • To develop and test your application locally without writing actual Data to the servers hence avoiding charges during the development process
    • Help you generate indexes for your production Firestore in Datastore mode instance and delete unneeded indexes, that could be exported then into production

    Edit

    In order to use the emulator on the same machine it's recommended to set the environment variables automatically as mentioned in the documentation