我正在尝试建立一个由 3 个节点组成的 xtraDB 集群。现在我已经启动并运行了集群,并且按照说明我正在尝试设置 ProxySQL 以进行负载平衡。
所以我在所有 3 个节点上都安装了 proxySQL。现在我正在尝试使用管理工具对其进行配置。但是每次我运行命令时:
[root@node1 log]# proxysql-admin --config-file=/etc/proxysql-admin.cnf --enable
它回来了:
此脚本将协助配置 ProxySQL(目前仅支持 Percona XtraDB 集群与 ProxySQL 结合使用)
ProxySQL read/write configuration mode is singlewrite
ERROR 1045 (28000): ProxySQL Error: Access denied for user 'proxysql_admin'@'' (using password: YES)
Please check the ProxySQL connection parameters! Terminating.
现在我会说这个错误非常简单。但是,我在 MySQL 集群和 .cnf 文件中都正确定义了用户 proxysql_admin。
这是我的 proxysql-admin.cnf 文件:
# proxysql admin interface credentials.
export PROXYSQL_DATADIR='/var/lib/proxysql'
export PROXYSQL_USERNAME='proxysql_admin'
export PROXYSQL_PASSWORD='placeholder_pass'
export PROXYSQL_HOSTNAME='localhost'
export PROXYSQL_PORT='6032'
# PXC admin credentials for connecting to pxc-cluster-node.
export CLUSTER_USERNAME='proxysql_admin'
export CLUSTER_PASSWORD='placeholder_pass'
#export CLUSTER_HOSTNAME='localhost'
export CLUSTER_HOSTNAME='ccloud'
export CLUSTER_PORT='3306'
# proxysql monitoring user. proxysql admin script will create this user in pxc to monitor pxc-nodes.
export MONITOR_USERNAME='monitor'
export MONITOR_PASSWORD='placeholder_pass'
# Application user to connect to pxc-node through proxysql
export CLUSTER_APP_USERNAME='proxysql_user'
export CLUSTER_APP_PASSWORD='placeholder_pass'
# ProxySQL read/write hostgroup
export WRITE_HOSTGROUP_ID='10'
export READ_HOSTGROUP_ID='11'
# ProxySQL read/write configuration mode.
export MODE="singlewrite"
# ProxySQL Cluster Node Priority File
export HOST_PRIORITY_FILE=$PROXYSQL_DATADIR/host_priority.conf
这是mysql集群上的用户:
mysql> select User,Host from mysql.user;
+----------------+-----------+
| User | Host |
+----------------+-----------+
| proxysql_admin | |
| proxysql_admin | % |
| mysql.session | localhost |
| mysql.sys | localhost |
| proxysql_admin | localhost |
| proxysql_user | localhost |
| root | localhost |
| sstuser | localhost |
+----------------+-----------+
我已经尝试过几次更改接口,但这似乎不是问题。任何人都知道为什么我的用户没有连接?
以防万一,这是我正在尝试的节点上集群的 my.cnf:
#
# The Percona XtraDB Cluster 5.7 configuration file.
#
#
# * IMPORTANT: Additional settings that can override those from this file!
# The files must end with '.cnf', otherwise they'll be ignored.
# Please make any edits and changes to the appropriate sectional files
# included below.
#
!includedir /etc/my.cnf.d/
!includedir /etc/percona-xtradb-cluster.conf.d/
[mysqld]
server-id=1
datadir=/mysql-data
socket=/mysql-data/mysql.sock
pid-file=/var/run/mysqld/mysqld.pid
wsrep_provider=/usr/lib64/galera3/libgalera_smm.so
wsrep_cluster_name=ccloud
wsrep_cluster_address=gcomm://ip1,ip2,ip3
wsrep_node_name=pxc1
wsrep_node_address=ip1
wsrep_sst_method=xtrabackup-v2
wsrep_sst_auth=sstuser:placeholder_pass
pxc_strict_mode=ENFORCING
binlog_format=ROW
default_storage_engine=InnoDB
innodb_autoinc_lock_mode=2