User Tools

Site Tools



This shows you the differences between two versions of the page.

Link to this comparison view

pom:datastore_config [2020/05/26 21:59] (current)
Line 1: Line 1:
 +===== Datastore configuration =====
 +To use a datastore, 3 steps are required. First you need to add the datastore to the configuration :
 +  pom> datastore add sqlite datastore1 ​
 +  Datastore "​datastore1"​ added (type sqlite)
 +Other datastore types such as postgres or mysql are available if the configure script found the required files.\\
 +The command "show datastore"​ will show you the datastores currently configured, their state and their parameters :
 +  pom> datastore show
 +  Datastore datastore1 of type sqlite (stopped)
 +     ​dbfile = pom.db ​
 +As you can see, the datastore is currently stopped. It will be started automatically when needed because the core parameter "​target_autostart_datastore"​ is set to yes by default. You can change the datastore parameters this way :
 +  pom> datastore parameter set datastore1 dbfile my_sqlite_database.db
 +This will make the sqlite datastore use the file "​my_sqlite_database.db"​ instead of the default "​pom.db"​.
 +To confirm that the datastore is working, you can start the datastore using the following command :
 +  pom> datastore start datastore1 ​
 +If you look at the datastore status, you should now see something like this :
 +  pom> datastore show
 +  Datastore datastore1 of type sqlite (running)
 +     ​dbfile = my_sqlite_database.db
 +Also the file "​my_sqlite_database.db"​ should now be created.
 +===== Datastore usage =====
 +For a target to save data in a datastore, it will have to create a dataset. A dataset is most of the time a table in the database. Most target will ask for a path to a dataset to work. This path has the following syntax : <​datastore_name>/<​dataset_name>​. For example if you are using the postgres datastore and specify a dataset path of "​datastore_1/​test",​ the target will create a table test_something in the database where the datastore is connected to.
pom/datastore_config.txt ยท Last modified: 2020/05/26 21:59 (external edit)