|
| 1 | +# Drill Storage Plugin for IPFS (Minerva) |
| 2 | + |
| 3 | +## Contents |
| 4 | + |
| 5 | +0. [Introduction](#Introduction) |
| 6 | +1. [Configuration](#Configuration) |
| 7 | +2. [Usage Notes](#Usage Notes) |
| 8 | + |
| 9 | +## Introduction |
| 10 | + |
| 11 | +Minerva is a storage plugin of Drill that connects IPFS's decentralized storage and Drill's flexible query engine. Any data file stored on IPFS can be easily accessed from Drill's query interface, just like a file stored on a local disk. Moreover, with Drill's capability of distributed execution, other instances who are also running Minerva can help accelerate the execution: the data stays where it is, and the queries go to the most suitable nodes which stores the data locally, and from there the operations can be performed most efficiently. |
| 12 | + |
| 13 | +## Configuration |
| 14 | + |
| 15 | +1. Set Drill hostname to the IP address of the node to run Drill: |
| 16 | + |
| 17 | + Edit file `conf/drill-env.sh` and change the environment variable `DRILL_HOST_NAME` to the IP address of the node. Use private or global addresses, depending on whether you plan to run it in a private cluster or on the open Internet. |
| 18 | + |
| 19 | +2. Configure the IPFS storage plugin: |
| 20 | + |
| 21 | + The default configuration of the IPFS storage plugin is located at `src/resources/bootstrap-storage-plugins.json`: |
| 22 | + |
| 23 | + ``` |
| 24 | + "ipfs" : { |
| 25 | + "type":"ipfs", |
| 26 | + "host": "127.0.0.1", |
| 27 | + "port": 5001, |
| 28 | + "max-nodes-per-leaf": 3, |
| 29 | + "ipfs-timeouts": { |
| 30 | + "find-provider": 4, |
| 31 | + "find-peer-info": 4, |
| 32 | + "fetch-data": 5 |
| 33 | + }, |
| 34 | + "ipfs-caches": { |
| 35 | + "peer": {"size": 100, "ttl": 600}, |
| 36 | + "provider": {"size": 1000, "ttl": 600} |
| 37 | + }, |
| 38 | + "groupscan-worker-threads": 50, |
| 39 | + "formats": null, |
| 40 | + "enabled": true |
| 41 | + } |
| 42 | + ``` |
| 43 | + |
| 44 | + where |
| 45 | + |
| 46 | + `host` and `port` are the host and API port where your IPFS daemon will be listening. Change it so that it matches the configuration of your IPFS instance. |
| 47 | +
|
| 48 | + `max-nodes-per-leaf` controls how many provider nodes will be considered when the query is being planned. A larger value increases the parallelization width but typically takes longer to find enough providers from DHT resolution. A smaller value does the opposite. |
| 49 | + |
| 50 | + `ipfs-timeouts` set the maximum amount of time in seconds for various time-consuming operations: |
| 51 | + |
| 52 | + * `find-provider` is the time allowed to do DHT queries to find providers. |
| 53 | + * `find-peer-info` is the time allowed to resolve the network addresses of the providers. |
| 54 | + * `fetch-data` is the time the actual transmission is allowed to take. |
| 55 | + |
| 56 | + `ipfs-caches` control the size and TTL in seconds of cache entries of various caches used to accelerate query execution: |
| 57 | + |
| 58 | + * `peer` cache caches peers addresses. |
| 59 | + * `provider` cache caches which providers provide a particular IPFS object. |
| 60 | + |
| 61 | + `groupscan-worker-threads` limits the number of worker threads when the planner communicate with the IPFS daemon to resolve providers and peer info. |
| 62 | + |
| 63 | + `formats` specifies the formats of the files. It is unimplemented for now and does nothing. |
| 64 | + |
| 65 | +3. Configure IPFS |
| 66 | +
|
| 67 | + Start the IPFS daemon first. |
| 68 | + |
| 69 | + Set a Drill-ready flag to the node: |
| 70 | + |
| 71 | + ``` |
| 72 | + $ IPFS_NULL_OBJECT=$(ipfs object new) |
| 73 | + $ ipfs object patch add-link $IPFS_NULL_OBJECT "drill-ready" $IPFS_NULL_OBJECT |
| 74 | + QmeXLv7D5uV2uXHejg7St7mSXDtqwTw8LuywSBawSxy5iA |
| 75 | + $ ipfs name publish /ipfs/QmeXLv7D5uV2uXHejg7St7mSXDtqwTw8LuywSBawSxy5iA |
| 76 | + Published to <your-node-id>: /ipfs/QmeXLv7D5uV2uXHejg7St7mSXDtqwTw8LuywSBawSxy5iA |
| 77 | + ``` |
| 78 | + |
| 79 | + This flag indicates that an IPFS node is also capable of handling Drill queries, and the planner will consider it when scheduling a query to execute distributedly. A node without this flag will be ignored. |
| 80 | + |
| 81 | + Also, pin the flag so that it will stick on your node: |
| 82 | + |
| 83 | + ``` |
| 84 | + $ ipfs pin add -r QmeXLv7D5uV2uXHejg7St7mSXDtqwTw8LuywSBawSxy5iA |
| 85 | + ``` |
| 86 | + |
| 87 | +## Usage Notes |
| 88 | +
|
| 89 | +1. Compatible data formats |
| 90 | +
|
| 91 | + Currently only JSON files are supported by this storage plugin. |
| 92 | + |
| 93 | +2. Add datasets to IPFS |
| 94 | + |
| 95 | + IPFS provides the `ipfs add` command to conveniently add a file to IPFS. Unfortunately that command does not split data files into chunks on line boundaries. Use [this script](https://gist.github.com/dbw9580/250e52a54e39a34083f815dea34a89e0) to do proper chunking and add files to IPFS. |
| 96 | + |
| 97 | +3. Timeout exceptions |
| 98 | +
|
| 99 | + IPFS operations can be time-consuming, and sometimes an operation can take forever (e.g. querying the DHT for a non-existent object). Adjust the timeout values in the config to avoid most timeout exceptions. |
0 commit comments