PBS installation script

Created on 111116 by André Guimarães, Switzernet

 

This document describes what the puppet PBS script does and how the Master replication is made.

 

Puppet Diagram.. 1

How to install 2

Setup replication script 2

Resources. 3

 

Puppet Diagram

 

This next picture describes the relationship between each of the puppet steps. The most important steps are:

-         configuration of SNMP

-         configuration of email

-         installation of Perl and some modules needed by the script that is going to make the replication

-         installation of mysql and other packages that might be needed for debug

-         copy of the SQLs that create the database

-         run the script /etc/pbs/setup-mysql-replication.pl

 

How to install

Follow the procedure in http://switzernet.com/3/public/111116-masterreplication/

The puppet module can be downloaded here.

Setup replication script

The most important step of the installation is running the /etc/pbs/setup-mysql-replication.pl. This script follows these steps:

  1. The script reads the configuration from /etc/pbs/setup-mysql-replication.conf which is generated by Puppet using the parameters in nodes.
  2. Then it connects to the Master and forces a FLUSH with READ LOCK. This step prevents anything from being modified while we’re making the DB dump.
  3. It then gets the position in the binary logs from the master.
  4. Starts to dump the configured tables or databases.
  5. When finished it releases the lock on the database and disconnects from the Master.
  6. It configures the replication in PBS’MySQL.
  7. Connects to MySQL and stops replication.
  8. It then creates all tables in the appropriate databases using the SQLs provided by Puppet. In this SQLs we provide connection to Cacti and Monitor servers so we can monitor the server.
  9. Imports the dumped SQLs.
  10. Set replication to the appropriate server, binary log and binary log position (obtained from step 4)
  11. It restarts replication.
  12. It gives replication/selection permissions to the servers defined in the configuration file
  13. Closes the connection to the database
  14. Does a backup of the SQLs files and creates a file with the replication position.

Resources

http://switzernet.com/3/public/111114-dba-v6

http://switzernet.com/3/public/110525-puppet-modules/

http://switzernet.com/3/public/111116-masterreplication/

http://portasip-monitor.switzernet.com/110726-monitor/view.php