Code Monkey home page Code Monkey logo

ton-index-worker's Introduction

TON Index (C++ Worker)

This is a C++ worker for TON indexer. This worker reads data from TON node files, parses TL-B schemas, and inserts data into PostgreSQL database.

1. How to install

Before installing the worker, ensure the TON Index database is set up using the instructions provided.

1.1. Setup as systemd daemon

To install as a daemon use the script below:

./scripts/add2systemd.sh --db /var/ton-work/db --host <ip> --port <port> \
                         --user <postgres user> --password <postgres password> --dbname <database name> \
                         --from 1 --max-active-tasks $(nproc) --threads $(nproc) \
                         --max-insert-actors <number of insert actors> [--force]

You may find the list of arguments in section available arguments. Use flag --force to force rebuild binary.

NOTE: We strongly recommend to setup worker separately from the database server because of significant RAM and Disk IO usage.

1.2. Manual install

Do the following steps to build and run index worker from source.

  1. Install required packages:

     sudo apt-get update -y
     sudo apt-get install -y build-essential cmake clang openssl libssl-dev zlib1g-dev gperf wget git curl libreadline-dev ccache libmicrohttpd-dev pkg-config libsecp256k1-dev libsodium-dev python3-dev libpq-dev ninja-build
    
  2. Build TON index worker binary:

     mkdir -p build
     cd build
     cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=off -GNinja ..
     ninja -j$(nproc) ton-index-postgres
    
  3. Install binary to your system:

     sudo cmake --install 
    
  4. Increase maximum opened files limit:

     ulimit -n 1000000
    
  5. Run TON index worker:

     ton-index-postgres <args>
    

1.3. Available arguments:

  • --db <path> - path to TON node directory. Pass /var/ton-work/db, if you have TON node installed by mytonctrl. Required.
  • --host <ip> - PostgreSQL host. Only IPv4 is acceptable. Default: 127.0.0.1.
  • --port <port> - PostgreSQL port. Default: 5432.
  • --user <user> - PostgreSQL user. Default: postgres.
  • --password <password> - PostgreSQL password. Default: empty password.
  • --dbname <dbname> - PostgreSQL database name. Default: ton_index.
  • --from <seqno> - Masterchain seqno to start indexing from. Use value 1 to index the whole blockchain.
  • --max-active-tasks <count> - maximum parallel disk reading tasks. Recommended value is number of CPU cores.
  • --max-queue-blocks <size> - maximum blocks in queue (prefetched blocks from disk).
  • --max-queue-txs <size> - maximum transactions in queue.
  • --max-queue-msgs <size> - maximum messages in queue.
  • --max-insert-actors <actors> - maximum concurrent INSERT queries.
  • --max-batch-blocks <size> - maximum blocks in batch (size of insert batch).
  • --max-batch-txs <size> - maximum transactions in batch.
  • --max-batch-msgs <size> - maximum messages in batch.
  • --threads <threads> - number of CPU threads.
  • --stats-freq <seconds> - frequency of printing a statistics.

ton-index-worker's People

Contributors

dungeon-master-666 avatar kdimentionaltree avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.