2016-10-11 2 views
0

구성 안녕하십니까, 디지털 코리아 설명서, percona 5.7 기준에 대한 roundrobin으로 haproxy를 구성했지만 haproxy 서버에서 데이터베이스에 연결하려고 할 때 오류가 발생합니다.Haproxy + percona 5.7 xtradb 오류

haproxy 서버에서

:

mysql -h 127.0.0.1 -u haproxy_root -p -e "SHOW DATABASES" 

그리고 난 오류 얻을 :

ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 2 

Haproxy 설정 :

lobal 
     log 127.0.0.1 local0 
     log 127.0.0.1 local1 notice 
     #log loghost local0 info 
     maxconn 1024 
     #chroot /usr/share/haproxy 
     user haproxy 
     group haproxy 
     daemon 
     #debug 
     #quiet 


defaults 
     log  global 
     mode http 
     option tcplog 
     option dontlognull 
     retries 3 
     option redispatch 
     maxconn 1024 
     timeout connect 5000ms 
     timeout client 50000ms 
     timeout server 50000ms 

listen galera_cluster 
     bind 127.0.0.1:3306 
     mode tcp 
     option httpchk 
     balance leastconn 
     server galera-node01 192.168.0.101:3306 check port 9200 
     server galera-node02 192.168.0.102:3306 check port 9200 
     server galera-node03 192.168.0.103:3306 check port 9200 

나는 데이터베이스 192.168.0.101에 직접 연결하는 경우

, 모든 것을 작품, 나는 데이터베이스에서 응답을 얻을,하지만 요청을 통해 haproxy 127.0.0.1 나는이 오류가 발생 : MySQL을

ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 2

내의 xinetd 설정 : 내가 포트 9200에 PXC 노드에 텔넷 경우, 내가 가진

# default: on 
# description: mysqlchk 
service mysqlchk 
{ 
# this is a config for xinetd, place it in /etc/xinetd.d/ 
     disable = no 
     flags   = REUSE 
     socket_type  = stream 
     type   = UNLISTED 
     port   = 9200 
     wait   = no 
     user   = nobody 
     server   = /usr/bin/clustercheck 
     server_args = percona percona 
     log_on_failure += USERID 
     only_from  = 0.0.0.0/0 
     # 
     # Passing arguments to clustercheck 
     # <user> <pass> <available_when_donor=0|1> <log_file> <available_when_readonly=0|1> <defaults_extra_file>" 
     # Recommended: server_args = user pass 1 /var/log/log-file 0 /etc/my.cnf.local" 
     # Compatibility: server_args = user pass 1 /var/log/log-file 1 /etc/my.cnf.local" 
     # 55-to-56 upgrade: server_args = user pass 1 /var/log/log-file 0 /etc/my.cnf.extra" 
     # 
     # recommended to put the IPs that need 
     # to connect exclusively (security purposes) 
     per_source  = UNLIMITED 
} 

는 :

telnet 192.168.0.101 9200 
Trying 192.168.0.101... 
Connected to 192.168.0.101. 
Escape character is '^]'. 
HTTP/1.1 503 Service Unavailable 
Content-Type: text/plain 
Connection: close 
Content-Length: 57 

Percona XtraDB Cluster Node is not synced or non-PRIM. 
Connection closed by foreign host. 

답변

0

이 가장 일반적인 이유는 모든 노드입니다 클러스터의 HAProxy 통계를 사용하도록 설정 한 경우 모든 노드가 작동 중인지 확인하십시오. 그렇지 않으면 mysqlchk 서비스가 클러스터 노드에 제대로 연결될 수 없을 가능성이 높습니다.

mysqlchk xinetd 서비스가 적절한 server_args를 구성하는지 확인하십시오. 이러한 설정되면, xinetd를 다시 시작하고, 포트 9200에 텔넷은

[[email protected] log]# cat /etc/xinetd.d/mysqlchk 
# default: on 
# description: mysqlchk 
service mysqlchk 
{ 
# this is a config for xinetd, place it in /etc/xinetd.d/ 
     ... 
     server   = /usr/bin/clustercheck 
     server_args = percona percona 
     ... 
     # Passing arguments to clustercheck 
     # <user> <pass> <available_when_donor=0|1> <log_file> <available_when_readonly=0|1> <defaults_extra_file>" 
     # Recommended: server_args = user pass 1 /var/log/log-file 0 /etc/my.cnf.local" 
} 

UPDATE 유효성을 검사 : 나는 경우

확인 mysqlchk을 포함하여보다 철저한 절차, 구성, 여기에서 찾을 수 있습니다됩니다

https://www.percona.com/doc/percona-xtradb-cluster/5.6/howtos/virt_sandbox.html

+0

을 데이터베이스 192.168.0.101에 직접 연결하면 모든 것이 작동하지만 데이터베이스에서 응답을 받지만 haproxy 127.0.0.1을 통해 요청을하면이 오류가 발생합니다 : – dodcens

+0

PXC 노드 중 하나에서 포트 9200에 텔넷을 연결할 수 있습니까? mysqlchk가 작동하는지 확인하려면? –

+0

내가 가지고있어 : 텔넷 192.168.0.101 9200 시도하고있는 192.168.0.101 ... 192.168.0.101에 연결했다. 이스케이프 문자는 '^]'입니다. HTTP/1.1 503 서비스를 사용할 수 없음 콘텐츠 유형 : 텍스트/일반 연결 : 가까운 콘텐츠 길이 : 57 Percona XtraDB 클러스터 노드가 동기화 또는 비 PRIM되지 않습니다. 외부 호스트가 연결을 종료했습니다. – dodcens