|
|
mysql -h controller -u keystone -pvic
% B! ]9 N5 q# z1 g5 ]3 E/ V* s8 V! \ERROR 2003 (HY000): Can't connect to MySQL server on 'controller' (111 "Connection refused")' _7 s- t% u) W
ERROR 2003 (HY000): Can't connect to MySQL server on 'controller' (111 "Connection refused")
2 x0 P" e; `4 x排查过程:
8 i- ]% v9 j6 l8 v1 Y3 k! \! n netstat -ntlp 先查看启动端口:
* Y S' l* ~+ D9 FActive Internet connections (only servers)
5 d+ Q0 W9 q0 l- n7 fProto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
# f# `( N! ]; ]tcp 0 0 192.168.90.65:3306 0.0.0.0:* LISTEN 5760/mysqld
) J! D" M6 J3 i. gtcp 0 0 192.168.90.65:11211 0.0.0.0:* LISTEN 4894/memcached
& d2 L, o4 v# J! s: {查看域名解析:
2 c) i5 z, m5 e8 Y2 K, p cat /etc/hosts2 a4 E( J- ]3 U& y- G9 V' {6 x
192.168.90.70 controller' x9 b$ |" q0 G9 K! b& V
192.168.90.65 controller1 - b# y- a% x) m- d" e
192.168.90.68 compute1
1 S( F l3 v' D* ?
2 d. z+ w5 `3 R( e- w; a偏偏这个时候的mysql 就连接不上,什么原因呢?公版的数据库用问题,这个地方设计不合理,郁闷的不行了。
/ Z2 H# x- A2 G& {! y! X8 ]原来是因为我们配置了mysql中bind-address* w0 e+ g c# p t! N
两个配置文件,一个是galer.cnf文件、另一个是mariadb-server.cnf 中注释掉这个8 H9 R6 ~9 F( t ~9 j/ L( U! ?
#bind-address=192.168.90.65
, m" w8 ~$ f/ G, E* g
3 B5 p6 ~8 r* _$ \重启数据库,其他条件不变的情况下,
$ H* ~) t' J( N. I7 Tmysql -h controller -u keystone -pvic
0 v) f& D$ K, e3 J4 u; U7 vWelcome to the MariaDB monitor. Commands end with ; or \g.9 f6 `8 e0 _- i, H
Your MariaDB connection id is 8
# n+ M7 u3 Y! ~" Z1 A2 B+ Q) [Server version: 10.1.20-MariaDB MariaDB Server
( k# s5 K( W7 P
% v8 k" T. F0 T; b- T! D6 WCopyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.2 J" h4 O% Y: m& Y6 U
% k- Y8 t, Y- O9 T+ SType 'help;' or '\h' for help. Type '\c' to clear the current input statement.7 g; Y# M+ o6 ?, S
: V3 @, w8 |& k6 R# E, v7 | ~* u. n
MariaDB [(none)]> 1 Y8 o! j: Z+ D# m, O t
! w2 V9 O2 ]+ x7 d) w& @
1 S- ~8 i- N' Y& m' s7 {) p问题解决了,但是问题来了,如果我们装高可用版本怎么办,单独分配两台主机啥也不干,就只是提供haproxy和keepalived吗?这个资源耗损太大了吧。8 Z1 _3 w8 I$ |$ [1 y! V
% I( ?3 l# H3 y" a5 w* l) H. y8 p3 x
- r& ~, |3 ]- N
: N, l, e: X- y7 k* P+ x |
|