开启haproxy监控页面 和页面详细参数介绍

编辑haproxy.cfg  加上下面参数 
listen admin_stats
        stats   enable
        bind    *:8080    //监听的ip端口号
        mode    http    //开关
        option  httplog
        log     global
        maxconn 10
        stats   refresh 30s   //统计页面自动刷新时间
        stats   uri /admin    //访问的uri   ip:8080/admin
        stats   realm haproxy
        stats   auth admin:ad

  • 1
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
一个典型的Haproxy_exporter的监控metric例子 包含指标 haproxy_backend_bytes_in_total haproxy_backend_bytes_out_total haproxy_backend_client_aborts_total haproxy_backend_compressor_bytes_bypassed_total haproxy_backend_compressor_bytes_in_total haproxy_backend_compressor_bytes_out_total haproxy_backend_connection_errors_total haproxy_backend_current_queue haproxy_backend_current_server haproxy_backend_current_session_rate haproxy_backend_current_sessions haproxy_backend_http_connect_time_average_seconds haproxy_backend_http_queue_time_average_seconds haproxy_backend_http_response_time_average_seconds haproxy_backend_http_responses_compressed_total haproxy_backend_http_responses_total haproxy_backend_http_total_time_average_seconds haproxy_backend_response_errors_total haproxy_backend_retry_warnings_total haproxy_backend_server_aborts_total haproxy_backend_server_selected_total haproxy_backend_sessions_total haproxy_backend_up haproxy_backend_weight haproxy_exporter_build_info haproxy_exporter_csv_parse_failures haproxy_exporter_total_scrapes haproxy_frontend_bytes_in_total haproxy_frontend_bytes_out_total haproxy_frontend_compressor_bytes_bypassed_total haproxy_frontend_compressor_bytes_in_total haproxy_frontend_compressor_bytes_out_total haproxy_frontend_connections_total haproxy_frontend_current_session_rate haproxy_frontend_current_sessions haproxy_frontend_http_requests_total haproxy_frontend_http_responses_compressed_total haproxy_frontend_http_responses_total haproxy_frontend_limit_session_rate haproxy_frontend_limit_sessions haproxy_frontend_max_session_rate haproxy_frontend_max_sessions haproxy_frontend_request_errors_total haproxy_frontend_requests_denied_total haproxy_frontend_sessions_total haproxy_server_bytes_in_total haproxy_server_bytes_out_total haproxy_server_check_duration_seconds haproxy_server_check_failures_total haproxy_server_client_aborts_total haproxy_server_connection_errors_total haproxy_server_current_queue haproxy_server_current_session_rate haproxy_server_current_sessions haproxy_server_downtime_seconds_total haproxy_server_http_responses_total haproxy_server_max_queue haproxy_server_max_session_rate haproxy_server_max_sessions haproxy_server_redispatch_warnings_total haproxy_server_response_errors_total haproxy_server_retry_warnings_total haproxy_server_server_aborts_total haproxy_server_server_selected_total haproxy_server_sessions_total haproxy_server_up haproxy_server_weight haproxy_up process_cpu_seconds_total process_max_fds process_open_fds process_resident_memory_bytes process_start_time_seconds process_virtual_memory_bytes promhttp_metric_handler_requests_in_flight promhttp_metric_handler_requests_total
keepalived和haproxy是两种常用于高可用性和负载均衡的工具,但它们在功能和应用场景上有一些区别。 1. 功能: - keepalived:keepalived是一个开源的高可用性解决方案。它通过在主备服务器之间实现虚拟IP(VIP)的漂移来提供服务的高可用性。keepalived可以监听服务器的状态,并在主服务器故障时自动将VIP切换到备份服务器上。 - haproxyhaproxy是一个高性能的、开源的负载均衡器。它可以将传入的请求分发到多个后端服务器,以实现负载均衡。haproxy支持多种负载均衡算法,并且可以根据后端服务器的状态进行动态调整。 2. 应用场景: - keepalived:keepalived主要用于实现高可用性。通过使用keepalived,可以将主备服务器设置成热备份,以确保服务在主服务器故障时能够快速切换到备份服务器上,从而实现服务的高可用性。 - haproxyhaproxy主要用于实现负载均衡。通过使用haproxy,可以将传入的请求分发到多个后端服务器上,以实现请求的负载均衡。haproxy可以根据后端服务器的负载情况智能地选择目标服务器,并且在后端服务器发生故障时自动排除故障服务器。 3. 工作方式: - keepalived:keepalived通过VRRP(虚拟路由冗余协议)实现主备服务器之间的状态同步和故障切换。主备服务器之间周期性地发送心跳消息以检测彼此的状态,当主服务器故障时,备份服务器会接管VIP并提供服务。 - haproxyhaproxy通过代理来接收和处理传入的请求,并根据配置的负载均衡算法将请求分发到后端的服务器。haproxy可以基于请求的内容、源IP等信息进行灵活的请求分发和流量控制。 综上所述,keepalived主要用于实现高可用性,通过主备切换来确保服务的连续性;而haproxy主要用于实现负载均衡,将传入的请求分发到多个后端服务器上,以提高服务的性能和可扩展性。它们在不同的场景下可以一起使用,以实现高可用性和负载均衡的双重保障。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值