Skip to content

Commit

Permalink
Merge pull request #414 from jason-fox/patch-3
Browse files Browse the repository at this point in the history
Add Database Indexes
  • Loading branch information
fgalan authored Jan 20, 2020
2 parents f163199 + 3b5f417 commit 7366b72
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,27 @@ than 100 GB RAM, you will want to increase this value to match the available RAM

If you want to get more details about the configuration of the system and node.js for high performance scenarios, please
refer to the [Installation Guide](https://fiware-iotagent-ul.rtfd.io/en/latest/installationguide/index.html).

### Set-up appropriate Database Indexes

If using Mongo-DB as a data persistence mechanism (i.e. if `IOTA_REGISTRY_TYPE=mongodb`) the device and service group
details are retrieved from a database. The default name of the IoT Agent database is `iotagentul`. Database access can be
optimized by creating appropriate indices.

For example:

```console
docker exec <mongo-db-container-name> mongo --eval '
conn = new Mongo();
db = conn.getDB("iotagentul");
db.createCollection("devices");
db.devices.createIndex({"_id.service": 1, "_id.id": 1, "_id.type": 1});
db.devices.createIndex({"_id.type": 1});
db.devices.createIndex({"_id.id": 1});
db.createCollection("groups");
db.groups.createIndex({"_id.resource": 1, "_id.apikey": 1, "_id.service": 1});
db.groups.createIndex({"_id.type": 1});' > /dev/null
```

The name of the database can be altered using the `IOTA_MONGO_DB` environment variable. Alter the `conn.getDB()`
statement above if an alternative database is being used.

0 comments on commit 7366b72

Please sign in to comment.