MySQL Master-Master or Master-Slave Replication Error Fix

Scenario Master – Master replication

MasterA is a client facing server
MasterB is a warm standby server (read only)

MasterB restarted abruptly and when instances were braught back up MasterA (it’s slave) was showing the following error:

MasterA has the following error in show slave status:

Last_IO_Errno: 1236
Last_IO_Error: Got fatal error 1236 from master when reading data from binary log: ‘Could not find first log file name in binary log index file’

Solution:

Slave: stop slave;

Master: flush logs

Master: show master status; — take note of the master log file and master log position

Slave: CHANGE MASTER TO MASTER_LOG_FILE=’log-bin.00000X′, MASTER_LOG_POS=106;

Slave: start slave;

Read more: http://mysqlpreacher.com/wordpress/2010/12/could-not-find-first-log-file-name-in-binary-log-index-file/#ixzz2ILRnl4XI

Src: http://mysqlpreacher.com/wordpress/2010/12/could-not-find-first-log-file-name-in-binary-log-index-file/

Share

Enabling munin node plug-ins on Debian

Munin uses plug-ins to determine what data is gathered and reported. It includes several plug-ins for the types of data most people would be interested in, but not all of those plug-ins are enabled on a fresh installation.
What are plug-ins?

When a munin node gathers data about a slice so it can be graphed, the node reads instructions from files called "plug-ins" to determine what information to collect. Several plug-ins are installed with munin but not all of them are used by default. Fortunately a munin node installation includes a command that lets you see what plug-ins are active and can help you decide which others to enable.

The munin-node-configure command

The "munin-node-configure" command can list the status of installed munin plug-ins, suggest which to enable, and provide a shell script that will automate enabling the appropriate plug-ins. Using this command isn't the only way to perform these tasks, but it's convenient and easy to use. Easy is good.

Read more

Share

Monitor MySQL database restore progress with pv

The pv command is one that I really enjoy using but it's also one that I often forget about. You can't get a much more concise definition of what pv does than this one:

pv allows a user to see the progress of data through a pipeline, by giving information such as time elapsed, percentage completed (with progress bar), current throughput rate, total data transferred, and ETA.

The usage certainly isn't complicated:

To use it, insert it in a pipeline between two processes, with the appropriate options. Its standard input will be passed through to its standard output and progress will be shown on standard error.

