Showing entries 1 to 10 of 140
10 Older Entries »
Displaying posts with tag: MySQL 8 (reset)
MySQL Inside: Using the PS error_log table for a quick peak!

Just thought I’d share a script I use daily and helps me redirect my attention if needed.

This is but a mere pointer, guideline and starting point in any task. I just thought I’d share and hope someone else’s day becomes slightly easier thanks to some brief investigation and command tweaking.

Now the really handy thing here is that I only hard code the router01 node name, as I’m using that as a potential endpoint (thinking cloud, XaaS, etc…) where it could also be a VIP, LBR or similar. It’s the entry point so I can query the P_S table error_log so I can get different views and act accordingly.

For example:

  • First, give me the InnoDB Cluster ordered server list so I can take a step back from my usual pains and worries, and see the architecture view. And make me type “Y” or similar to move on. Here if there were any server missing, I’d see the summary right away so I don’t really need to …
[Read more]
MySQL Router quick’n’simple troubleshooting

I thought I’d share some quick intro steps into how we can monitor the MySQL Router.

This can be useful if we’re observing intermittent outages, network packet drops or you’re just not sure if everythings fine in your MySQL InnoDB Cluster.

My scenario: The drupal servers are connecting and sometimes the users are getting connection errors. I don’0t see anything at MySQL server level of any instance nor cluster problem. Let’s review the Routers.

On all MySQL Router servers, double check the config file for the log location and also the log level. At /etc/mysqlrouter/mysqlrouter.conf (default rpm install location):

[DEFAULT]
name=myrouter
user=mysqlrouter
..
..
logging_folder=/routerlog/log
..
[logger]
level=DEBUG
#level=INFO

I’ve changed my logger level to DEBUG which will give you a lot more info about connections and counters so you can see what’s happening …

[Read more]
Making my MySQL InnoDB Cluster safe from naughtiness

TL;DR: Make sure to run “SET persist_only disabled_storage_engines=’MyISAM’, persist sql_generate_invisible_primary_key=ON;” on all instances and restart each one in your MySQL InnoDB Cluster.

Ok, what does “safe from naughtiness” mean?:
– Anyone creating tables that aren’t InnoDB, as this doesn’t make sense, after all, it is an “InnoDB” cluster.
– Making sure all tables have a Primary Key (invisible or not).
– Making sure that my (invisible) primary keys are visible to the cluster as it will rightfully complain if they aren’t!

This basically means that once you’ve got it all up and running you won’t run into those horrible situations whereby someone, somewhere, creates a MyISAM table that didn’t have a Primary Key and thus leave you with a broken cluster.

Eg.

MySQL rtnode-01:3306 ssl JS > vlc.status()
{
 "clusterName": "VLC",
 "clusterRole": "PRIMARY", …
[Read more]
Observing InnoDB Cluster: A different approach for specific info extraction

Now this is far from being any observability manual for your InnoDB Cluster and let alone go into everything MySQL Shell API Admin, or the collectDiagnostics utility. You can also use the default javascript commands that we all know and love via dba.getCluster() and so on, but here’s a different take.

I just want to share something I’ve been playing with to pull out some key info from mycluster. Hope it helps someone else out there.

General setup:

select cluster_id, cluster_name, description, cluster_type, primary_mode, clusterset_id
from mysql_innodb_cluster_metadata.clusters;

Members of our cluster:

select * from …
[Read more]
Learning SQL Exercise

I’ve been using Alan Beaulieu’s Learning SQL to teach my SQL Development class with MySQL 8. It’s a great book overall but Chapter 12 lacks a complete exercise. Here’s all that the author provides to the reader. This is inadequate for most readers to work with to solve the concept of a transaction.

Exercise 12-1

Generate a unit of work to transfer $50 from account 123 to account 789. You will need to insert two rows into the transaction table and update two rows in the account table. Use the following table definitions/data:

                      Account:
account_id     avail_balance    last_activity_date
-----------    --------------   ------------------
       123               450    2019-07-10 20:53:27
       789               125    2019-06-22 15:18:35

                      Transaction:
txn_id    txn_date      account_id    txn_type_cd    amount
------    ----------    -------+--    -----------    ------
  1001 …
[Read more]
Parametric Queries

In 2021, I wrote a MySQL example for my class on the usefulness of Common Table Expressions (CTEs). When discussing the original post, I would comment on how you could extend the last example to build a parametric reporting table.

Somebody finally asked for a concrete example. So, this explains how to build a sample MySQL parametric query by leveraging a filter cross join and tests the parameter use with a Python script.

You can build this in any database you prefer but I used a studentdb database with the sakila sample database installed. I’ve granted privileges to both databases to the student user. The following SQL is required for the example:

-- Conditionally drop the levels table.
DROP TABLE IF EXISTS levels;
 
-- Create the levels list.
CREATE TABLE levels
( level_id       int unsigned primary key auto_increment
, …
[Read more]
Installing Galera Cluster 4 with MySQL on Ubuntu 22.04

We have in the past covered Installing Galera Cluster 4 with MySQL 8 on Ubuntu 18.04 and also Installing Galera 4 with MySQL 8 on Ubuntu 20.04, and it would seem appropriate to also cover Ubuntu 22.04 LTS (Jammy Jellyfish). We do have excellent documentation and we also have the ability for you to automate all of this via the GUI tool, Galera Manager.

Prerequisites

  • All 3 nodes have to have Ubuntu 22.04 LTS installed. The current version at the time of this writing is Ubuntu 22.04.3 LTS.
  • Firewall (if setup) needs to …
[Read more]
Ruby+MySQL on Ubuntu

This post goes through installing and configuring Ruby and Ruby on Rails for MySQL. The first step requires updating the Ubuntu OS:

sudo apt-get update

Interestingly, I found that the man-db service had inadvertently stopped. It raised the following error:

E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. 

You run this command to find the problem with the dpkg utility:

sudo dpkg --configure -a

It returned:

Setting up man-db (2.10.2-1) ...
Updating database of manual pages ...
man-db.service is a disabled or a static unit not running, not starting it.

The following command started the man-db service:

sudo systemctl start man-db.service

Next, you install the prerequisite packages with this command:

sudo apt-get install -y git-core zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev …
[Read more]
Deploying a Percona XtraDB Cluster (PXC) with Galera Manager automatically on Amazon Web Services

Galera Manager supports three modes for supporting your Percona XtraDB Clusters: deploying to either Amazon Web Services, deploying to your own on premises hosts, and also just monitoring your clusters. In this blog post, we will go thru houw you should deploying a 3-node Percona XtraDB Cluster via Galera Manager on Amazon Web Services Elastic Compute Cloud (AWS EC2). You will realise that this process happens with just a simple API key and instance selection, so effectively you can have a Galera Manager setup in under fifteen minutes!

On AWS EC2, it is worth noting that Galera Manager itself can be deployed on the free tier for testing purposes. However, in production environments, you might expect up to 100GB of logs on a monthly basis, so you should plan accordingly.

Obtain Galera Manager by …

[Read more]
Galera Manager January 2024 release

The momentum around Galera Manager development has been amazing. You report bugs or feature requests, and we fix them!

The major reason to release this was to ensure that Galera Manager would accept the new signing keys of Galera Cluster (key ID: 8DA84635).

One will now also note that gm-installer reports a new version: gm-installer version 1.12.0 (linux/amd64). And when you install it, Galera Manager itself is now at version 1.8.3. One of the major fixes is that Ubuntu 22.04 support for self-provided hosts is now exposed in the UI. This fixes …

[Read more]
Showing entries 1 to 10 of 140
10 Older Entries »