Debug School

Akanksha
Akanksha

Posted on

Top 30 Haproxy Interview Questions with Answers multiple choice style

1. What is HAProxy?

a) A Linux distribution
b) A web server
c) A load balancer
d) A database management system
Answer: c) A load balancer

2. What is the primary purpose of HAProxy?

a) Caching web content
b) Distributing network traffic
c) Managing databases
d) Running web applications
Answer: b) Distributing network traffic

3. Which layer of the OSI model does HAProxy operate at?

a) Data Link
b) Transport
c) Application
d) Network
Answer: b) Transport

4. What is the default port for HAProxy's administration interface?

a) 80
b) 443
c) 8080
d) 22002
Answer: c) 8080

5. What is the configuration file for HAProxy typically called?

a) haproxy.yaml
b) haproxy.conf
c) config.json
d) proxy.conf
Answer: b) haproxy.conf

6. Which algorithm does HAProxy use for load balancing by default?

a) Round Robin
b) Least Connections
c) Random
d) Weighted Round Robin
Answer: a) Round Robin

7. Which of the following is not a valid HAProxy backend server state?

a) active
b) down
c) disabled
d) offline
Answer: d) offline

8. What is the primary purpose of a frontend in HAProxy?

a) Serve web content
b) Manage backend servers
c) Handle incoming traffic
d) Perform health checks
Answer: c) Handle incoming traffic

9. Which HAProxy option is used to define a server's IP address and port?

a) server
b) address
c) backend
d) listen
Answer: a) server

10. In HAProxy, what is stickiness used for?

a) Preventing traffic distribution
b) Ensuring consistent session persistence
c) Increasing server load
d) Authenticating users
Answer: b) Ensuring consistent session persistence

11. What is the purpose of the "timeout client" directive in HAProxy?

a) Sets the maximum request processing time for the client
b) Sets the maximum connection time for the client
c) Defines the client's IP address
d) Specifies the client's DNS name
Answer: a) Sets the maximum request processing time for the client

12. How can you enable SSL termination in HAProxy?

a) Use the "ssl" directive
b) Set the "mode" directive to "ssl"
c) Install an SSL certificate on the HAProxy server
d) Use the "redirect" directive
Answer: b) Set the "mode" directive to "ssl"

13. What does the "global" section in the HAProxy configuration define?

a) Frontend settings
b) Backend servers
c) Global settings that apply to the entire configuration
d) Security rules
Answer: c) Global settings that apply to the entire configuration

14. Which of the following is not a valid HAProxy ACL (Access Control List) match criterion?

a) src
b) reqrep
c) path
d) hdr
Answer: b) reqrep

15. What is the purpose of the "option httplog" directive in HAProxy?

a) Enables HTTP request and response logging
b) Sets the log file path
c) Specifies the HTTP version to use
d) Enables browser cookie support
Answer: a) Enables HTTP request and response logging

16. How can you check the HAProxy configuration file for syntax errors without actually starting HAProxy?

a) Use the "haproxy -t" command
b) Use the "haproxy -s" command
c) Use the "haproxy -c" command
d) Use the "haproxy -r" command
Answer: a) Use the "haproxy -t" command

17. Which of the following is not a valid HAProxy logging facility?

a) local0
b) local7
c) console
d) syslog
Answer: c) console

18. What is the purpose of the "balance" directive in HAProxy?

a) Sets the server's weight
b) Defines the load balancing algorithm
c) Sets the server's IP address
d) Specifies the server's health check interval
Answer: b) Defines the load balancing algorithm

19. In HAProxy, what is the purpose of the "default-server" directive?

a) Sets the default server to use in the backend
b) Defines a default ACL
c) Specifies the default server name
d) Sets the maximum server connections
Answer: a) Sets the default server to use in the backend

20. How can you dynamically add or remove servers from an HAProxy configuration without restarting it?

a) Use the "haproxy -r" command
b) Edit the configuration file and send a SIGHUP signal to HAProxy
c) Use the "haproxy -x" command
d) Use the "haproxy -d" command
Answer: b) Edit the configuration file and send a SIGHUP signal to HAProxy

21. Which of the following is not a valid HAProxy mode?

a) HTTP
b) TCP
c) SSL
d) UDP
Answer: c) SSL

22. What is the purpose of the "timeout server" directive in HAProxy?

a) Sets the maximum response processing time for the server
b) Sets the maximum connection time for the server
c) Defines the server's IP address
d) Specifies the server's DNS name
Answer: a) Sets the maximum response processing time for the server

23. Which command is used to check the HAProxy status in real-time from the command line?

a) haproxy -s
b) haproxy -t
c) haproxy -c
d) haproxy -q
Answer: a) haproxy -s

24. What is the purpose of the "default" section in the HAProxy configuration file?

a) Sets default server weights
b) Defines default backend settings
c) Specifies the default server name
d) Lists the default frontend servers
Answer: b) Defines default backend settings

25. How can you force a specific server to handle all requests for a certain path in HAProxy?

a) Use the "force" directive
b) Use the "reqrep" directive
c) Use the "redirect" directive
d) Use the "acl" directive
Answer: b) Use the "reqrep" directive

26. What is the purpose of the "maxconn" directive in HAProxy?

a) Sets the maximum number of concurrent connections for the frontend
b) Sets the maximum number of concurrent connections for the backend
c) Sets the maximum number of concurrent connections for a server
d) Sets the maximum number of concurrent connections for the entire HAProxy instance
Answer: c) Sets the maximum number of concurrent connections for a server

27. Which of the following is not a valid HAProxy frontend option?

a) mode
b) bind
c) maxconn
d) default_backend
Answer: a) mode

28. What does the "option forwardfor" directive do in HAProxy?

a) Forwards requests to the default backend
b) Appends the client's IP address to the X-Forwarded-For header
c) Sets the server's IP address
d) Appends the client's IP address to the request URL
Answer: b) Appends the client's IP address to the X-Forwarded-For header

29. How can you specify the logging format in HAProxy?

a) Use the "format" directive
b) Edit the HAProxy source code
c) Modify the syslog configuration
d) Use the "log" directive with custom log format
Answer: d) Use the "log" directive with custom log format

30. What is the purpose of the "timeout connect" directive in HAProxy?

a) Sets the maximum connection time for the client
b) Sets the maximum request processing time for the client
c) Sets the maximum connection time for the server
d) Defines the server's IP address
Answer: c) Sets the maximum connection time for the server

Top comments (0)