Skip to content
logo
Percona ProxySQL Admin tool
Percona Scheduler Admin options
Initializing search
    percona/proxysql-admin-tool-doc
    percona/proxysql-admin-tool-doc
    • Home
      • Use ProxySQL 1.x.x with ProxySQL Admin
      • Install ProxySQL 1.x.x
      • Install ProxySQL 1.X from a binary tarball
      • Configure ProxySQL 1.x.x
      • Download locations for ProxySQL 2.x.x and ProxySQL admin utilities
      • Install ProxySQL 2.x.x and the admin utilities
      • Install ProxySQL 2.x.x binary tarball
      • Build the Percona Scheduler admin tool
      • Start and stop ProxySQL
      • Upgrade ProxySQL
      • Uninstall ProxySQL 2.x.x
      • ProxySQL Admin tool changes
      • ProxySQL 2.x and proxysql-admin utility
      • The proxysql-admin functions
      • ProxySQL 2.x.x and Percona Scheduler Admin tool
      • Percona Scheduler Admin configuration
      • Percona Scheduler Admin statements
      • Percona Scheduler Admin options
        • -–add-query-rule
          • --add-query-rule requires
          • --add-query-rule example
        • –-adduser
          • –-adduser example
        • –-auto-assign-weights
          • --auto-assign-weights example
        • --config-file
        • --debug
        • –-disable / -d
          • --disable example
        • --disable_updates
        • –-enable / -e
          • --enable example
          • Verify -enable example
        • –-force
        • --help
        • –-is-enabled
          • --is-enabled example
          • --is-enabled verification example
          • --is-enabled example with cluster disabled
        • –-remove-all-servers
          • --remove-all-server example
        • –-server
          • -server example
        • –-status
          • --status example
        • –-sync-multi-cluster-users
        • –-syncusers
          • --syncusers example
        • --trace
        • –-update-cluster
        • –-update-mysql-version
          • --update-mysql-version example
        • –-update-read-weight
          • --update-read-weight example
        • –-update-write-weight
          • --update-write-weight example
        • --use-stdin-for-credentials
        • --version
        • –-write-node
          • --write-node example
      • Known issues in Percona Scheduler Admin
      • Release notes index
      • ProxySQL 2.4.7 and ProxySQL admin tools (2023-02-14)
      • ProxySQL 2.4.4-1.2 and ProxySQL admin tools (2022-11-08)
      • ProxySQL 2.4.4 and ProxySQL admin tools (2022-10-04)
      • ProxySQL 2.4.3 and ProxySQL admin tools (2022-08-31)
      • ProxySQL 2.4.2 and proxysql admin tools (2022-08-10)
      • ProxySQL 2.3.2-1.2, proxysql-admin, and percona-scheduler-admin (2022-06-15)
      • ProxySQL 2.3.2 and proxysql-admin (2021-11-03)
      • ProxySQL 2.2.0 and proxysql-admin (2021-08-10)
      • ProxySQL 2.1.1 and proxysql-admin (2021-07-09)
      • ProxySQL 2.0.18 and proxysql-admin (2021-04-19)
      • ProxySQL 2.0.17 and proxysql-admin (2021-04-06)
      • ProxySQL 2.0.15 and proxysql-admin (2020-11-17)
      • ProxySQL 2.0.14 and proxysql-admin (2020-09-24)
      • ProxySQL 2.0.13 and proxysql-admin (2020-08-05)
      • ProxySQL 2.0.12 and proxysql-admin (2020-06-11)
      • ProxySQL 2.0.7 and proxysql-admin (2019-10-23)
      • ProxySQL 2.0.6 and proxysql-admin (2019-08-21)
      • ProxySQL 2.0.5 and proxysql-admin (2019-11-23)
      • ProxySQL 2.0.4 and proxysql-admin (2019-05-28)
      • ProxySQL 2.0.3 and proxysql-admin (2019-05-07)
      • ProxySQL 1.4.16 and proxysql-admin (2020-02-11)
      • ProxySQL 1.4.12 and proxysql-admin (2018-11-13)
      • ProxySQL 1.4.8 and proxysql-admin (2018-05-22)
      • ProxySQL 1.4.7 and proxysql-admin (2018-04-16)
      • ProxySQL 1.4.6 and proxysql-admin (2018-03-12)
      • ProxySQL 1.4.5 and proxysql-admin (2018-02-15)
      • ProxySQL 1.4.4 and proxysql-admin (2018-01-18)
    • -–add-query-rule
      • --add-query-rule requires
      • --add-query-rule example
    • –-adduser
      • –-adduser example
    • –-auto-assign-weights
      • --auto-assign-weights example
    • --config-file
    • --debug
    • –-disable / -d
      • --disable example
    • --disable_updates
    • –-enable / -e
      • --enable example
      • Verify -enable example
    • –-force
    • --help
    • –-is-enabled
      • --is-enabled example
      • --is-enabled verification example
      • --is-enabled example with cluster disabled
    • –-remove-all-servers
      • --remove-all-server example
    • –-server
      • -server example
    • –-status
      • --status example
    • –-sync-multi-cluster-users
    • –-syncusers
      • --syncusers example
    • --trace
    • –-update-cluster
    • –-update-mysql-version
      • --update-mysql-version example
    • –-update-read-weight
      • --update-read-weight example
    • –-update-write-weight
      • --update-write-weight example
    • --use-stdin-for-credentials
    • --version
    • –-write-node
      • --write-node example

    Percona Scheduler Admin options¶

    The Percona Scheduler Admin script lists the available options in the Percona Scheduler Admin configuration file. The following options are described in more detail:

    Option Name
    --add-query-rule
    --adduser
    --auto-assign-weights
    --config-file
    --debug
    --disable/-d
    --enable/-e
    --force
    --help
    --is-enabled
    --server
    --status
    --sync-multi-cluster-users
    --syncusers
    --trace
    --update-cluster
    --update-mysql-version
    --update-read-weight
    --update-write-weight
    --use-stdin-for-credentials
    --version
    --write-node

    -–add-query-rule¶

    This option creates query rules for a synced MySQL user and applies only to the singlewrite mode.

    --add-query-rule requires¶

    Either the –syncusers or –sync-multi-cluster-users options.

    --add-query-rule example¶

    $ percona-scheduler-admin --config-file=config.toml --syncusers
    
    Expected output
    --add-query-rule
    
    Syncing user accounts from PXC to ProxySQL
    
    Note : 'admin' is in proxysql admin user list, this user cannot be added to ProxySQL
    -- (For more info, see https://github.com/sysown/proxysql/issues/709)
    Adding user to ProxySQL: test_query_rule
    Added query rule for user: test_query_rule
    Adding user to ProxySQL: test_query_rule
      Added query rule for user: test_query_rule
    
    Synced PXC users to the ProxySQL database!
    

    –-adduser¶

    This option adds the cluster application user account to the ProxySQL database.

    –-adduser example¶

    $ percona-scheduler-admin --config-file=config.toml --adduser
    
    Expected output
    Adding PXC application user to the ProxySQL database
    Enter the PXC application user name: cluster_one
    Enter the PXC application user password:
    
    
    The application user 'cluster_one' does not exist in PXC. Would you like to proceed [y/n] ? y
    
    Please create the user cluster_one in PXC to access the application through ProxySQL
    
    Added PXC application user to the ProxySQL database!
    

    –-auto-assign-weights¶

    ProxySQL uses weights for defining the failover procedure in singlewrite mode and handling load balancing loadbal mode.

    For the failover procedure, this option with the --update-cluster option assigns weights to the PXC nodes when the cluster is in singlewrite mode.

    As a best practice, ensure that the writer node election operation returns the same result each time. For example, assign the value of 1000 to node one, 999 to node two, and 998 to the node three. This method sets a clear priority for the election.

    For load balancing you want to reduce the reads on the writer node and, also, split the reads across all the reader nodes equally.

    For example, in a three-node cluster, assign a 900 to the writer node and 1000 and 1000 to the reader nodes.

    This option does these operations automatically without any manual intervention.

    Review do not combine certain options.

    The following example is a default configuration when the percona-scheduler-admin sets up proxysql.

    Expected output
    Cluster node info
    +---------------+-------+---------------+------+--------+--------+
    | hostgroup     | hg_id | hostname      | port | status | weight |
    +---------------+-------+---------------+------+--------+--------+
    | writer        | 100   | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | reader        | 101   | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | reader        | 101   | 192.168.56.33 | 3306 | ONLINE | 1000   |
    | reader        | 101   | 192.168.56.34 | 3306 | ONLINE | 1000   |
    | writer-config | 8100  | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | writer-config | 8100  | 192.168.56.33 | 3306 | ONLINE | 1000   |
    | writer-config | 8100  | 192.168.56.34 | 3306 | ONLINE | 1000   |
    | reader-config | 8101  | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | reader-config | 8101  | 192.168.56.33 | 3306 | ONLINE | 1000   |
    | reader-config | 8101  | 192.168.56.34 | 3306 | ONLINE | 1000   |
    +---------------+-------+---------------+------+--------+--------+
    
    Cluster membership updated in the ProxySQL database!
    

    --auto-assign-weights example¶

    $ percona-scheduler-admin --config-file=config.toml --update-cluster --auto-assign-weights
    
    Expected output
    No new nodes detected.
    Cluster node info
    +---------------+-------+---------------+------+--------+--------+
    | hostgroup     | hg_id | hostname      | port | status | weight |
    +---------------+-------+---------------+------+--------+--------+
    | writer        | 100   | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | reader        | 101   | 192.168.56.32 | 3306 | ONLINE | 900    |
    | reader        | 101   | 192.168.56.33 | 3306 | ONLINE | 1000   |
    | reader        | 101   | 192.168.56.34 | 3306 | ONLINE | 1000   |
    | writer-config | 8100  | 192.168.56.34 | 3306 | ONLINE | 998    |
    | writer-config | 8100  | 192.168.56.33 | 3306 | ONLINE | 999    |
    | writer-config | 8100  | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | reader-config | 8101  | 192.168.56.32 | 3306 | ONLINE | 900    |
    | reader-config | 8101  | 192.168.56.33 | 3306 | ONLINE | 1000   |
    | reader-config | 8101  | 192.168.56.34 | 3306 | ONLINE | 1000   |
    +---------------+-------+---------------+------+--------+--------+
    
    Cluster membership updated in the ProxySQL database!
    

    --config-file¶

    This option reads the login credentials from a configuration file. Command-line options override configuration file values. For more information, see Percona Scheduler Admin configuration.

    --debug¶

    This option enables additional debug logging.

    –-disable / -d¶

    This option removes Percona XtraDB Cluster nodes from ProxySQL and stops the ProxySQL monitoring daemon.

    --disable example¶

    $ percona-scheduler-admin --config-file=config.toml --disable
    
    Expected output
    Removing cluster application users from the ProxySQL database.
    Removing cluster nodes from the ProxySQL database.
    Removing query rules from the ProxySQL database if any.
    

    --disable_updates¶

    This option can be used with any command to disable updating the Percona Scheduler admin checksum for the mysql_query_rules, mysql_server and mysql_users tables. The option avoids updates in those tables for one node from being propagated to the cluster.

    Specifying this option sets the following values to false:

    • admin-checksum_mysql_query_rules
    • admin-checksum_mysql_servers
    • admin_checksum_mysql_users

    –-enable / -e¶

    This option creates the entries for the Galera hostgroups and adds the Percona XtraDB Cluster nodes into ProxySQL’s mysql_servers table.

    The option adds two users into the Percona XtraDB Cluster with the USAGE privilege. The users have the following tasks:

    • Monitor the cluster nodes through ProxySQL.

    • Connect to the PXC Cluster node through the ProxySQL console.

    You must have super user credentials from Percona XtraDB Cluster to set up the default users.

    --enable example¶

    $ percona-scheduler-admin --config-file=config.toml --enable
    
    Expected output
    Configuring using mode: singlewrite
    
    The ClusterApp User or Password was unspecified and will not be configured.
    
     This script will assist with configuring ProxySQL for use with
     Percona XtraDB Cluster (PXC) (currently only PXC in combination with 
     ProxySQL is supported)
    
    The ProxySQL read/write configuration mode is singlewrite
    
    Configuring the ProxySQL monitoring user.
    ProxySQL monitor username as per command line/config-file is monitor
    
    Monitoring user 'monitor'@'127.%' has been setup in the ProxySQL database.
    Adding the Percona XtraDB Cluster nodes to ProxySQL
    Using the scheduler binary located at /home/venki/work/proxysql/proxysql-admin-tool/pxc_scheduler_handler
    
    Waiting for scheduler script to process new nodes...
    Proxysql status (mysql_servers rows) for this configuration
    +---------------+-------+---------------+------+--------+--------+----------+---------+-----------+
    | hostgroup     | hg_id | hostname      | port | status | weight | max_conn | use_ssl | gtid_port |
    +---------------+-------+---------------+------+--------+--------+----------+---------+-----------+
    | writer        | 100   | 192.168.56.32 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    | reader        | 101   | 192.168.56.32 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    | reader        | 101   | 192.168.56.33 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    | reader        | 101   | 192.168.56.34 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    | writer-config | 8100  | 192.168.56.32 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    | writer-config | 8100  | 192.168.56.33 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    | writer-config | 8100  | 192.168.56.34 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    | reader-config | 8101  | 192.168.56.32 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    | reader-config | 8101  | 192.168.56.33 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    | reader-config | 8101  | 192.168.56.34 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    +---------------+-------+---------------+------+--------+--------+----------+---------+-----------+
    
    
    ProxySQL configuration completed!
    

    ProxySQL has been successfully configured to use with Percona XtraDB Cluster

    Verify -enable example¶

    You can verify the successful configuration with the following command:

    mysql> select * from runtime_mysql_servers;
    
    Expected output

    hostgroup_id hostname port gtid_port status weight compression max_connections max_replication_lag use_ssl max_latency_ms comment
    100 192.168.56.32 3306 0 ONLINE 1000 0 1000 0 0 0
    8101 192.168.56.33 3306 0 ONLINE 1000 0 1000 0 0 0
    8101 192.168.56.34 3306 0 ONLINE 1000 0 1000 0 0 0
    8101 192.168.56.32 3306 0 ONLINE 1000 0 1000 0 0 0
    8100 192.168.56.33 3306 0 ONLINE 1000 0 1000 0 0 0
    8100 192.168.56.34 3306 0 ONLINE 1000 0 1000 0 0 0
    8100 192.168.56.32 3306 0 ONLINE 1000 0 1000 0 0 0
    101 192.168.56.33 3306 0 ONLINE 1000 0 1000 0 0 0
    101 192.168.56.34 3306 0 ONLINE 1000 0 1000 0 0 0
    101 192.168.56.32 3306 0 ONLINE 1000 0 1000 0 0 0

    Verify the scheduler settings with the following command:

    mysql> select * from scheduler\G
    
    Expected output
    *************************** 1. row ***************************
             id: 6
         active: 1
    interval_ms: 5000
       filename: <path/to/pxc_scheduler>/pxc_scheduler_handler
           arg1: --configfile=config.toml
           arg2: --configpath=<path/to/config/dir>
           arg3: NULL
           arg4: NULL
           arg5: NULL
        comment: { hgW:100, hgR:101 }
    1 row in set (0.00 sec)
    

    –-force¶

    This option must be combined with either –enable / -e or –update-cluster. This option skips any mysql_servers table, mysql_users table, and mysql_galera_hostgroups table configuration checks. Certain checks issue warnings, instead of errors, which allows the option to continue processing.

    --help¶

    This option displays the help text.

    –-is-enabled¶

    This option checks if percona-scheduler-admin configured the hostgroups in ProxySQL.

    Returns a zero (0) if an entry corresponds to the writer hostgroup and is set to active in ProxySQL.

    Returns a one (1) if an entry does not correspond to the writer hostgroup.

    --is-enabled example¶

    $ percona-scheduler-admin --config-file=config.toml --is-enabled
    
    Expected output
    The current configuration has been enabled and is active
    

    --is-enabled verification example¶

    Verify if percona-scheduler-admin configured the hostgroups in ProxySQL.

    $ echo $?
    
    Expected output
    0
    

    --is-enabled example with cluster disabled¶

    Disabling the cluster configuration and then calling the option creates an error.

    Disabling the cluster:

    $ percona-scheduler-admin --config-file=config.toml --disable
    
    Expected output
    Removing cluster application users from the ProxySQL database.
    Removing cluster nodes from the ProxySQL database.
    Removing query rules from the ProxySQL database if any.
    ProxySQL configuration removed!
    

    Check if the cluster is enabled:

    $ percona-scheduler-admin --config-file=config.toml --is-enabled
    
    Expected output
    ERROR (line:2450) : The current configuration has not been enabled
    

    –-remove-all-servers¶

    When used with --update-cluster this option removes all servers belonging to the current cluster before running the --update-cluster option.

    --remove-all-server example¶

    $ percona-scheduler-admin --config-file=config.toml 
    --remove-all-servers --udpate-cluster
    

    –-server¶

    Selects a server by the IP address and port. This option can be combined with --syncusers or –sync-multi-cluster-users to sync a single non-cluster server. The option does not require that the server belong to a Percona XtraDB Cluster.

    -server example¶

    $ percona-scheduler-admin --config-file=config.toml --server=192.168.56.32:3306
    

    –-status¶

    This option displays information about all Galera hostgroups and their servers supported by this ProxySQL instance.

    --status example¶

    $ percona-scheduler-admin --config-file=config.toml --status
    
    Expected output
    mysql_servers rows for this configuration
    +---------------+-------+---------------+------+--------+--------+----------+---------+-----------+
    | hostgroup     | hg_id | hostname      | port | status | weight | max_conn | use_ssl | gtid_port |
    +---------------+-------+---------------+------+--------+--------+----------+---------+-----------+
    | writer        | 100   | 192.168.56.32 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    | reader        | 101   | 192.168.56.32 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    | reader        | 101   | 192.168.56.33 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    | reader        | 101   | 192.168.56.34 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    | writer-config | 8100  | 192.168.56.32 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    | writer-config | 8100  | 192.168.56.33 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    | writer-config | 8100  | 192.168.56.34 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    | reader-config | 8101  | 192.168.56.32 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    | reader-config | 8101  | 192.168.56.33 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    | reader-config | 8101  | 192.168.56.34 | 3306 | ONLINE | 1000   | 1000     | 0       | 0         |
    +---------------+-------+---------------+------+--------+--------+----------+---------+-----------+
    

    –-sync-multi-cluster-users¶

    Use this option to sync proxysql instances that manage multiple clusters.

    This option does the following:

    • Syncs the currently configured Percona XtraDB Cluster user accounts with the ProxySQL database except for user accounts without a password and admin user accounts.

    • Keeps ProxySQL users that are not present in the Percona XtraDB Cluster

    To sync a specific server combine this option with the --server option.

    –-syncusers¶

    This option does the following:

    • Syncs the currently configured Percona XtraDB Cluster user accounts with the ProxySQL database except for user accounts without a password and admin user accounts.

    • Deletes ProxySQL user accounts that are not also in Percona XtraDB Cluster from the ProxySQL database.

    To sync a specific server combine this option with the --server option.

    Review the user accounts in the ProxySQL database as root from ProxySQL database.

    --syncusers example¶

    proxysql admin#> SELECT DISTINCT username FROM mysql_users;
    
    Expected output
    +----------+
    | username |
    +----------+
    | monitor  |
    +----------+
    1 row in set (0.00 sec)
    

    On a Percona XtraDB Cluster node, verify if a user account is already added.

    mysql> SELECT user FROM mysql.user WHERE user LIKE 'test%';
    
    Expected output
    Empty set (0.00 sec)
    

    On the node, add a new user.

    mysql> CREATE USER 'test_user'@'localhost' IDENTIFIED WITH 'mysql_native_password' by 'passw0Rd';
    
    Expected output
    Query OK, 0 rows affected (0.04 sec)
    

    Run percona-scheduler-admin with the --syncusers option:

    $ percona-scheduler-admin --config-file=config.toml --syncusers
    
    Expected output
    Syncing user accounts from PXC(192.168.56.32:3306) to ProxySQL
    
    Adding user to ProxySQL: test_user
    
    Synced PXC users to the ProxySQL database!
    

    Verify, in the ProxySQL database, that the user account has been added.

    proxysql-admin> SELECT DISTINCT username FROM mysql_users;
    
    Expected output
    +-----------+
    | username  |
    +-----------+
    | monitor   |
    | test_user |
    +-----------+
    2 rows in set (0.00 sec)
    

    --trace¶

    This option enables shell-level tracing for this shell script.

    –-update-cluster¶

    This option checks the Percona XtraDB Cluster for new nodes. If nodes are found, they are added to ProxySQL. By default, offline nodes are not removed from the cluster.

    Combining --remove-all-servers with this option removes the server list for the configuration before the update runs.

    Combining --write-node with this option, and if the node is in the server list and is ONLINE, then this command makes that node the writer node by assigning a larger weight to that node. Only use this combination if the mode is singlewrite.

    $ percona-scheduler-admin --config-file=config.toml --write-node=127.0.0.1:4130 --update-cluster
    
    Expected output
    No new nodes detected.
    Waiting for ProxySQL to process the new nodes...
    
    Cluster node info
    +---------------+-------+---------------+------+--------+---------+
    | hostgroup     | hg_id | hostname      | port | status | weight  |
    +---------------+-------+---------------+------+--------+---------+
    | writer        | 100   | 192.168.56.34 | 3306 | ONLINE | 1000000 |
    | reader        | 101   | 192.168.56.32 | 3306 | ONLINE | 1000    |
    | reader        | 101   | 192.168.56.33 | 3306 | ONLINE | 1000    |
    | reader        | 101   | 192.168.56.34 | 3306 | ONLINE | 1000    |
    | writer-config | 8100  | 192.168.56.32 | 3306 | ONLINE | 1000    |
    | writer-config | 8100  | 192.168.56.33 | 3306 | ONLINE | 1000    |
    | writer-config | 8100  | 192.168.56.34 | 3306 | ONLINE | 1000000 |
    | reader-config | 8101  | 192.168.56.32 | 3306 | ONLINE | 1000    |
    | reader-config | 8101  | 192.168.56.33 | 3306 | ONLINE | 1000    |
    | reader-config | 8101  | 192.168.56.34 | 3306 | ONLINE | 1000    |
    +---------------+-------+---------------+------+--------+---------+
    
    Cluster membership updated in the ProxySQL database!
    

    –-update-mysql-version¶

    This option updates the mysql server version in the proxysql db based on the online writer node.

    --update-mysql-version example¶

    $ percona-scheduler-admin --config-file=config.toml --update-mysql-version
    
    Expected output
    ProxySQL MySQL version changed to 8.0.27
    

    –-update-read-weight¶

    Combining –update-cluster with this option assigns the specified read weight to a node.

    The syntax for the arguments are: and . The format can be either Internet Protocol version 4 (IPv4) or Internet Protocol version 6 (IPv6).

    --update-read-weight example¶

    $ percona-scheduler-admin --config-file=config.toml --update-cluster --update-read-weight="<IP_ADDRESS:PORT>, <New Weight>"
    

    The following table displays the percona-scheduler-admin default configuration for ProxySQL.

    Cluster node info
    +---------------+-------+---------------+------+--------+--------+
    | hostgroup     | hg_id | hostname      | port | status | weight |
    +---------------+-------+---------------+------+--------+--------+
    | writer        | 100   | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | reader        | 101   | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | reader        | 101   | 192.168.56.33 | 3306 | ONLINE | 1000   |
    | reader        | 101   | 192.168.56.34 | 3306 | ONLINE | 1000   |
    | writer-config | 8100  | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | writer-config | 8100  | 192.168.56.33 | 3306 | ONLINE | 1000   |
    | writer-config | 8100  | 192.168.56.34 | 3306 | ONLINE | 1000   |
    | reader-config | 8101  | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | reader-config | 8101  | 192.168.56.33 | 3306 | ONLINE | 1000   |
    | reader-config | 8101  | 192.168.56.34 | 3306 | ONLINE | 1000   |
    +---------------+-------+---------------+------+--------+--------+
    
    Cluster membership updated in the ProxySQL database!
    

    The following command assigns the weight value of 1111 to the 192.168.56.32:3306 node in the reader and reader-config hostgroups.

    $ percona-scheduler-admin --config-file=config.toml --update-cluster --update-read-weight="192.168.56.32:3306,1111"
    
    Expected output
    No new nodes detected.
    Waiting for scheduler script to process the nodes...
    
    Cluster node info
    +---------------+-------+---------------+------+--------+--------+
    | hostgroup     | hg_id | hostname      | port | status | weight |
    +---------------+-------+---------------+------+--------+--------+
    | writer        | 100   | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | reader        | 101   | 192.168.56.33 | 3306 | ONLINE | 1000   |
    | reader        | 101   | 192.168.56.34 | 3306 | ONLINE | 1000   |
    | reader        | 101   | 192.168.56.32 | 3306 | ONLINE | 1111   |
    | writer-config | 8100  | 192.168.56.34 | 3306 | ONLINE | 1000   |
    | writer-config | 8100  | 192.168.56.33 | 3306 | ONLINE | 1000   |
    | writer-config | 8100  | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | reader-config | 8101  | 192.168.56.33 | 3306 | ONLINE | 1000   |
    | reader-config | 8101  | 192.168.56.34 | 3306 | ONLINE | 1000   |
    | reader-config | 8101  | 192.168.56.32 | 3306 | ONLINE | 1111   |
    +---------------+-------+---------------+------+--------+--------+
    
    Cluster membership updated in the ProxySQL database!
    

    –-update-write-weight¶

    Combining this option with --update-cluster assigns the specified write weight to a node.

    The syntax for the arguments are: and . The format can be either Internet Protocol version 4 (IPv4) or Internet Protocol version 6 (IPv6).

    --update-write-weight example¶

    $ percona-scheduler-admin --config-file=config.toml --update-cluster --update-write-weight="<IP_ADDRESS:PORT>, <New Weight>"
    

    The following table displays the percona-scheduler-admin default configuration for ProxySQL.

    Cluster node info
    +---------------+-------+---------------+------+--------+--------+
    | hostgroup     | hg_id | hostname      | port | status | weight |
    +---------------+-------+---------------+------+--------+--------+
    | writer        | 100   | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | reader        | 101   | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | reader        | 101   | 192.168.56.33 | 3306 | ONLINE | 1000   |
    | reader        | 101   | 192.168.56.34 | 3306 | ONLINE | 1000   |
    | writer-config | 8100  | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | writer-config | 8100  | 192.168.56.33 | 3306 | ONLINE | 1000   |
    | writer-config | 8100  | 192.168.56.34 | 3306 | ONLINE | 1000   |
    | reader-config | 8101  | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | reader-config | 8101  | 192.168.56.33 | 3306 | ONLINE | 1000   |
    | reader-config | 8101  | 192.168.56.34 | 3306 | ONLINE | 1000   |
    +---------------+-------+---------------+------+--------+--------+
    
    Cluster membership updated in the ProxySQL database!
    

    The following command assigns the weight value of 1111 to the 192.168.56.33:3306 node in the writer and writer-config hostgroups.

    $ percona-scheduler-admin --config-file=config.toml --update-cluster --update-write-weight="192.168.56.33:3306,1111"
    
    Expected output
    No new nodes detected.
    Waiting for scheduler script to process the nodes...
    
    Cluster node info
    +---------------+-------+---------------+------+--------+--------+
    | hostgroup     | hg_id | hostname      | port | status | weight |
    +---------------+-------+---------------+------+--------+--------+
    | writer        | 100   | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | reader        | 101   | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | reader        | 101   | 192.168.56.33 | 3306 | ONLINE | 1000   |
    | reader        | 101   | 192.168.56.34 | 3306 | ONLINE | 1000   |
    | writer-config | 8100  | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | writer-config | 8100  | 192.168.56.34 | 3306 | ONLINE | 1000   |
    | writer-config | 8100  | 192.168.56.33 | 3306 | ONLINE | 1111   |
    | reader-config | 8101  | 192.168.56.32 | 3306 | ONLINE | 1000   |
    | reader-config | 8101  | 192.168.56.33 | 3306 | ONLINE | 1000   |
    | reader-config | 8101  | 192.168.56.34 | 3306 | ONLINE | 1000   |
    +---------------+-------+---------------+------+--------+--------+
    
    Cluster membership updated in the ProxySQL database!
    

    --use-stdin-for-credentials¶

    This option uses stdin to send credentials to the MySQL client instead of process substitution. The default setting disables the option and uses process substitution.

    --version¶

    This option prints the version information.

    –-write-node¶

    This option chooses which Percona XtraDB Cluster node is the writer node when the mode is singlewrite. You can combine this option with –enable / -e and –update-cluster.

    The option requires only a single IP address and port combination.

    Assigning a node with --write-node gives the writer node a weight of 1000000. The default weight is 1000.

    --write-node example¶

    The argument syntax is a single IP address and port combination.

    $ percona-scheduler-admin --config-file=config.toml --write-node=192.168.56.32:3306
    

    Contact us

    For free technical help, visit the Percona Community Forum.

    To report bugs or submit feature requests, open a JIRA ticket.

    For paid support and managed or consulting services , contact Percona Sales.


    Last update: 2023-02-14
    Back to top
    Percona LLC and/or its affiliates, © 2023
    Made with Material for MkDocs

    Cookie consent

    We use cookies to recognize your repeated visits and preferences, as well as to measure the effectiveness of our documentation and whether users find what they're searching for. With your consent, you're helping us to make our documentation better.