Nombre total de pages vues

mercredi 27 juillet 2011

MySQL-MHA: HA replication tool

A new MySQL project about high availability is proposed by Yoshinori Matsunobu. This project permits to automating master failover and slave promotion within short downtime.

This is the first time that we can see a serious MySQL failover project into replication environment. I haven't tested it yet but lot of people speak about MySQL-MHA on the web actually. Yoshinori Matsunobu is associate with SkySQL for that they provide the commercial support.

MySQL-MHA brings a lot of advantages such as:

  • Automated master monitoring and failover
  • Interactive (manual) Master Failover
  • Non-interactive master failover
  • Online switching master to a different host

Every informations and descriptions can be found on the google code web page of MySQL-MHA.
You can know more about Yoshinori Matsunobu on his blog.

Project is released few days ago and I think that it will no need to wait for a long time to seeing this marvelous tools into your MySQL production replication environment.


lundi 25 juillet 2011

Cobbler installation server

INTRODUCTION
Cobbler is an installation server that permits to install easily and automatically operating systems, virtualized or not with PXE. We will describe installation, configuration and use into this howto.
For this howto we use a CentOS 5 x86_64 distro.


INSTALLATION
First thing to do is to configure DHCP server. In our case, Cobbler server is not on the same machine that DHCP server, so we have to register the PXE class for Cobbler server on DHCP server.
Here is the part of dhcpd.conf config file regarding Cobbler service. After configuration, we have to restart the DHCP service to validate changes:
vi /etc/dhcp/dhcpd.conf

        host cobbler
        {
                option host-name "cobbler";
                ddns-hostname "cobbler";
                hardware ethernet 00:00:00:00:00:00; #MAC address of cobbler server
                fixed-address 192.168.0.XX; #IP of Cobbler server
                allow booting;
                allow bootp;
                class "PXE" {
                match if substring(option vendor-class-identifier, 0, 9) = "PXEClient";
                next-server 192.168.0.XX; #IP of Cobbler server
                filename "pxelinux.0";
        }
        }

:wq

/etc/init.d/dhcpd restart
Next, an easy yum command permits to install the Cobbler service on the server:
yum install PyYAML cobbler cobbler-web
Installation is now finished.


CONFIGURATION
For configuration, we will initially adjust cobbler parameters, we have to define an encrypted password that will be the root password for the machine installed with PXE and we define IP address for cobbler server.
We begin by creating the encrypted password using htpasswd:
/usr/bin/htpasswd -c /home/htpasswd root
New password: [cobbler]
Re-type new password: [cobbler]
Adding password for user root

cat /home/htpasswd

root:xH.KydRoK8CyQ
The password to use in the config file of Cobbler server is located after 'root', now we can edit the config file of Cobbler server:
vi /etc/cobbler/settings

default_password_crypted: xH.KydRoK8CyQ

next_server: 192.168.0.XX #IP of Cobbler server

server: 192.168.0.XX #IP of Cobbler server

:wq
Then we will install the services needed to run cobbler:
yum install tftp tftp-server xinetd
/etc/init.d/xinetd start
/etc/init.d/cobblerd start
chkconfig xinetd on
chkconfig cobblerd on
Now we will monitor the proper Cobbler configuration and adjust the parameters as will be shown:
cobbler check

/etc/init.d/httpd start

vi /etc/xinetd.d/rsync
 disable = no
:wq

yum install cman

cobbler get-loaders

yum install debmirror
vi /etc/debmirror.conf
 # @dists="sid";
 # @arches="i386";
:wq

/etc/init.d/cobblerd restart

cobbler sync
cobbler check
Cobbler is now properly configured. The next step is to import the ISO distribution that we want to make it available via PXE. In our case we will use CentOS and import can not be done with the netinstall ISO and ISO DVD includes too many packages that do not serve us.
We have so customized CentOS using CD1 of CentOS. A Howto was written on this blog about customization of CentOS, you can find it here:  Customize CentOS
We are going to use this custom ISO file for the import into Cobbler server.
First, we must download this ISO file locally (on Cobbler server) then we gonna mount it and import it.
mount -t auto -o loop /downloads/CentOS-5.5-x86_64-core.iso /mnt/
cobbler import --path=/mnt --name=Centos5 –arch=x86_64

cobbler sync
cobbler list

distros:
   Centos5-x86_64
   Centos5-xen-x86_64

profiles:
   Centos5-x86_64
   Centos5-xen-x86_64

systems:

repos:

