0
0
Nginxdevops~20 mins

Backup servers in Nginx - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Backup Server Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
2:00remaining
Nginx Backup Server Fallback Behavior
Given the following nginx upstream configuration, what will happen when the primary server is down?
Nginx
upstream backend {
    server primary.example.com max_fails=3 fail_timeout=30s;
    server backup.example.com backup;
}

server {
    location / {
        proxy_pass http://backend;
    }
}
ARequests will be sent to backup.example.com first, then primary.example.com if backup fails.
BRequests will be sent only to primary.example.com regardless of its status.
CRequests will be sent to backup.example.com only if primary.example.com fails 3 times within 30 seconds.
DRequests will be load balanced equally between primary.example.com and backup.example.com.
Attempts:
2 left
💡 Hint
Think about how the 'backup' keyword affects server selection in nginx upstream blocks.
Configuration
intermediate
2:00remaining
Configuring Multiple Backup Servers in Nginx
Which nginx upstream configuration correctly sets up one primary server and two backup servers?
A
upstream backend {
    server primary.example.com;
    server backup1.example.com backup;
    server backup2.example.com backup;
}
B
upstream backend {
    server primary.example.com;
    server backup1.example.com backup;
    server backup2.example.com;
}
C
upstream backend {
    server primary.example.com backup;
    server backup1.example.com;
    server backup2.example.com backup;
}
D
upstream backend {
    server primary.example.com;
    server backup1.example.com;
    server backup2.example.com backup;
}
Attempts:
2 left
💡 Hint
Backup servers must be marked with the 'backup' keyword to be used only when primary fails.
Troubleshoot
advanced
2:00remaining
Troubleshooting Backup Server Not Used
You configured a backup server in nginx, but requests never go to it even when the primary server is down. What is the most likely cause?
AThe backup server is not marked with the 'backup' keyword in the upstream block.
BThe backup server is marked with 'backup' but has a higher weight than the primary server.
CThe proxy_pass directive is missing in the server block.
DThe primary server has 'max_fails' set too high, so nginx never marks it as down.
Attempts:
2 left
💡 Hint
Consider how nginx decides a server is down and when it switches to backup.
🔀 Workflow
advanced
2:00remaining
Backup Server Failover Workflow
What is the correct sequence of events when nginx fails over from a primary to a backup server?
A1,2,3,4
B2,1,3,4
C1,3,2,4
D3,1,2,4
Attempts:
2 left
💡 Hint
Think about how nginx detects failure and switches servers step-by-step.
Best Practice
expert
3:00remaining
Best Practice for Backup Server Health Checks
Which configuration snippet best ensures nginx properly detects backup server health before sending traffic to it?
A
upstream backend {
    server primary.example.com max_fails=3 fail_timeout=10s;
    server backup.example.com backup;
}
B
upstream backend {
    server primary.example.com max_fails=3 fail_timeout=10s;
    server backup.example.com backup max_fails=1 fail_timeout=5s;
}
C
upstream backend {
    server primary.example.com max_fails=3 fail_timeout=10s;
    server backup.example.com backup max_fails=10 fail_timeout=60s;
}
D
upstream backend {
    server primary.example.com max_fails=3 fail_timeout=10s;
    server backup.example.com max_fails=1 fail_timeout=5s;
}
Attempts:
2 left
💡 Hint
Backup servers should have health check parameters to avoid sending traffic to unhealthy backups.