我正在尝试连接到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集群吗?
我还试着连接到一个maxscaler,然后从那里连接到一个数据库服务器->这是可行的。
谢谢您!
更新:
谢谢你的来信。首先,我无法运行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.
希望你(作为mariadbMaven)能帮我解决这个问题!
谢谢你和问候!
更新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
4条答案
按热度按时间zengzsys1#
索科拉塔,
我发现你的配置有问题。请从侦听器的代码段中删除端口或套接字。如果您希望有一个用于网络侦听器的端口和用于本地主机连接的套接字,则需要创建单独的代码段。下面,我对您的配置进行了一些调整,以适应我的实验室,您可以在下面看到:
最大刻度.cnf
最大刻度.log
我测试了三个听众的连通性:
4006
4007
4008
试试看,让我们知道进展如何,干杯!
2wnc66cl2#
支持人员告诉过你,你是说,microsoft azure支持,对吧?顺便说一句,我的建议是,你有一个小项目,在azure上建立你自己的vnet,旋转4个新vm,1个maxscale和3个mariadb集群的其他vm。一旦定义了vms,就在所有服务器上设置mariadb官方repo:
设置mariadb服务器和mariadb maxscale,设置集群,创建maxscale用户,并使用我们在这里定义的配置使其工作。
去玩吧。
cyvaqqii3#
请暂时启用maxscale示例的日志信息并再次尝试连接,好吗?启用logu info后,它将向maxscale日志(/var/log/maxscale/maxscale.log)添加事件,该日志将显示有关为什么无法将请求路由到后端的更多详细信息。
下面的命令将动态启用日志:
下面的命令将动态禁用日志:
期待您的来信。
3pmvbmvn4#
要运行maxadmin客户端,首先需要为该路由器分配cli路由器和侦听器,如中所述:
https://mariadb.com/kb/en/mariadb-enterprise/mariadb-maxscale-21-maxscale-21-cli/.
要添加到/etc/maxscale.cnf的配置如下:
将上述内容添加到/etc/maxscale.cnf并重新启动maxscale。之后,他们采用以下方法:
或
关于创建侦听器时的错误,请您在此处共享maxscale配置文件,然后我可以看一下吗?检查maxscale是否可以创建我上面建议的cli路由器侦听器。
期待您的来信。