- MariaDB Cookbook
- Daniel Bartholomew
- 474字
- 2021-07-16 12:19:26
Using SHOW STATUS to check if a feature is being used
The SHOW STATUS
command shows information about the server. This includes things such as the number of bytes of data received and sent by the server, the number of connections served, the number of rows read, and so on. The command can also be used to check whether a feature has been enabled or is being used.
How to do it...
- Launch the
mysql
command-line client and connect to our MariaDB database server. - Uninstall the Cassandra storage engine with:
UNINSTALL SONAME 'ha_cassandra.so';
- MariaDB will either respond with a
Query OK
message (if the Cassandra storage engine was installed and has now been uninstalled) or it will give theSONAME ha_cassandra.so does not exist
error (if the Cassandra storage engine was not installed). Either of the messages is ok. - Issue the following
SHOW STATUS
command to see if the Cassandra storage engine is installed. The result will be anEmpty set
, which means that it is not installed:SHOW STATUS LIKE 'Cassandra%';
- Install the Cassandra storage engine with the following command, and the result will be
Query OK
:INSTALL SONAME 'ha_cassandra.so';
- Issue the
SHOW STATUS
command from step 3 again. This time, an output similar to the following screenshot will be displayed:
How it works...
The SHOW STATUS
output gives us two different sets of information in this recipe. Firstly, the actual presence of the Cassandra%
variables tells us that the Cassandra storage engine is installed. Secondly, it shows us some useful information about our usage of the Cassandra storage engine since it was installed (or the server was last restarted) and if there have been any exceptions. Since we just installed the plugin, all the values will likely be zeroes unless we have an active application that used the plugin between the time when we ran the INSTALL
and SHOW STATUS
commands.
There's more...
In the recipe, we modified the full SHOW STATUS
output to restrict it just to the information on the Cassandra storage engine by adding LIKE 'Cassandra%'
to the end of the command. We could also just add the following line of command to get the complete output:
SHOW STATUS;
There is a lot of output, so it is often better to use LIKE
and some text with the wildcard character (%
) to shorten the output to just what we want to know.
Many plugins and storage engines in MariaDB provide the STATUS
variables that are useful when we want to know how the engine or plugin is operating. However, not all do; the preferred method to check whether a given plugin or storage engine is installed is to use the SHOW PLUGINS;
command.
See also
- The full documentation of the
SHOW STATUS
command is available at https://mariadb.com/kb/en/show-status/ - The full documentation of the
SHOW PLUGINS
command is available at https://mariadb.com/kb/en/show-plugins/
- 程序員面試白皮書
- Web交互界面設計與制作(微課版)
- OpenCV for Secret Agents
- C++ 從入門到項目實踐(超值版)
- Mastering JavaScript Design Patterns(Second Edition)
- Apache Spark 2.x for Java Developers
- Mastering Business Intelligence with MicroStrategy
- Learning jQuery(Fourth Edition)
- Domain-Driven Design in PHP
- SQL Server 2008 R2數據庫技術及應用(第3版)
- 計算機應用基礎項目化教程
- Anaconda數據科學實戰
- Mastering ArcGIS Server Development with JavaScript
- 現代JavaScript編程:經典范例與實踐技巧
- Real-time Analytics with Storm and Cassandra