App Engine: How to “reset” the datastore?

2019-03-09 01:21发布

Well, I'm developing in App Engine (Java) and after a lot of tries and deployments, I need to reset the datastore. There is a lot of random data I added to test performance, and besides that the entities changed a lot, so I need to delete all: data, tables, indexes.

How can I do that?

15条回答
迷人小祖宗
2楼-- · 2019-03-09 01:46

It doesn't work for me.

I have a GAE application where I have to logging me at the beginning.

I have deleted my local_db.bin file (I have more files in that folder: datastore-indexes-auto.xml and local_search.bn). I have re-opened my project and run it as. When I launch my main .jsp, it is loading request from my datastore but I have not data in my datastore and asking me for my PMF (persistent manager factory).

Should I delete more things?

Exactly, I am trying to open: localhost:8888/_ah/admin/ but it is not found.

Diego.

查看更多
We Are One
3楼-- · 2019-03-09 01:52

Clearing the Development Server Datastore

The development web server uses a local version of the datastore for testing your application, using temporary files. The data persists as long as the temporary files exist, and the web server does not reset these files unless you ask it to do so.

If you want the development server to erase its datastore prior to starting up, use the --clear_datastore option when starting the server:

dev_appserver.py --clear_datastore helloworld/

Using the Datastore

查看更多
虎瘦雄心在
4楼-- · 2019-03-09 01:52

To add another bit of helpful info: If using Eclipse and you want to clear the local datastore, look for this console msg:

INFO: Local Datastore initialized: 
Storage: C:\Users\eric\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\appname\WEB-INF\appengine-generated\local_db.bin

It only shows up after you do something to force datastore initialization, e.g. which could be refreshing the entity list on the admin page. Then stop your server and delete the file, and when you restart you should see:

INFO: The backing store, C:\Users\eric\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\appname\WEB-INF\appengine-generated\local_db.bin, does not exist. It will be created.
查看更多
够拽才男人
5楼-- · 2019-03-09 01:55

Sorry to wake this thread up, but just in case I'd like to add a tip for noobs like me (finally found the answer in google documentation) :

If you want to reset the Local datastore (for example while developping using eclipse) all at once, shut down the server, find the file 'local_db.bin' in your project (should be in the WEB-INF/appengine-generated/ directory), and delete it.

Works fine with java, didn't try with python yet.

++

查看更多
你好瞎i
6楼-- · 2019-03-09 01:58

If you use maven in your project, you can just do a "mvn clean install". That will reset the datastore locally of course.

查看更多
Emotional °昔
7楼-- · 2019-03-09 01:58

Deleting local data can be done by opening http://localhost:8000/datastore

查看更多
登录 后发表回答