Skip to main content

mysql replication and binary logs expiration

Mysql replication is very well documented on mysql server web site and has a well explained howto that you can follow when you are setting up replication on your mysql databases.

You have to set in mysql server configuration file the log_bin parameter specifying the binary log file name that will be replicated across all the slaves. Mysql slaves take this binary logs from master and apply them to database; the problem I found is that Mysql server does not manage this binary logs expiration automatically, so if you are not careful and your database has a lot of changes your system can run out of disk space.

To address this issue, mysql has another parameter “expire_logs_days” that with you can specify the value in days of the binary logs expiration:


expire_logs_days = 5
max_binlog_size = 1G

In this config, 5 days after logs replication, mysql will automatically remove them. You have to adjust this value to be sure your hard disk is not going to run out of space and your slave has time enough to apply the binary log changes considering the number of days slaves might lag behind the master.

In the same way, you can use purge binary logs mysql command to purge old binary logs:

PURGE BINARY LOGS BEFORE '2008-04-02 22:46:26';

Redmine xapian search plugin

 
 

 

httpc://github.com/xelkano/redmine_xapian/blob/master/README.textile

 

h1. CHANGELOG

httpc://github.com/xelkano/redmine_xapian/blob/master/CHANGELOG

 

 

Please Consider Supporting this Plugin by Donating:
[wpdonatebuy cid=1]

Access denied for user ‘debian-sys-maint’@’localhost’ (using password: YES)

 

I had this error  when I moved all database server files,  phisically,  from one server to another for replication purposes and used the mysql startup script. The new server is a Debian Squeeze,  in debian there is a user debian-sys-maint   to do maintenance tasks,  to avoid this error with the mysql startup script you have to create this user in your new database server.

 

The password for this user can be seen in this file:


# cat /etc/mysql/debian.cnf

# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = password
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = password
socket = /var/run/mysqld/mysqld.sock
basedir = /usr

To create the user,  log in as mysql root user and run this statement:

GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY 'password'; 

In my case,  the original server was a Centos 5.5,  so that the user debian-sys-maint did not exist,  but in case the server was another Debian you can use the same statement to only reset the user password.

 

How to resize KVM virtual machine disk file

 

In KVM when you create a new virtual machine,  you have to specify the initial size of the disk that the machine is going to use. If later, you realize that initial size is not enough,  you can resize disk image with qemu-img command:

$ qemu-img resize vm-101-disk-1.raw +10G

In the example we have resized the disk image with 10Gb more. The new size can be specified in K for kilobyte, M for megabyte and G for gigabyte.

Inside virtual machine you are going to see new unassigned free space in the disk. If we have partitioned the guest machine with LVM we can easily extend the logical volumes  with the new space we have newly created in the disk. To do that we only have to create a new LVM partition and assign the new partition to the existing volume group.

Davfs: mounting https webdav resource

 

Here is a simple guide to automaticaly mount a webdav resource in linux.  In this case we are going to use davfs2 to mount our webdav resource. Davfs is able to mount a WebDAV resource as a regular file system and access it in the same way as others directories in your system. In Ubuntu you have to install davfs2 package:


$ sudo apt-get install davfs2

Usually,   you access to your webdav resource with a username and password. In davfs you can do it automatically putting the username and password in  .davfs/secrets file in your home directory. Davfs gets this data and does login for you.

Here is an example of .davfs/secrets file,  “/home/user/webdav” is the mount point of your webdav resource:


/home/user/webdav username password

You can put this configuration in  /etc/fstab file:


https://myserver.org/webdav /home/user/webdav/ davfs user,noauto 0 0

Now,  you can see this new resource in nautilus file browser and you can mount it automatically.

If you are trying to mount a https resource you have another problem to deal with:   the server certificate. If server certificate you are using is sefsigned or from a CA cert that is not known for your system,   you are going to see these message when you are trying to mount the webdav resource:

You only should accept this certificate, if you can
verify the fingerprint! The server might be faked
or there might be a man-in-the-middle-attack.
Accept certificate for this session? [y,N]

You can’t accept the certificate permanently,  so you can’t mount the resource trough the fstab to be accesible from nautilus,  because davfs is going to be waiting until you enter the answer. What you have to do is configure the CA certificate in PEM format on davfs to always be trusted. To do that edit .davfs2/davfs2.conf in your home directory or /etc/davfs2.conf for system wide and insert this line:


servercert      ca-cert.pem

You have to put your CA cert file (ca-cert.pem) on .davfs/certs directory.
Now you can mount webdav resource from nautilus without problems.