Part of a project at HTW to build a distributed full-text-search. See the rest of the project.
This repo implements the DHT that hosts the entries of the inverted index for the full-text-search component.
The slides of our closing presentation include an explaination of how this whole project fits together and takes a deeper look into what this component does if you want to know more.
Entire Project
- Architechture Discussion and Diagramms
- User Stories
- Our Presentation including an elaboration on two design decisions
This Component
Install:
npm install
Development:
npm start
Production:
npm run start-prod
Configured via environmental variables in variables.env
.
See: variables.env.example
.
Port for the http server to run on.
Default: 8090
The maximum request body size.
Default: 10mb
See: body-parser
Port for the p2p node to run on.
Default: 8070
IP for the p2p node to run on.
Default: 127.0.0.1
(localhost)
List of peers, required for joining the network. Leave blank on first peer, that is "creating" the network.
Default: empty
Format:
- multiaddr incl. ipfs address
- seperated by commas
Example:
PEER_LIST=/ip4/127.0.0.1/tcp/8071/ipfs/QmdW3RF4Yq4acYc4bgUmxeuJQLb2mQpQmMuDTGir5gQcYM, /ip4/127.0.0.1/tcp/8072/ipfs/QmPP5pdu6Dh93DL7LnQkKU2x8m4BoSrQswjQR5q26PMneg
You have to fill this list manually with the multiaddresses of the other peers.
You do this by configuring a peer through the above options (ports and ip) and
running the npm run addr
script to show you that specific peers multiaddress,
which can then be used in another peers PEER_LIST
to connect to this peer.
Storage location on disk for the data of the DHT.
Default: /tmp/datastore
Specifies on how many different remote nodes a value should be stored.
Default: 2
Specify the max message size of the p2p net's multiplexer.
Default: 10mb
Enable logging in the p2p network.
Set it to:
libp2p:dht:Q*,libp2p:dht:rpc:get-value:*
Multiaddress:
Print the multiaddress used for connection to the node:
npm run addr
Debug:
Print the environmental variables that are being read in:
npm run debug
Node testing:
Run a node for testing:
npm run spawn 1
Generate peerId locally:
Create the peerId.json
locally.
npm run local-peerid