teamnsrg / ethereum-p2p

Official Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
17 stars 9 forks source link

config file and scripts for setting up the database container #12

Closed SimonSK closed 6 years ago

SimonSK commented 6 years ago

This creates a mysql docker container that hosts our node database. The script assumes docker (and docker-compose), python2, and pip2 are installed. I prefer isolating the database in a container as I don't feel comfortable messing with mysql server hosted on the server. The actual database directory is stored directly on the host (or the nfs if that's what we set to) and attached to the container.

How to use:

  1. Set connection information in config.py and ethnodes/.env.
  2. Run sudo ./setup.sh

On a second thought, maybe I should just save the container image, push it to a private repo, and just pull it.

The database contains 4 different tables: neighbors, node_id_hash, devp2p_hello, eth_status.

zzma commented 6 years ago

I think saving the container image and pulling it makes sense, instead of regenerating every time, especially if it takes significantly longer to regenerate the image.

SimonSK commented 6 years ago

@zzma it actually doesn't take that long (less than 30s). the script is basically pulling an existing mysql 5.7 image and runs my python script to create tables. i think we won't have to deal with this a lot once we have a database running, so i will leave it as is for now.

zzma commented 6 years ago

If it helps, we should also create index on node_id fields if we do a lot of lookups by node_id

SimonSK commented 6 years ago

Some thoughts on the tables:

I will create a separate PR for the data insert and search, but here is my current plan:

SimonSK commented 6 years ago

rename node_id_hash to node_properties and move counter fields to it

zzma commented 6 years ago

@SimonSK I think renaming node_id_hash to node_meta_info would be more appropriate.