Version Check
haproxy -v
重要文件与目录
- Config file:
/etc/haproxy/haproxy.cfg - Binary:
/usr/sbin/haproxy
Service Management
Start HAProxy:
systemctl start haproxy
配置变更后重启:
systemctl restart haproxy
Check status:
systemctl status haproxy
查看实时日志:
journalctl -u haproxy -f
Configuration
Edit config:
vim /etc/haproxy/haproxy.cfg
Validate config:
haproxy -c -f /etc/haproxy/haproxy.cfg
变更后重启:
systemctl restart haproxy
Notes
- HAProxy 已安装,但未自动完成配置
- Ensure
/etc/haproxy/haproxy.cfg请在使用前确认已正确设置 - 每次变更后都需要重启服务
- 默认配置为空,服务将无法正常运行