Not the answer you need?
Register and ask your own question!

ProxySQL and PXC - unable to connect to localhost with proxysql-admin

amcalexanderamcalexander EntrantCurrent User Role Novice
I've gotten past the admin issue and can log into proxysql as admin by working through a few threads, but I've ran across an issue I am unable to figure out.
Upon trying to run "sudo proxysql-admin --config-file=/etc/proxysql-admin.cnf --enable", the ProxySQL server reports this:

ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (111)
ERROR (line:703) : PXC connection check failed.
-- Could not connect to the PXC cluster at localhost:3306
-- Please check the PXC connection parameters and status.

My setup - 1 ProxySQL VM
3 PXC VMs 5.7

I followed this guide, https://www.percona.com/doc/percona-xtradb-cluster/5.7/howtos/proxysql-v2.html#installing-proxysql-v2, but the issue I'm finding is that there are no servers laid out to connect to and all I get is unable to connect to localhost on 3306, this is due to PXC 5.7 not running on localhost:3306, but running on 3 other servers. I'm unsure how to tell ProxySQL about these servers so the proxysql-admin utility knows about them. This utility doesn't seem to allow me to budge any further in this install until it knows about the PXC servers, which it's not actually doing anything about. I'm sure I've missed a step in the 5 or so install docs I've been fumbling through. Is there one solid source that goes over this in depth? Seems to be a lot of "gotchas" in terms of things to double check, but a lot of these are spread across multiple write-ups from Percona.

Comments

  • amcalexanderamcalexander Entrant Current User Role Novice
    Sorry, I forgot the config:

    # proxysql admin interface credentials.
    export PROXYSQL_DATADIR='/var/lib/proxysql'
    export PROXYSQL_USERNAME='admin'
    export PROXYSQL_PASSWORD='SAVED-Password'
    export PROXYSQL_HOSTNAME='localhost'
    export PROXYSQL_PORT='6032'

    # PXC admin credentials for connecting to pxc-cluster-node.
    export CLUSTER_USERNAME='sbuser'
    export CLUSTER_PASSWORD='SAVED-Password'
    export CLUSTER_HOSTNAME='localhost'
    export CLUSTER_PORT='3306'

    # proxysql monitoring user. proxysql admin script will create this user in pxc to monitor pxc-nodes.
    export MONITOR_USERNAME='proxysql'
    export MONITOR_PASSWORD='SAVED-Password'

    # Application user to connect to pxc-node through proxysql
    export CLUSTER_APP_USERNAME='proxysql_user'
    export CLUSTER_APP_PASSWORD='SAVED-Password'

    # ProxySQL hostgroup IDs
    export WRITER_HOSTGROUP_ID='10'
    export READER_HOSTGROUP_ID='11'
    export BACKUP_WRITER_HOSTGROUP_ID='12'
    export OFFLINE_HOSTGROUP_ID='13'

    # ProxySQL read/write configuration mode.
    export MODE="singlewrite"

    # max_connections default (used only when INSERTing a new mysql_servers entry)
    export MAX_CONNECTIONS="1000"

    # Determines the maximum number of writesets a node can have queued
    # before the node is SHUNNED to avoid stale reads.
    export MAX_TRANSACTIONS_BEHIND=100

    # Connections to the backend servers (from ProxySQL) will use SSL
    export USE_SSL="no"

    # Determines if a node should be added to the reader hostgroup if it has
    # been promoted to the writer hostgroup.
    # If set to 'yes', then all writers (including backup-writers) are added to
    # the read hostgroup.
    # If set to 'no', then none of the writers (including backup-writers) are added.
    # If set to 'backup', then only the backup-writers will be added to
    # the read hostgroup.
    export WRITERS_ARE_READERS="backup"
Sign In or Register to comment.

MySQL, InnoDB, MariaDB and MongoDB are trademarks of their respective owners.
Copyright ©2005 - 2020 Percona LLC. All rights reserved.