A great application of pv is when you're restoring large amounts of data into MySQL, especially if you're restoring data under duress due to an accidentally-dropped table or database. (Who hasn't been there before?) The standard way of restoring data is something we're all familiar with:

# mysql my_database < database_backup.sql

The downside of this method is that you have no idea how quickly your restore is working or when it might be done. You could always open another terminal to monitor the tables and databases as they're created, but that can be hard to follow.

Toss in pv and that problem is solved:

# pv database_backup.sql | mysql my_database
96.8MB 0:00:17 [5.51MB/s] [==> ] 11% ETA 0:02:10

When it comes to MySQL, your restore rate is going to be different based on some different factors, so the ETA might not be entirely accurate.

Src: http://rackerhacker.com/2010/11/24/monitor-mysql-restore-progress-with-pv/

Share

Installing XHProf on Debian

xhprof provides profiling information, down to the function call. This includes execution time, CPU and memory usage for each operation. The module allows you to find and optimise bottlenecks in your application. The library includes a GUI output, you just use the classes provided to create the reports.

I installed using PECL on a Debian Squeeze development server, and the first things you need are php5-dev and make;

Read more

Share

MySQLTuner adjust your MySQL database

MySQLTuner is a script written in Perl that will assist you with your MySQL configuration and make recommendations for increased performance and stability. Within seconds, it will display statistics about your MySQL installation and the areas where it can be improved.

It's key to remember that MySQLTuner is a script which can assist you with your server, but it is not the solution to a badly performing MySQL server. The best performance gains come from a thorough review of the queries sent to the server, and an evaluation of the MySQL server itself. A qualified developer in your application's programming or scripting language should be able to work with a MySQL database administrator to find improvements for your server. Once the server and application are optimized well, you may need to consider hardware upgrades to the physical server itself.
This is a really useful tool for helping to optimize MySQL performance.Understanding the various my.cnf variables and how they affect performance can seem really complicated but this tool takes some of the pain away and makes it easier to understand the effects of each variable.It is especially useful to be able to see the global memory usage, memory usage per thread and the maximum possible memory usage — that is really valuable information that is otherwise complex to calculate.

Run MySQLTuner in Debian

Copy and past the below code and save it as mysqltuner.pl using nano 😉

Read more

Share

Monitoring multiple server using Munin on Debian/Ubuntu Distribution

 

This tutorial was written for Debian Etch, but the configuration should apply to other distributions with little changes as well.

I want to say first that this is not the only way of setting up such a system. There are many ways of achieving this goal but this is the way I take. I do not issue any guarantee that this will work for you!

 

1 Preliminary Note

Our munin server's hostname is server1.example.com (IP address: 192.168.0.100), and we have a web site www.example.com on it with the document root /var/www/www.example.com/web on it.

I'm using one munin client here, server2.example.com (IP address: 192.168.0.101). Of course, you can add as many client systems as you like.

 

2 Install And Configure munin On The Server

munin server (server1.example.com):

To install the munin client and server on Debian Etch, we do this:

apt-get install munin munin-node

Next, we must edit the munin configuration file /etc/munin/munin.conf. We want munin to put its output into the directory

Read more

Share

Openfiler Install NRPE

INSTALL Compiler Dependency

conary update gcc (a C-Compilter to compile the NRPE)
conary update glibc:devel
conary update openssl:devel
conary update xinetd
Add User
——–
useradd nagios
passwd nagios
Share

apt-get drush install on Debian

These are the installation instructions that are recommended on Debian. Aegir dependencies (Apache, MySQL, PHP…) are also automatically installed. If you are managing the installation from a remote Windows computer, well-known open source tools for this task are for example PuTTY (a SSH client for command line), and WinSCP (a SFTP client with easy text file editing).

If you wish to install Debian packages over an existing manual install, it's possible. See the Debian upgrade procedures.

Debian packages are uploaded to http://debian.aegirproject.org/ shortly after a release. We eventually want to upload those packages to the official archives, but this will take some adaptation and time to sponsor the packages in.

 

1. Adding the project repositories

Use this command to add the Aegir package "Software Source" repository to your system:

 

echo "deb http://debian.aegirproject.org stable main" | sudo tee -a /etc/apt/sources.list.d/aegir-stable.list

 

To install other versions, see the developer instructions for the debian package.

2. Adding the archive key to your keyring

This repository self-signs packages uploaded to it (and packages uploaded are verified against a whitelist of trusted uploaders) using OpenPGP (GnuPG, to be more precise).

Use these commands to download and add the repository's PGP key, then update the package list on your system:

 

wget -q http://debian.aegirproject.org/key.asc -O- | sudo apt-key add -

Read more

Share

Mercury on Ubuntu 10.04 (Lucid)

This high performance Drupal system is based on the work of Project Mercury. Project Mercury aims to increase the performance and ability of Drupal powered websites to respond to increased load. This document leverages the same collection of popular open source tools including the Varnish Accelerating Proxy, the APC bytecode cache for PHP, Memcached for accelerating database operations, and the Solr search engine. These instructions modify the Drupal community instructions for Project Mercury for use with the Linode Platform and the 10.04 release of the Ubuntu Distribution.

You may also choose to deploy your high performance Drupal stack with Linode's StackScript. Simply click on the "Deploy using StackScripts" link on the "Deploy a Linux Distribution" page. When the new Linode boots your system will be running Pantheon Project Mercury. Note that both the StackScript edition and the version of Mercury described in this document require substantial system resources; ensure your system has at least 512 megabytes of RAM. Additionally, at the time of initial publication, be aware that many Drupal Modules may not be fully compatible with PHP version 5.3 that ships with Lucid. Prior to beginning this guide for installing the high performance stack based on Project Mercury, we assume that you have completed our getting started guide. If you're new to Linux systems administration we recommend engaging the guides in our using Linux guide series, particularly the administration basics guide.

Set the Hostname

Before you begin installing and configuring the components described in this guide, please make sure you've followed our instructions for setting your hostname. Issue the following commands to make sure it is set properly:

hostname
hostname -f

The first command should show your short hostname, and the second should show your fully qualified domain name (FQDN).

Read more

Share