Skip to main content
Graph Node supports advanced configuration through TOML files for complex deployments requiring multiple databases, chains, or specialized node roles.

When to Use Configuration Files

Use TOML configuration files when you need:
  • Multiple databases: Sharding across multiple PostgreSQL instances
  • Multiple chains: Indexing several blockchain networks
  • Read replicas: Distributing query load across replica databases
  • Node specialization: Dedicated index nodes and query nodes
  • Custom deployment rules: Control where subgraphs are stored and indexed
For simple single-database setups, use command-line arguments instead.

Configuration File Structure

The TOML configuration file has four main sections:

Using a Configuration File

Specify the configuration file with the --config flag:
When using --config, you cannot use:
  • --postgres-url
  • --postgres-secondary-hosts
  • --postgres-host-weights
  • --ethereum-rpc (define in config file instead)

Environment Variable Expansion

Configuration files support environment variable expansion:
For complex templating, use envsubst:

Store Configuration

The [store] section defines PostgreSQL databases for storing subgraph data.

Single Database Setup

Minimal configuration equivalent to --postgres-url:

Multiple Databases (Sharding)

Split subgraph storage across multiple databases:

Connection Pool Configuration

number | rules
Number of database connections per Graph Node instanceCan be a fixed number or rules based on node ID:
Rules are evaluated in order; first match wins.
number
default:"1"
Query traffic distribution weight
  • 0: Don’t send queries (indexing only)
  • Higher values: More query traffic
Traffic is distributed proportionally across all databases/replicas.
string
required
PostgreSQL libpq connection stringSupports environment variable expansion: ${VAR_NAME}

Validating Pool Configuration

Use graphman to validate connection pool settings:
This shows total connections opened by all nodes.

Chain Configuration

The [chains] section configures blockchain network providers.

Basic Chain Setup

Multi-Chain Configuration

Provider Configuration

string
required
Provider name (appears in logs)
string
required
RPC endpoint URL
array
default:"[]"
Provider capabilities:
  • archive: Full historical state
  • traces: Supports debug_traceBlockByNumber
  • no_eip1898: Doesn’t support EIP-1898 (block by hash/number object)
  • no_eip2718: Doesn’t return type field in transaction receipts
  • compression/gzip: Supports gzip compression
  • compression/brotli: Supports brotli compression
  • compression/deflate: Supports deflate compression
object
HTTP headers to include in requests
number
Maximum subgraphs that can use this providerAt least one provider should be unlimited.
string
default:"rpc"
Connection type: rpc, ws, or ipc

Provider Types

string
default:"web3"
Provider implementation:
  • web3: Standard Ethereum JSON-RPC (default)
  • firehose: StreamingFast Firehose
  • web3call: Web3 provider for eth_call only
For Firehose providers:

Advanced: Provider Limits per Node

Limit which nodes can use specific providers:
If a node’s name doesn’t match any rule, it cannot use that provider.

Deployment Rules

The [deployment] section controls where new subgraphs are deployed.

Deployment Rule Structure

Rules are evaluated in order. First matching rule determines placement.

Match Conditions

regex
Regular expression matching subgraph name
string | array
Network name(s) the subgraph indexes

Shard Selection

string
default:"primary"
Fixed shard name for deployment storage
array
List of shards; chooses the one with fewest deployments

Indexer Selection

array
required
List of node IDs eligible to index this deploymentGraph Node chooses the indexer with fewest assigned subgraphs.
Names must match the --node-id argument when starting nodes.

Simulating Deployment

Test where a subgraph would be deployed:
Shows the target shard and eligible indexers without making changes.

Query Node Configuration

Designate nodes as query-only (no indexing):
Query nodes:
  • Only respond to GraphQL queries
  • Don’t connect to blockchain providers
  • Don’t index subgraphs

Complete Example

Starting Nodes with Configuration

Index Nodes

Query Nodes

Query nodes automatically detected via [general] query regex.

Validation and Testing

Validate Configuration

Checks for:
  • Syntax errors
  • Undefined shards referenced in deployment rules
  • Missing required sections

Check Connection Pools

Shows total database connections opened by specified nodes.

Simulate Deployment

Shows which shard and indexers would be selected.

Best Practices

Index nodes: 10-30 connections per shardQuery nodes: 50-100 connections per shardMonitor GRAPH_STORE_CONNECTION_WAIT_TIME to detect pool exhaustion.
Set main database weight to 0 for shards with replicas:
This reduces load on the primary database.
Always configure at least 2 providers per chain for failover:
Place most specific rules first:

Troubleshooting

Run validation to see specific issues:
Common issues:
  • Undefined shard referenced in deployment rule
  • Missing required [deployment] section
  • Invalid regex in deployment match
Simulate deployment to check rules:
Verify deployment rules are ordered correctly (most specific first).
Check pool usage:
Increase pool size for heavily loaded nodes:

Next Steps