images:
We can see in this list (distros and profiles) that CentOS ISO was added to Cobbler server. Now we have to create local repository. We could use the official repo CentOS but be aware that the cobbler will grab all the packages locally from the repo.
This operation takes time and a lot of disk space. Knowing that we have no need of all packages available on the official CentOS repo we will create a local repo with little packets which will occupy little disk space but more importantly to make the installation via PXE even faster.
So to create the local repo, we have to install a virtual machine using the custom CentOS ISO created previously (howto on the blog) and then we're gonna download all installed packages locally (on the virtual machine) for create the local repository.
I don't detail the installation of a VM from customized CentOS ISO (I assume you know how to do this).
To download installed packages, we're gonna use a method described previously on this blog too (here is the article: Download RPM packages with yum): with yumdownloader program
mkdir /tmp/rpm
yum update -y
yum install yum-utils -y
rm -rf /root/rpm.log &&rpm -qa > rpm.log
for i in $(cat /root/rpm.log) ; do yumdownloader $i --destdir=/tmp/rpm ; done
Then, we declare this local repo on the Cobbler server. To do this we copy every rpm packages into /tmp/rpm directory's on the VM to /tmp/rpm on the Cobbler server:
# Copy packages from VM to Cobbler server
scp -r /tmp/rpm/* user@IP_COBBLER:/tmp/rpm/
# Declare Cobbler local repo
cobbler repo add --mirror=/tmp/rpm/ --name=centos5-local
cobbler reposync
We can see now the cobbler local repo:
cobbler list

repos:
   centos5-local
Then we will edit the default kickstart file, this file permits to automate CentOS install:
cd /var/lib/cobbler/kickstarts/
mv sample.ks sample.ks_bak
vi sample.ks

auth --useshadow --enablemd5
bootloader --location=mbr
clearpart --all --initlabel
text
firewall --disabled
firstboot --disable
keyboard fr-pc
lang fr_FR.UTF-8
url --url=$tree
$yum_repo_stanza
$SNIPPET('network_config')
reboot

rootpw --iscrypted $default_password_crypted
selinux --disabled
skipx
timezone --utc Europe/Paris
install
zerombr
autopart


%pre
$SNIPPET('log_ks_pre')
$kickstart_start
$SNIPPET('pre_install_network_config')
# Enable installation monitoring
$SNIPPET('pre_anamon')

%packages
$SNIPPET('func_install_if_enabled')

%post
$SNIPPET('log_ks_post')
$yum_config_stanza
$SNIPPET('post_install_kernel_options')
$SNIPPET('post_install_network_config')
$SNIPPET('func_register_if_enabled')
$SNIPPET('download_config_files')
$SNIPPET('koan_environment')
$SNIPPET('redhat_register')
$SNIPPET('cobbler_register')
$SNIPPET('post_anamon')
$kickstart_done

:wq
The Cobbler configuration is now finished, we can test the Cobbler service. We create a new VM without boot media, we must activate network/PXE in the boot sequence. Then we start this new VM that will ask an IP address to DHCP server and ask PXE for install support.


COBBLER WEB
We will now install the web interface allows the administration of the cobbler and then configure:
yum install cobbler-web

vi /etc/cobbler/modules.conf

[authentication]
module = authn_configfile

[authorization]
module = authz_allowall

:wq

htdigest -c /etc/cobbler/users.digest "Cobbler"cobbler
# Type cobbler twice when asking password to have login/password: cobbler/cobbler

/etc/init.d/cobblerd restart
/etc/init.d/httpd restart
You can get on the interface with a browser to the URL: http://192.168.0.X/cobbler_web (where X must be replace with your Cobbler IP)
Login: cobbler
Password: cobbler

On this web interface, you can do everything that you can do from command line interface (CLI).


KOAN
Koan is a small program that adds to cobbler and interacts with it for reinstallation and virtualization management. Koan means: kickstart over a network, thus we can use it on a client server to calling cobbler server.
In our case, we will mainly use it for deploying virtual machines. It can be installed via yum, but a more current version is available from the EPEL repo.
Be careful about kernel used in CentOS custom ISO. In my experience, I met problems with some kernels on Xen systems using koan.

To get koan and install it:
cd /downloads
wget http://download.fedora.redhat.com/pub/epel/5/x86_64/koan-2.0.9-1.el5.noarch.rpm
rpm -i koan-2.0.9-1.el5.noarch.rpm
Here is an example of koan command to install CentOS virtual machine on Xen system (kernel 2.6.18-194.el5)
koan --virt --profile=centxenvm-xen-x86_64 --server=192.168.0.98 --virt-type=auto --nogfx --virt-name=centos –virt-path=/home/xen/centos/
I don't specify the method used to deploy a new VM with koan because I had to customize a lot of thing before that the VM works... It's DIY and I'm not quite happy with it in order to describe it !

This howto is ended, I hope that you can apply it in your workspace and that you understand how having a Cobbler server working perfectly. I use a CentOS environment but I think that other distros are supported with this system. Contact me if you need more help with Cobbler.

lundi 18 juillet 2011

phpSysInfo

phpSysInfo is a PHP script that displays information about the host being accessed. It will displays things like :

- Uptime
- CPU
- Memory
- SCSI, IDE, PCI
- Ethernet
- Floppy
- Video Information

website: http://phpsysinfo.sourceforge.net/


vendredi 1 juillet 2011

Innotop: MySQL InnoDB Monitor

Innotop est un clone de top (ou top-like) pour MySQL, orienté innoDB. Cette application vous permet d'effectuer de la surveillance. Par ailleurs, ce projet propose plus de fonctionnalités et de souplesses par rapport aux autres outils de la même famille.

Cette nouvelle version (1.8.0)  apporte de nouvelles fonctionnalités, comme :

  • Une interface en plugins entièrement configurable
  • Une surveillance du nombre de serveurs avec la possibilité de les regrouper
  • Une trousse à outils variés comme mytop
  • De nouvelles fonctionnalités comme l'interrogation de la période
  • Analyse et affiches les informations venant de InnoDB
Lien vers le site Innotop: http://code.google.com/p/innotop/