我正在尝试连接到 Azure 中的 MariaDB TX 2.0 集群,但它不起作用。我在配置步骤中创建了一个公共负载均衡器,部署后我得到了一个 IP 地址和一个主机名。
例子
mymariadb.westus.cloudapp.azure.com
mysql连接字符串:
mysql -h mymariadb.westus.cloudapp.azure.com -P 4006 -u myapp -pmypassword mydb
我收到此错误:
mysql: [Warning] Using a password on the command line interface can be insecure.
**ERROR 2003 (HY000): Can't connect to MySQL server on 'mymariadb.westus.cloudapp.azure.com' (110)**
任何想法为什么我无法连接到 MariaDB 集群?
我还尝试连接到一个 maxscaller 并从那里连接到一个数据库服务器 -> 这很有效。
谢谢!
更新:
谢谢你的帖子。首先,我无法运行 maxadmin:
Unable to connect to MaxScale at /tmp/maxadmin.sock: No such file or directory
我查看日志,发现监听器有问题
2018-05-15 20:18:03 error : Creation of listener 'Read-Connection-Listener' for service 'Read Connection Router' failed, because both 'socket' and 'port' are defined. Only either one is allowed.
2018-05-15 20:18:03 error : Creation of listener 'Write-Connection-Listener' for service 'Write Connection Router' failed, because both 'socket' and 'port' are defined. Only either one is allowed.
2018-05-15 20:18:03 error : Creation of listener 'RW-Split-Listener' for service 'RW Split Router' failed, because both 'socket' and 'port' are defined. Only either one is allowed.
也找到这个:
2018-05-15 20:18:03 warning: Protocol module 'mysqlbackend' has been deprecated, use 'mariadbbackend' instead.
希望您(作为 MariaDB 专家)可以帮助我解决这个问题!
谢谢和问候!
更新 2
这是我的 cnf 文件(我没有做任何更改)。这应该是正确且有效的,对吗?
[CLI]
type=service
router=cli
[RW Split Listener]
type=listener
service=RW Split Router
protocol=MySQLClient
port=4006
socket=/var/lib/maxscale/rwsplit.sock
[Write Connection Listener]
type=listener
service=Write Connection Router
protocol=MySQLClient
port=4007
socket=/var/lib/maxscale/writeconn.sock
[Read Connection Listener]
type=listener
service=Read Connection Router
protocol=MySQLClient
port=4008
socket=/var/lib/maxscale/readconn.sock
[CLI Listener]
type=listener
service=CLI
protocol=maxscaled
socket=/tmp/maxadmin.sock
[MaxInfo]
type=service
router=maxinfo
[MaxInfo JSON Listener]
type=listener
service=MaxInfo
protocol=HTTPD
port=8003
address=localhost
[db1]
type=server
address=172.16.4.4
port=3306
protocol=MySQLBackend
[db2]
type=server
address=172.16.4.5
port=3306
protocol=MySQLBackend
[db3]
type=server
address=172.16.4.6
port=3306
protocol=MySQLBackend
更新 3:
我进行了您建议的更改并尝试使用 maxadmin 命令:
2018-05-18 07:12:58 error : Creation of listener 'Read-Connection-Listener' for service 'Read Connection Router' failed, because both 'socket' and 'port' are defined. Only either one is allowed.
2018-05-18 07:12:58 error : Creation of listener 'Write-Connection-Listener' for service 'Write Connection Router' failed, because both 'socket' and 'port' are defined. Only either one is allowed.
2018-05-18 07:12:58 error : Creation of listener 'RW-Split-Listener' for service 'RW Split Router' failed, because both 'socket' and 'port' are defined. Only either one is allowed.
2018-05-18 07:12:58 notice : Monitor 'Galera-Monitor' is missing the 'journal_max_age' parameter, using default value of 28800 seconds.
2018-05-18 07:12:58 notice : Monitor 'Galera-Monitor' is missing the 'script_timeout' parameter, using default value of 90 seconds.
2018-05-18 07:12:58 error : 3 errors were encountered while processing the configuration file '/etc/maxscale.cnf'.
2018-05-18 07:12:58 error : Failed to open, read or process the MaxScale configuration file /etc/maxscale.cnf. Exiting.
2018-05-18 07:12:58 MariaDB MaxScale is shut down.
----------------------------------------------------
me@mdbec-max1:~$ maxadmin
Unable to connect to MaxScale at /tmp/maxadmin.sock: No such file or directory
更新 4
[maxscale]
threads=4
datadir=/var/lib/maxscale/data/
#[MySQL Monitor]
#type=monitor
#module=mysqlmon
#servers=server1,server2,server3
#user=myuser
#passwd=mypwd
#monitor_interval=10000
#backend_connect_timeout=
#backend_read_timeout=
#backend_write_timeout=
#detect_replication_lag=
#detect_stale_master=
[Galera Monitor]
type=monitor
module=galeramon
servers=db1,db2,db3
user=maxscalemonitor
passwd=I-DELETE-THIS-LINE
monitor_interval=1000
#disable_master_failback=
[qla]
type=filter
module=qlafilter
filebase=/tmp/QueryLog
[fetch]
type=filter
module=regexfilter
match=fetch
replace=select
[hint]
type=filter
module=hintfilter
[Write Connection Router]
type=service
router=readconnroute
servers=db1,db2,db3
user=maxscalemonitor
passwd=I-DELETE-THIS-LINE
router_options=master
localhost_match_wildcard_host=1
version_string=10.2.14-MariaDB Cluster
[Read Connection Router]
type=service
router=readconnroute
servers=db1,db2,db3
user=maxscalemonitor
passwd=I-DELETE-THIS-LINE
router_options=synced
localhost_match_wildcard_host=1
version_string=10.2.14-MariaDB Cluster
[RW Split Router]
type=service
router=readwritesplit
servers=db1,db2,db3
user=maxscalemonitor
passwd=I-DELETE-THIS-LINE
max_slave_connections=100%
localhost_match_wildcard_host=1
version_string=10.2.14-MariaDB Cluster
router_options=disable_sescmd_history=true
#use_sql_variables_in=master
#max_slave_replication_lag=21
#filters=hint|fetch|qla
#router_options=slave_selection_criteria=LEAST_CURRENT_OPERATIONS
[CLI]
type=service
router=cli
[RW Split Listener]
type=listener
service=RW Split Router
protocol=MySQLClient
port=4006
socket=/var/lib/maxscale/rwsplit.sock
[Write Connection Listener]
type=listener
service=Write Connection Router
protocol=MySQLClient
port=4007
socket=/var/lib/maxscale/writeconn.sock
[Read Connection Listener]
type=listener
service=Read Connection Router
protocol=MySQLClient
port=4008
socket=/var/lib/maxscale/readconn.sock
[CLI Listener]
type=listener
service=CLI
protocol=maxscaled
socket=/tmp/maxadmin.sock
[MaxInfo]
type=service
router=maxinfo
[MaxInfo JSON Listener]
type=listener
service=MaxInfo
protocol=HTTPD
port=8003
address=localhost
[CLIUnixListener]
type=listener
service=CLI
protocol=maxscaled
socket=default
[CLIInetListener]
type=listener
service=CLI
protocol=maxscaled
address=localhost
port=6603
[db1]
type=server
address=172.16.4.4
port=3306
protocol=MySQLBackend
[db2]
type=server
address=172.16.4.5
port=3306
protocol=MySQLBackend
[db3]
type=server
address=172.16.4.6
port=3306
protocol=MySQLBackend