← All guides

Check Configuration Sync Across Multiple Servers

Updated:

Check Configuration Sync Across Multiple Servers

Need to check multi-server synchronization on your Linux infrastructure? Want to monitor server synchronization, verify configuration consistency, and detect synchronization issues? This guide shows you how to check multi-server synchronization using built-in commands and automated monitoring with Zuzia.app.

For comprehensive multi-server monitoring strategies, see Multi. For troubleshooting infrastructure issues, see Application Deployment Failures.

Why Checking Multi-Server Synchronization Matters

Multi-server infrastructure requires servers to be synchronized for consistency and reliability. When servers become out of sync, configurations can diverge, services can behave inconsistently, and infrastructure reliability can be compromised. Checking multi-server synchronization helps you detect synchronization issues, verify configuration consistency, maintain infrastructure reliability, and ensure servers remain synchronized.

Method 1: Check Server Connectivity

Check server connectivity to verify servers can communicate:

Verify Server Connectivity

# Check server connectivity
for server in server1 server2 server3; do
  ping -c 1 $server > /dev/null && echo "$server: OK" || echo "$server: DOWN"
done

# Verify SSH connectivity
for server in server1 server2 server3; do
  ssh $server "echo 'OK'" && echo "$server: SSH OK" || echo "$server: SSH FAIL"
done

# Check server uptime
for server in server1 server2 server3; do
  ssh $server "uptime" | awk '{print $1, $3, $4}'
done

Monitor Server Status

# Check all servers are online

for server in server1 server2 server3; do
  ping -c 1 $server > /dev/null && ((online_count++))
done
echo "Online servers: $online_count/3"

# Verify service availability across servers
for server in server1 server2 server3; do
  ssh $server "systemctl is-active nginx" && echo "$server: nginx OK" || echo "$server: nginx FAIL"
done

Method 2: Verify Configuration Consistency

Verify configuration consistency to ensure servers are synchronized:

Compare Configurations

# Check configuration consistency
for server in server1 server2 server3; do
  ssh $server "md5sum /etc/nginx/nginx.conf"
done | sort | uniq -c

# Verify time synchronization
for server in server1 server2 server3; do
  ssh $server "date"
done

# Check software versions
for server in server1 server2 server3; do
  ssh $server "nginx -v"
done

Detect Configuration Drift

# Compare configurations across servers
for server in server1 server2 server3; do
  ssh $server "cat /etc/nginx/nginx.conf" > /tmp/nginx-$server.conf
done
diff /tmp/nginx-server1.conf /tmp/nginx-server2.conf
diff /tmp/nginx-server2.conf /tmp/nginx-server3.conf

Method 3: Monitor Synchronization Status

Monitor synchronization status to track server synchronization:

Track Synchronization Metrics

# Aggregate CPU usage across infrastructure
total_cpu=0
for server in server1 server2 server3; do
  cpu=$(ssh $server "top -bn1 | grep 'Cpu(s)' | awk '{print \$2}'" | sed 's/%//')
  total_cpu=$(echo "$total_cpu + $cpu" | bc)
done
avg_cpu=$(echo "scale=2; $total_cpu / 3" | bc)
echo "Average CPU: $avg_cpu%"

# Aggregate memory usage
total_mem=0
for server in server1 server2 server3; do
  mem=$(ssh $server "free | awk 'NR==2{print \$3*100/\$2}'")
  total_mem=$(echo "$total_mem + $mem" | bc)
done
avg_mem=$(echo "scale=2; $total_mem / 3" | bc)
echo "Average Memory: $avg_mem%"

Detect Synchronization Issues

# Check for servers with configuration differences
for server in server1 server2 server3; do
  config_hash=$(ssh $server "md5sum /etc/nginx/nginx.conf" | awk '{print $1}')
  echo "$server: $config_hash"
done | sort | uniq -c

# Identify servers out of sync
baseline=$(ssh server1 "md5sum /etc/nginx/nginx.conf" | awk '{print $1}')
for server in server2 server3; do
  current=$(ssh $server "md5sum /etc/nginx/nginx.conf" | awk '{print $1}')
  if [ "$current" != "$baseline" ]; then
    echo "$server: OUT OF SYNC"
  fi
done

Method 4: Automated Synchronization Monitoring with Zuzia.app

Manual checks work while you are looking. To keep running them without you, Zuzia uses its agent and scheduled tasks.

How it works in Zuzia

  • Install the Zuzia agent on the server with one command. CPU, RAM, disk, load and network metrics start reporting on their own, with alerts on a threshold, on drift from the server's normal, or on a disk fill-up forecast.
  • Save the commands from this guide as a scheduled task and choose how often it runs, from every minute to once a year. The agent runs it on every host you pick.
  • If a command fails, you get an alert right away by email, Slack, Discord, push (through your Pushover account) or SMS (through your Vonage account).
  • The output of every run is kept, so you can look back at what changed. On paid plans, AI can read the output and alert you only when it spots a problem.

Setting it up

  1. Add the server in the Zuzia dashboard and install the agent.
  2. Create a scheduled task with the check commands below, then choose the hosts and how often it runs.
  3. Choose your notification channels. Turn on maintenance mode during planned work so it doesn't trigger alerts.

Custom Synchronization Monitoring Commands

Add these commands as scheduled tasks on a central server:

# Check all servers connectivity
for server in server1 server2 server3; do
  ping -c 1 $server > /dev/null && echo "$server: OK" || echo "$server: DOWN"
done

# Monitor server synchronization
for server in server1 server2 server3; do
  ssh $server "md5sum /etc/nginx/nginx.conf"
done | sort | uniq -c

# Check infrastructure services
for server in server1 server2 server3; do
  ssh $server "systemctl is-active nginx"
done

Best Practices

1. Monitor Synchronization Continuously

Use Zuzia.app for continuous synchronization monitoring. Set up alerts before synchronization issues become critical. Review synchronization status regularly.

2. Maintain Configuration Baselines

Keep accurate configuration baselines. Store baselines in version control. Update baselines when authorized changes occur.

3. Coordinate Server Management

Maintain infrastructure consistency. Synchronize configurations across servers. Coordinate updates and changes.

Troubleshooting

Servers Out of Sync

When servers are out of sync:

  1. Compare configurations: diff /tmp/config-server1.txt /tmp/config-server2.txt
  2. Identify differences
  3. Synchronize configurations: Deploy consistent configuration to all servers
  4. Verify synchronization restored

Synchronization Issues Detected

When synchronization issues are detected:

  1. Check server connectivity: ping server1 server2 server3
  2. Verify configuration consistency: Compare configurations across servers
  3. Fix synchronization issues: Deploy consistent configurations

FAQ

How often should I check multi-server synchronization?

For production infrastructure, check synchronization every 15-30 minutes. Zuzia.app can check synchronization automatically and alert when synchronization issues are detected.

What should I monitor for synchronization?

Monitor server connectivity, configuration consistency, time synchronization, software versions, and service availability across servers.

Can Zuzia.app detect synchronization issues automatically?

Yes, Zuzia.app can detect synchronization issues by monitoring all servers, comparing configurations, detecting differences, and alerting when servers become out of sync.

Related guides, recipes, and problems

We use cookies to ensure the proper functioning of our website.