|
| 1 | +--- |
| 2 | +title: Metastore configuration |
| 3 | +position: 3 |
| 4 | +--- |
| 5 | + |
| 6 | +Quickwit needs a place to store meta-information about its indexes. |
| 7 | + |
| 8 | +For instance: |
| 9 | + |
| 10 | +- The index configuration. |
| 11 | +- Meta-information about its splits. For instance, their IDs, the number of documents they contain, their sizes, their min/max timestamp, and the set of tags present in the split. |
| 12 | +- The different sources checkpoints. |
| 13 | +- Some extra information such as the index creation time. |
| 14 | + |
| 15 | +The metastore is entirely defined by a single URI. One can set it by editing the `metastore_uri` parameter of the [Quickwit configuration file](https://www.notion.so/Quickwit-configuration-MERGED-3fab5a181a9a43cba83db2fb25b46729) (often named `quickwit.yaml`). |
| 16 | + |
| 17 | +Currently, Quickwit offers two implementations: |
| 18 | + |
| 19 | +- **PostgreSQL**: recommended for distributed usage. |
| 20 | +- **File-backed implementation**. |
| 21 | + |
| 22 | +# PostgreSQL Metastore |
| 23 | + |
| 24 | +We recommend the PostgreSQL metastore for any distributed usage. |
| 25 | + |
| 26 | +The PostgreSQL metastore can be configured by setting a PostgreSQL URI in the `metastore_uri` parameter of the Quickwit configuration file. The URI takes the following format: |
| 27 | + |
| 28 | +``` |
| 29 | +postgres://[user]:[password]@[host]:[port]/[dbname] |
| 30 | +``` |
| 31 | + |
| 32 | +Some of those parameters can be omitted. The following PostgreSQL URIs are for instance valid: |
| 33 | + |
| 34 | +``` |
| 35 | +postgres://localhost/mydb |
| 36 | +postgres://user@localhost |
| 37 | +postgres://user:secret@localhost |
| 38 | +postgres://host1:123,host2:456/mydb |
| 39 | +``` |
| 40 | + |
| 41 | +The database has to be created in advance. |
| 42 | + |
| 43 | +On its first execution, Quickwit will transparently create the necessary tables. |
| 44 | + |
| 45 | +Likewise, if you upgrade Quickwit to a version that includes some changes in the PostgreSQL schema, Quickwit will transparently operate the migration startup. |
| 46 | + |
| 47 | +# File-backed metastore |
| 48 | + |
| 49 | +For convenience, Quickwit also makes it possible to store its metadata in files using a file-backed metastore. In that case, Quickwit will write one file per index. |
| 50 | + |
| 51 | +The metastore is then configured by passing a [Storage URI](https://www.notion.so/Storage-URI-APPROVED-176d8befb8d144fb820bcd0df077a728) that will serve as the root of the metastore storage. |
| 52 | + |
| 53 | +The metadata file associated with a given index will then be stored under |
| 54 | + |
| 55 | + `[storage_uri]/[index_id]/metastore.json` |
| 56 | + |
| 57 | +For the moment, Quickwit supports two types of storage types: |
| 58 | + |
| 59 | +- a local file system URI (e.g., `file:///opt/toto`). It is also valid to pass a file path directly (without file://). `/var/quickwit`. Relative paths will be resolved with respect to the current working directory. |
| 60 | +- S3-compatible storage URI (e.g. `s3://my-bucket/some-path`] ). See the [Storage URI](https://www.notion.so/Storage-URI-APPROVED-176d8befb8d144fb820bcd0df077a728) documentation to configure S3 or S3-compatible storage. |
| 61 | + |
| 62 | +### Polling configuration |
| 63 | + |
| 64 | +By default, the File-Backed Metastore is only read once when you start a Quickwit process (searcher, indexer,...). |
| 65 | + |
| 66 | +You can also configure it to poll the File-Backed Metastore periodically to keep a fresh view of it. This is useful for a Searcher instance that needs to be aware of new splits published by an Indexer running in parallel. |
| 67 | + |
| 68 | +To configure the polling interval (in seconds only), add a URI fragment to the storage URI like this: `s3://quickwit/my-indexes#polling_interval=30s` |
| 69 | + |
| 70 | +<aside> |
| 71 | +👌 Amazon S3 charges $0.0004 per 1000 GET requests. Polling a metastore every 30 seconds will induce a cost of $0.04 per month and per index. |
| 72 | + |
| 73 | +</aside> |
| 74 | + |
| 75 | +### Examples |
| 76 | + |
| 77 | +The following file-backed metastore URIs for instance are valid: |
| 78 | + |
| 79 | +```markdown |
| 80 | +s3://my-indexes |
| 81 | +s3://quickwit/my-indexes |
| 82 | +s3://quickwit/my-indexes#polling_interval=30s |
| 83 | +file:///local/indices |
| 84 | +file:///local/indices#polling_interval=30s |
| 85 | +/local/indices |
| 86 | +./quickwit-metastores |
| 87 | +``` |
| 88 | + |
| 89 | +<aside> |
| 90 | +⛔ The file-backed metastore does not allow concurrent writes. For this reason, it should not be used in distributed settings. |
| 91 | +Running several indexer services on the same file-backed metastore can lead to the corruption of the metastore. |
| 92 | +Running several search services, on the other hand, is perfectly safe. |
| 93 | + |
| 94 | +</aside> |
0 commit comments