MAN07 VOMS Replication

How to implement a MySQL VOMS server replication

Document control

TitleMAN07 VOMS Replication
Policy GroupOperations Management Board (OMB)
Document statusApproved
Procedure StatementHow to implement a MySQL VOMS server replication
OwnerSDIS team


In this manual we will show you how to implement a MySQL VOMS server replication: you need one master server, on which you can perform writing operations, and you can have from 1 to “n” replica servers that will work in read-only mode. In such a scenario you can do a whatever intervention on one of the servers without breaking the service, i.e. proxies creation and grid-mapfile downloads: just the users registration and the usual VOs management operations might be forbidden during an intervention on the master server (because it is the only server in writing mode).

This failover procedure is simply based on MySQL replication therefore every MySQL setting is referred to the current MySQL version (5.0.77 in this moment)

Settings on the MASTER SERVER

In order to allow the replica server to read the master database, you have to create an user with which the slave will connect to the master. Suppose the replica hostname is, the user is bonjovi and the password is always. What you have to launch on the master server is:

$ mysql -p -e "grant super, reload, replication slave, replication client \
  on *.* to bonjovi@'' identified by 'always'" ;

Then for each DB (VO) you want to replicate, you have to assign the right permissions, by launching:

mysql -p -e "grant select, lock tables on voms_myvo.* to \

Eventually you have to modify the file /etc/my.cnf by adding the following lines into the section [mysqld]:


It is important that on the master server it is set server-id=1: it is the identification number that distinguish a master from its several slaves (each slave will have a unique number starting from 2)

For example, the content of my.cnf file may appear like this:

# less /etc/my.cnf


# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).

max_connections = 800
log-bin=mysql-bin server-id=1
# Disabling symbolic-links is recommended to prevent assorted security risks;
# to do so, uncomment this line: # symbolic-links=0


At this point, you have to restart MySQL, by launching:

$ service mysqld restart

In order to check that on the master side the mechanism is working, you can launch for example:

mysql> show master status;
| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |
| mysql-bin.000001 | 24844    |              |                  |
1 row in set (0.00 sec)

Eventually, through the web interface, in the ACL section of each VO you want to replicate, add an entry granting all the permissions to the slave server:

  • select “a non VO member” from the menu
  • fill in the replica server DN and a reference email address
  • select “all” for the permissions and tick the “Propagate entry to children contexts” option

In this way, when the slave server copies the DB, it will have the proper permissions on acting on the DB. Moreover, in order to avoid the sending of notification to the email address you filled in before, connect to the MySQL database and do the following:

mysql> use voms_myvo;
mysql> update admins set email_address=NULL where \
  email_address="what you filled before";

Settings on the SLAVE SERVER

Install a VOMS server as usual, configuring the VOs you want to replicate: keep in mind that every modification done on the slave DB breaks the replica mechanism, so that on this server disable the users registration, by setting the yaim variable:


Then ask the VO managers to not perform any action on the slave server web interface.

Then launch the following scripts:

  • for the first database you want to replicate or in the case it is the only one
  • for the next databases (one database for each launch)

For both the scripts, set the following variables:

  • master_host, master_mysql_user, master_mysql_pwd that refers to the master server and to the user created on it
  • mysql_username_admin and mysql_password_admin that refers to the slave


voms_database="" # VOMS database (leave unset)
master_host="" # Master hostname
master_mysql_user="bonjovi" # Master MySQL admin user for replication
master_mysql_pwd="always" # Master MySQL admin pass for replication user
master_log_file="" # Master LOG file (leave unset)
master_log_pos="" # Master LOG file (leave unset)
mysql_username_admin="root" # Slave MySQL admin username
mysql_password_admin="secret" # Slave MySQL admin pass

With the launch of, the file /etc/my.cnf will be properly written; if you need to replicate further databases, modify /etc/my.cnf adding the following lines related to the db you are replicating (similar to the first db you’ve replicated):


Having set the variables in the way shown above, for replicating the first database the scripts launch syntax is the following:

$ ./ --master-db=voms_myvo --db=voms_myvo

In your /etc/my.cnf file you will find lines like the following:

# Connection with master

# Replicas settings

Now you may want to replicate a second database, let’s say voms_hervo: therefore in my.cnf file add the following lines:


Modify the script in according to the VO parameters and launch it:

$ ./ --master-db=voms_hervo --db=voms_hervo

When you finished to replicate all the desired VOs, in order to make active the database modifications, restart voms and voms-admin:

$ /etc/init.d/voms-admin stop
$ /etc/init.d/voms stop
$ /etc/init.d/voms start
$ /etc/init.d/voms-admin start

Keep in mind that every modification done on the slave DB breaks the replica mechanism, so that on this server disable the users registration, by setting the yaim variable:


And ask the VO managers to not perform any action on the slave server web interface.