---
title: Multi-receiver configuration for MySQL with NRDOT
source: https://docs.newrelic.com/docs/opentelemetry/db360/mysql/multi-receiver
---

You can configure the NRDOT Collector to monitor multiple MySQL instances from one collector. This is useful if you have multiple MySQL databases running on different hosts or ports and want to collect metrics from all of them using a single NRDOT Collector instance.

## Prerequisites [#prerequisites]

-   NRDOT is installed and configured for your MySQL instances:
    -   [Self-hosted MySQL](https://docs.newrelic.com/docs/opentelemetry/db360/mysql/hosted)
    -   [RDS MySQL monitoring](https://docs.newrelic.com/docs/opentelemetry/db360/mysql/rds)

## Add multi-receiver configuration [#multi]

The following example shows how to configure the NRDOT Collector to monitor two MySQL instances using a multi-receiver configuration. The first instance carries the complete `nrmysql` configuration and acts as the anchor; the second instance inherits every shared setting through the YAML merge key and overrides only its own connection details. You can add more receivers as needed for additional MySQL instances.

```yaml
receivers:
  # First MySQL instance (anchor - full config, instance2 inherits shared settings via merge key)
  nrmysql/instance1: &nrmysql-common
    endpoint: "<INSTANCE_1_HOST>:<INSTANCE_1_PORT>"
    transport: tcp
    username: "<INSTANCE_1_USERNAME>"
    password: "<INSTANCE_1_PASSWORD>"
    allow_native_passwords: true
    collection_interval: 15s
    initial_delay: 1s
    explain_mode: procedure
    statement_events:
      digest_text_limit: 4096
      time_limit: 24h
      limit: 500
    query_sample_collection:
      max_rows_per_query: 100
      allowed_comment_keys: [nr_service_guid]
    top_query_collection:
      lookback_time: 60
      max_query_sample_count: 5000
      top_query_count: 200
      collection_interval: 60s
      query_plan_cache_size: 1000
      query_plan_cache_ttl: 1h
      allowed_comment_keys: [nr_service_guid]
    events:
      db.server.query_sample:
        enabled: true
      db.server.top_query:
        enabled: true
      db.server.query_plan:
        enabled: true
    resource_attributes:
      db.system.version:
        enabled: true
    metrics:
      mysql.query.count:
        enabled: true
      mysql.query.slow.count:
        enabled: true
      mysql.commands:
        enabled: true
      mysql.innodb.data_file.io:
        enabled: true

  # Second MySQL instance (inherits every shared setting above, overrides only connection details)
  nrmysql/instance2:
    <<: *nrmysql-common
    endpoint: "<INSTANCE_2_HOST>:<INSTANCE_2_PORT>"
    username: "<INSTANCE_2_USERNAME>"
    password: "<INSTANCE_2_PASSWORD>"

processors:
  batch:

exporters:
  otlp/newrelic:
    endpoint: "<YOUR_NEWRELIC_OTLP_ENDPOINT>"
    headers:
      api-key: "<YOUR_NEWRELIC_LICENSE_KEY>"
    compression: gzip
    sending_queue:
      enabled: true
      sizer: bytes
      queue_size: 100_000_000
      num_consumers: 10
      batch:
        sizer: bytes
        max_size: 1_000_000
        min_size: 0
        flush_timeout: 5s
    retry_on_failure:
      enabled: true
      initial_interval: 5s
      max_interval: 30s
      max_elapsed_time: 300s

service:
  pipelines:
    metrics/mysql-instance1:
      receivers: [nrmysql/instance1, nrmysql/instance2]
      processors: [batch]
      exporters: [otlp/newrelic]
    logs/mysql-instance1:
      receivers: [nrmysql/instance1, nrmysql/instance2]
      processors: [batch]
      exporters: [otlp/newrelic]
```

> #### 💡 TIP
>
> This configuration omits the optional `database` and `tls` fields. By default, each receiver monitors every database its user can access, and connects without TLS. To [monitor a specific database](https://docs.newrelic.com/docs/opentelemetry/db360/mysql/optional#database) per instance, or to [enable TLS](https://docs.newrelic.com/docs/opentelemetry/db360/mysql/optional#tls), see Enable detailed insights.

## Restart NRDOT Collector [#restart]

Restart the NRDOT Collector service for configuration changes to take effect. The collector loads configuration parameters once at startup and doesn't support hot-reloading. Any changes made to the configuration while the collector is running remain inactive until the process restarts.

```bash
sudo systemctl restart nrdot-collector
```

## Related documentation [#related]

[Compatibility and prerequisites](https://docs.newrelic.com/docs/opentelemetry/db360/mysql/compatibility)

Learn about supported MySQL versions, required grants, and network requirements.

[Metrics reference](https://docs.newrelic.com/docs/opentelemetry/db360/mysql/metrics-reference)

Learn about the available metrics collected by the NRDOT Collector.

[Troubleshooting guide](https://docs.newrelic.com/docs/opentelemetry/db360/mysql/troubleshooting)

Learn how to troubleshoot common issues with MySQL monitoring.
