Showing posts with label high availability. Show all posts
Showing posts with label high availability. Show all posts

Wednesday, August 29, 2012

MySQL Cluster: Troubleshooting Error 157 / 4009 Cluster Failure


Suddenly your application starts throwing "error 157" and performance degrades or is non-existing. It is easy to panic then and try all sorts of actions to get past the problem. We have seen several users doing:
  • rolling restart
  • stop cluster / start cluster
because they also see this in the error logs:
120828 13:15:11 [Warning] NDB: Could not acquire global schema lock (4009)Cluster Failure

That is not a really a nice error message. To begin with, it is a WARNING when something is obviously wrong. IMHO, it should be CRITICAL. Secondly, the message ‘Cluster Failure’ is misleading.  The cluster may not really have failed, so there is no point trying to restart it before we know more.

So what does error 157 mean and what can we do about it?

By using perror we can get a hint what it means:

$ perror 157
MySQL error code 157: Could not connect to storage engine

What this means is simply as it says, one SQL node is not connected to the NDB storage engine.  It can be that you have messed up the ndb-connectstring in the my.cnf of that SQL node.
It is often the case that someone has been doing ALTER TABLEs, and for some reason, the schema files have been corrupted or is of the wrong version on one or more SQL nodes. It would make sense to check the SQL nodes for potential problems there.

If you have multiple SQL nodes, you probably have the SQL nodes behind a load balancer. Which MySQL is really causing this problem? One of them, or all of them?
Let’s take a look from one of the SQL nodes:

mysql> show global status like 'ndb_number_of%';
+--------------------------------+-------+
| Variable_name                  | Value |
+--------------------------------+-------+
| Ndb_number_of_data_nodes       | 2     |
| Ndb_number_of_ready_data_nodes | 2     |
+--------------------------------+-------+
2 rows in set (0.00 sec)

This is perfect, we have two Data nodes , and two of them are ready. This means that this particular SQL node is connected to the NDB storage engine. Now, let's look at another one:

mysql> show global status like 'ndb_number_of%';
+--------------------------------+-------+
| Variable_name                  | Value |
+--------------------------------+-------+
| Ndb_number_of_data_nodes       | 0     |
| Ndb_number_of_ready_data_nodes | 0     |
+--------------------------------+-------+
2 rows in set (0.00 sec)

This does not look good, this SQL node is not connected to the Data nodes. Now iterate over the remaining 62 MySQL servers or how many you have to find the bad apples. However, I prefer myself to spot the faulty ones like this:

Screenshot from Severalnines ClusterControl

Now, we can stop the SQL nodes that are marked as "red":
1.     Stop the MySQL server:
service mysql stop
2.    Go into the database(s) you have in the datadir of the MySQL server:
cd /var/lib/mysql/mydatabase/
3.    Remove .frm files and .ndb files:
for x in `ls *.ndb`; do rm `basename $x .ndb`.frm; rm `basename $x`;  done
4.    Start the MySQL server
service mysql start
Is step 2) safe to do? 
Yes, the .frm files of the NDB tables are stored in the data dictionary inside the data nodes. By removing these files, and restarting the MySQL server, the MySQL server will fetch the missing .frm files from the data nodes, and you will end up with fresh ones.

Hope this helps someone,
Johan





Tuesday, October 04, 2011

Severalnines releases ClusterControl™ for MySQL Replication v. 1.1.9

Stockholm - October 4th 2011

Severalnines, provider of automation and management software for easily usable, highly available and auto-scalable cloud database platforms, today announces the latest release of its flagship product ClusterControl™ for MySQL Replication.

Introducing ClusterControl™ for MySQL Replication v.1.1.9

ClusterControl™ for MySQL Replication enables customers to Deploy, Manage, Monitor and Scale a clustered database platform based on the standard MySQL Replication.

Developers and DBAs now have access to all of the features of Severalnines' flagship product ClusterControl™ specifically adapted to MySQL Replication.

Designed to address issues and needs of MySQL users relying on MySQL Replication, ClusterControl™ for MySQL Replication offers a complete set of tools to assist developers and administrators of all skill levels to deploy, manage, monitor and scale their replicated MySQL databases.

Features and benefits

Config wizard
- Generates individual configurations based on application needs
- Creates deployment packages
- Deploys a Replication cluster in minutes
Config manager
- Sanity checks changes to configuration parameters
- Rolls out configuration changes to all servers and automates rolling restarts
Upgrade advisor
- Keeps users up-to-date by performing upgrades
- Applies minor patches or major upgrades
- Allows roll-back to previous versions
Availability manager
- Clusterware that detects process failures
- Automates MySQL master fail-over
- Performs recovery of failed database processes
Backup manager
- Schedule backups or allow users to start an immediate backup
- Monitor and browse existing backups
- Define retention policies
- No proprietary data formats
Monitor
- Granular end-to-end transaction and database operation monitoring
Query analyzer
- Analysis on cluster-wide running queries
- Global MySQL processlist
- Deep real-time and historical visibility into individual nodes
Alarms and notifications
Scale
- Add new Slaves (or remove) to the cluster without any downtime
- Easily specify hostnames of Slaves to be added

View all of the features here.

Automated fail-over with ClusterControl™

Standard MySQL Replication is easy to set up, and is probably the most widely used mechanism to provide high availability for MySQL. Unfortunately, it is somewhat fragile. There is no support for fail-over. Slaves can easily end up with different data from the master. Diverging datasets can cause replication to stop. Crashing masters can corrupt binary logs, which means replication is not possible any more.

ClusterControl™ addresses the problems associated with master fail-over and resynchronizations, and avoids data loss by taking advantage of semi-sync replication in MySQL 5.5.

ClusterControl™ automates fail-over and reconfiguration of the replication setup to keep the Replication cluster stable and running. This online tutorial explains the MySQL Replication architecture, and how different types of failures are handled.

Users can try it now by generating their deployment package.

Reources related to this release


Configurator for MySQL Replication
Tutorial: ClusterControl for MySQL Replication
Videos: Online Demos on MySQL Replication
Book a demo

Please do reach out to us with your feedback on Facebook, LinkedIn, XING or directly via these contact details for fruitful and interactive discussions on this latest release. For 'instant' communication, feel free to follow us on Twitter!

About Severalnines

Severalnines provides automation and management software for easily usable, highly available and auto-scalable cloud database platforms. ClusterControl™, the company’s flagship product, used by developers and administrators of all skill levels, addresses the full deploy-manage-monitor-scale cycle. Severalnines has enabled over 7,000 deployments to date via its popular online configurator for clustered MySQL databases.

To see who is using Severalnines today, please visit our references page.

Tuesday, August 16, 2011

MySQL Clusters in the Cloud with Severalnines on OpenShift

A blog post on how to deploy a sample JBoss application on OpenShift Flex - using a highly available, scalable backend that leverages MySQL Cluster

The Severalnines team has been busy during the summer months and as result, we have included OpenShift Flex support to our Severalnines Configurator (amongst other things). OpenShift, a Platform-as-a-Service operated by Red Hat, allows developers to develop and manage applications in the cloud. It is now possible to configure a clustered MySQL database for cloud services running on OpenShift. This brings high-availability and scalability at both the application and database layers.

As a guest contributor on Red Hat's OpenShift Community Blog, we provide a comprehensive, step-by-step walkthrough for this type of deployment. For those of you who would also like to view the process “in action”, feel free to view the video that complements this blog entry.

Read the full blog here!