Multi-Server Solr Setup for Drupal

Configure and index multiple Solr servers

Multi-Server Setup

If you have multiple Solr servers with different indexes assigned to each, always specify the --server option to target the correct one.

# List all servers and their indexes
drush search-api:server-list

# Queue and index for production server
drush osri --server=production_solr
drush ost --server=production_solr --workers=8 --batch=500

# Queue and index for staging server (runs in parallel!)
drush osri --server=staging_solr
drush ost --server=staging_solr --workers=4 --batch=200

Understanding Servers vs Indexes

Server

A Search API server is a connection configuration to a Solr instance. It defines the host, port, authentication, and other connection details.

Index

A Search API index defines what content to index and which fields to include. Each index is assigned to exactly one server.

Common Setup

Server Indexes Purpose
production_solr main_content, products Live site search
staging_solr main_content_stg, products_stg Testing before deployment

Server-Specific Commands

View Server Configuration

# List all servers
drush search-api:server-list

# Check specific server status
drush search-api:server-status production_solr

Queue All Items for Reindexing on a Server

drush osri --server=production_solr

Index All on a Server

drush ost --server=production_solr --workers=8 --batch=500

Check Status for a Server

drush oss --server=production_solr
⚠️ Default Server
If you don't specify --server, the indexer auto-detects the first available Solr server. This may not be what you want in a multi-server setup. Always specify the server explicitly.

Parallel Server Indexing

You can index multiple servers simultaneously. Each server gets its own isolated session with separate PID files, logs, and chunk directories. No conflicts.

# Start production server indexing
drush ost --server=production_solr --workers=8 --batch=500

# Start staging server indexing (runs in parallel!)
drush ost --server=staging_solr --workers=4 --batch=200

# Check progress for all running sessions
drush oss

# Stop only staging, let production continue
drush osstop --server=staging_solr

# Stop everything
drush osstop
💡 Session Isolation
Each server (or server+index combination) gets its own set of files: /tmp/opensolr_turbo_{server}.log, /tmp/opensolr_turbo_{server}_master.pid, etc. You can run as many parallel indexers as your server resources allow.

Parallel Index-Level Indexing

You can also run separate indexers for individual indexes on the same server:

# Index content and taxonomy separately
drush ost --index=main_content --workers=8
drush ost --index=taxonomy_terms --workers=4

# Each gets its own session key: {server}__{index}
# Check all sessions
drush oss