Archive

Articles taggués ‘securite’

Monitor your MySql replication database

26/03/2024 Comments off

how-to-monitor-mysql-replicationYou have configured your MySql replication, next step is to perform maintenance and monitor your replication. Percona Toolkit for MySQL is a collection of advanced command-line tools to perform a variety of MySQL server and system tasks.

The Percona Toolkit allows you to amongst many tasks to verify MySQL replication integrity, efficiently archive rows, find duplicate indexes, summarize MySQL servers, analyze queries from logs and tcpdump, collect vital system information when problems occur.

To get started you need to install Percona Toolkit, I’m using Ubuntu as an OS on my servers, installing the percona toolkit was straight forward

apt-get install percona-toolkit

To get a summary of your databases use the command – pt-mysql-summary

pt-mysql-summary --u=username --p=password

Next you would want to setup a heartbeat table in your database so you can Monitor MySQL replication delay – for that you will use the pt-heartbeat command.

pt-heartbeat -D wpslavedb --create-table --ask-pass --check --master-server-id 1

You can find the manual for the options here.

pt-heartbeat measures replication lag on a MySQL or PostgreSQL server. You can use it to update a master or monitor a replica. mk-heartbeat depends only on the heartbeat record being replicated to the slave, so it works regardless of the replication mechanism. It works at any depth in the replication hierarchy; for example, it will reliably report how far a slave lags its master’s master’s master.

Start daemonized process to update test.heartbeat table on master:

  pt-heartbeat -D wpslavedb --update -h master-server --daemonize --ask-pass

Monitor replication lag on slave:

  pt-heartbeat -D wpslavedb --monitor -h slave-server --ask-pass
  pt-heartbeat -D wpslavedb --monitor -h slave-server --dbi-driver Pg --ask-pass

Check slave lag once and exit (using optional DSN to specify slave host):

  pt-heartbeat -D wpslavedb --check h=slave-server --ask-pass

If the replication hierarchy is “master -> slave1 -> slave2” with corresponding server IDs 1, 2 and 3, you can:

  pt-heartbeat --daemonize -D wpslavedb --update -h master --ask-pass
  pt-heartbeat --daemonize -D wpslavedb --update -h slave1 --ask-pass

Then check (or monitor) the replication delay from master to slave2:

  pt-heartbeat -D wpslavedb --master-server-id 1 --check slave2 --ask-pass

Or check the replication delay from slave1 to slave2:

  pt-heartbeat -D wpslavedb --master-server-id 2 --check slave2 --ask-pass

if you developing and writing SQL statements, this command is very useful pt-query-digest – Analyze MySQL queries from logs, processlist, and tcpdump

  pt-query-digest slow.log    // requires you to have slow query logged enabled

There are other tools Percona Toolkit, these that I shown is what I find useful for my monitoring and maintenance.

If you want to find out the best MySQL configuration for your application, you can head over to Percona’s website they have a MySql wizards.

Source: torbjornzetterlund.com

Un cluster DRBD / MySQL avec Heartbeat sur Debian 7

25/03/2024 Comments off

Source: denisrosenkranz.com

Nous avons vu précédement comment mettre un place un Cluster Apache actif/passif avec DRBD et HeartBeat. Dans ce tutoriel nous allons voir comment faire la même chose mais avec MySQL.

La configuration de DRBD et de Heartbeat est la même que pour le tutoriel précédent.

Voilà ce que nous allons mettre en place

DRBDMySQL

Donc pour faire ce tutoriel suivez le tutoriel suivant jusqu’a « Installation d’apache« :

Un cluster DRBD/Apache avec Heartbeat sur Debian 7

Lire la suite…

Un cluster DRBD / Apache avec Heartbeat sur Debian 7

24/03/2024 Comments off

C’est quoi Heartbeat?

drbd apache debianHeartbeat est un logiciel de surveillance de la disponibilité des programmes, pour les systèmes d’exploitation Linux, FreeBSD, OpenBSD, Solaris et MacOS X. Il est distribué sous licence GPL.

Heartbeat écoute les battements de cœur – des signaux émis par les services d’une grappe de serveurs lorsqu’ils sont opérationnels. Lorsque qu’un serveur devient défaillant, Heartbeat le detecte (puisqu’il n’entend plus ses battements de coeurs) et bascule les services surveillés sur un autre serveur. Pour que cela soit transparent pour les utilisateurs, Heartbeat met en place une IP virtuelle unique qui est balancée entre les deux serveurs.

Voici ce que nous allons mettre en place

Schéma

Mise en place de la solution

Pour ce tuto, nous allons partir du Cluster DRBD que nous avons mis en place dans le tutoriel précédent:

DRDB sur Debian 6

Lire la suite…

Categories: Logiciel, Système Tags: , ,

DRBD sur Debian 6

24/03/2024 Comments off

Source: denisrosenkranz.com

Qu’est-ce que DRBD?

DRBD pour Distributed Replicated Block Device est comparable à un RAID 1 mais en réseau, c’est à dire que deux disques, partitions ou même un LVM peuvent être repliqué d’un disque à un autre via un réseau ethernet ou fibre optique.
Cela permet donc d’assurer la disponibilité de vos données en cas de crash complet d’une machine. Ce que ne permet pas de faire un RAID classique.

DRBDDiag

Pour ce tuto nous allons donc utiliser deux machines virtuelles sous Debian 6.

Lire la suite…

Categories: Système Tags: , ,

Set Up SSH Tunneling on a Linux / Unix / BSD Server To Bypass NAT

21/03/2024 Comments off

I‘m a new Linux / Unix system user. How can I set encrypted tunnel between my desktop/laptop computer and server in a remote data center to bypass the limits in a network? How do I create a reverse SSH tunnel on Unix-like systems?

SSH tunnelling can be thought as a poor-man’s-VPN. It is handy in situations where you would like to hide your traffic from any body who might be listening on the wire or eavsdropping.

You can use such tunnel between your computer and your Unix/BSD/Linux server to bypass limits placed by a network or to bypass NAT, and more.
Lire la suite…

Categories: Réseau, Système Tags: , ,