Overview
The Skinny
Part of the power of Tungsten Clustering for MySQL / MariaDB is its intelligent MySQL Proxy, known as the Tungsten Connector. Tungsten Connector has three main modes, and depending on the type of operations you are performing (such as if you need read-write splitting), we help you choose which mode is best.
The Question
Recently, a customer asked us:
How can I tell which Tungsten Connector mode I am using: Bridge, Proxy/Direct or Proxy/SmartScale?
The Answer
Connect and Observe
You may login through the Connector to tell the difference between Bridge mode and Proxy mode (Basic, Direct or SmartScale):
In Proxy mode, you will see the -tungsten
tag appended to the Server version string:
shell> tpm connector
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 34
Server version: 5.7.26-log-tungsten MySQL Community Server (GPL)
Once logged into the Connector in Proxy mode, you have the full set of interactive tungsten commands available:
mysql> tungsten help;
+---------------------------------------------------------------------------------------------------------------------------------+
| Message |
+---------------------------------------------------------------------------------------------------------------------------------+
| tungsten connection status: display information about the connection used for the last request ran |
| tungsten connection count: gives the count of current connections to each one of the cluster datasources |
| tungsten cluster status: prints detailed information about the cluster view this connector has |
| tungsten show [full] processlist: list all running queries handled by this connector instance |
| tungsten show variables [like '']: list connector configuration options in use. The may contain '%' wildcards |
| tungsten flush privileges: reload user.map and refresh user credentials
For Bridge mode, you will not see that:
In Bridge mode, the tungsten commands do not work:
copy
mysql> tungsten help;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to us
In Bridge mode, the tungsten commands do not work:
mysql> tungsten help;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'tungsten help' at line 1
The Proxy Modes: Basic, Direct and SmartScale
Direct and SmartScale are a sub-set of Proxy mode and are enabled separately. Basic Proxy mode routes all traffic to the Primary. Direct Proxy mode will route read requests to a Replica when possible, without regard for data staleness. SmartScale Proxy route read requests to a Replica when possible, and will ensure that writes in the same session have reached the replica, or will send the read to the Primary instead to ensure the most up-to-date data is returned.
To determine which of Basic, Direct or SmartScale Proxy mode is enabled, run mysql> tungsten connection status;
and look for the QOS= value.
echo 'tungsten connection status;' | tpm connector
mysql: [Warning] Using a password on the command line interface can be insecure.
Message
db9-demo.continuent.com@north(master:ONLINE)
STATUS [OK] [Fri Jan 20 12:34:18 UTC 2023], QOS=RW_STRICT SSL.IN=true SSL.OUT=tr
Here are the possible values for QOS:
- RW_STRICT - Basic Proxy mode - routes all traffic to the Primary
- RO_RELAXED - Direct Proxy mode - routes writes to the Primary, and reads to a Replica if possible, data may be stale
- RW_SESSION - SmartScale Proxy mode - routes writes to the Primary, and reads to a Replica if possible, data returned is not stale
Bonus: New Connector Command
As of Tungsten Clustering versions 6.1.19 and 7.0.1, there is a new `connector mode` OS command to help determine the operating mode:
shell> connector mode
Connector session established, encryption=true, authentication=true
Mode: proxy
shell> connector mode
Mode: bridge
Bonus: New tpm ask
Commands
As of Tungsten Clustering version 7.0.2 and 7.0.3 respectively, the tpm ask isBridgeMode
and tpm ask isSmartScale
commands will provide boolean responses, with 1 = yes/true, 0 = no/false:
shell> tpm ask isBridgeMode
0
shell> tpm ask isbridge
0
shell> tpm ask isSmartScale
1
shell> tpm ask issmart
1
If isBridgeMode=0
, then the Connector is operating in Proxy mode. If isSmartScale=1
, then the Connector is operating in Proxy/SmartScale mode. These keys are also included in the tpm ask summary
command.
Please Read the Docs!
For more information about the Tungsten Connector:
Summary
The Wrap-Up
In this blog post we discussed how one can tell which Tungsten Connector mode is in use: Bridge, Proxy/Direct or Proxy/SmartScale.
Tungsten Clustering is the most flexible, performant global database layer available today - use it underlying your SaaS offering as a strong base upon which to grow your worldwide business!
For more information, please visit the products section of our website.
Want to learn more or run a POC? Contact us
Comments
Add new comment