programing

두 번째 및 세 번째 노드에 대한 HAroxy 연결은 첫 번째 노드에만 있어야 합니다.

telecom 2023. 8. 18. 20:51
반응형

두 번째 및 세 번째 노드에 대한 HAroxy 연결은 첫 번째 노드에만 있어야 합니다.

이것은 우리의/etc/haproxy/haproxy.cfg

global
  daemon
  stats  socket /var/lib/haproxy/stats

defaults
  maxconn  10000
  mode  tcp
  timeout  connect 5s
  timeout  client 30s
  timeout  server 30s

listen galera
  bind 192.168.55.19:3306
  option httpchk
  option tcplog
  stick on dst
  stick-table type ip size 2
  timeout client 90m
  timeout server 90m
  server galera-1 192.168.55.31:3306 check inter 1s port 9200 on-marked-down shutdown-sessions
  server galera-2 192.168.55.32:3306 check inter 1s port 9200 on-marked-down shutdown-sessions
  server galera-3 192.168.55.33:3306 check inter 1s port 9200 on-marked-down shutdown-sessions

listen monitor
  bind 127.0.0.01:9300
  mode http
  monitor-uri /status
  stats enable
  stats uri /admin
  stats realm Haproxy\ Statistics
  stats auth root:Eef7ye9Aeemu7Cei
  stats refresh 5s

첫 번째 노드 galera-1에만 연결하려고 합니다. galera-2 및 galera-3은 페일오버 전용이어야 합니다.

netstat에서는 꽤 많은 연결이 보입니다. 왜죠?문제 해결 방법?

# netstat -tupan | grep 192.168.55.32
tcp        0      0 192.168.55.34:59482        192.168.55.32:3306         ESTABLISHED 5045/haproxy
tcp        0      0 192.168.55.34:59466        192.168.55.32:3306         ESTABLISHED 5045/haproxy
tcp        0      0 192.168.55.34:54498        192.168.55.32:3306         ESTABLISHED 5045/haproxy
tcp        0      0 192.168.55.34:45546        192.168.55.32:3306         ESTABLISHED 5045/haproxy
tcp        0      0 192.168.55.34:54430        192.168.55.32:3306         ESTABLISHED 5045/haproxy
tcp        0      0 192.168.55.34:59502        192.168.55.32:3306         ESTABLISHED 5045/haproxy
tcp        0      0 192.168.55.34:59515        192.168.55.32:3306         ESTABLISHED 5045/haproxy
tcp        0      0 192.168.55.34:60039        192.168.55.32:3306         TIME_WAIT   -
tcp        0      0 192.168.55.34:59454        192.168.55.32:3306         ESTABLISHED 5045/haproxy
tcp        0      0 192.168.55.34:59523        192.168.55.32:3306         ESTABLISHED 5045/haproxy
tcp        0      0 192.168.55.34:59518        192.168.55.32:3306         ESTABLISHED 5045/haproxy
tcp        0      0 192.168.55.34:59413        192.168.55.32:3306         ESTABLISHED 5045/haproxy

장애 조치

네가 원한다면galera-2그리고.galera-3페일오버만 수행하려면 다음을 추가합니다.backup그것의 키워드.server선.

다중 연결

저한테는 평범해 보여요.MySQL 클라이언트 또는 DB에 연결하는 앱에 의해 열 수 있습니다.이러한 연결이 무엇을 위한 것인지 확인하기 위해 Wireshark(클라이언트에서 실행) 또는 Wireshark와 같은 패킷 스니퍼를 사용할 수 있습니다.tcpdump(서버에서).


설정에 대한가지 설명:

  • 1개의 활성화된 백업과 2개의 백업은 오버킬인 것 같습니다.이러한 서버에 많은 장애가 발생할 것으로 예상하십니까?
  • 활성 서버가 하나뿐인 경우에는 스틱 테이블이 의미가 없습니다.
  • 모니터 블록에서 사용하는 것이 실제 루트 암호입니까?!

언급URL : https://stackoverflow.com/questions/35868679/haproxy-connections-to-second-and-third-node-should-be-only-to-the-first-node

반응형