[Voyage-linux] MySQL

Robert Rawlins - Think Blue (spam-protected)
Mon May 11 16:11:49 HKT 2009


Hi Chris,

 

I've been working on this stuff over the weekend trying to figure out how it
all works. It does appear that some applications lock files and so RO won't
mount properly.

 

One thing I have seen for you which may work is that MySQL has a -read-only
option, I've seen other posts on Google referring to this when searching for
'mysql read only filesysten' might be worth you checking out?

 

The only files I'm aware of MySQL writing are all the usual ones, like logs
and pid, both of which should be fine when mounted in RO as the /var/log/
and /var/run directories allow you to write to them.

 

MySQL also writes to a temp directory when performing queries, this can be
changed in the my.conf file and may be part of your issue. Also, where is
your data for MySQL stores? This is also configurable from my.conf.

 

Rob

 

From: Chris [mailto:csrodley at xnet.co.nz] 
Sent: 10 May 2009 21:28
To: Robert Rawlins - Think Blue
Cc: voyage-linux at voyage.hk
Subject: Re: [Voyage-linux] MySQL

 

Hi,

As far as I can see, RO means that the data required read writable is
written to ram and so when rebooted changes won't persist.. but in the event
of a hard restart there won't be file system damage.
I could be wrong on this, but this has been my assumption up to this point.

There have been a number of powercuts where we have been running RO and RW
systems and the RO systems survived while the RW systems died.
Maybe someone else can confirm if this is a correct assumption?

So I guess the question we are asking the community is.. Does anyone know
what files mySQL is using that is locking the file system so it can't be
made RO once mySQL is started?

Cheers,
Chris


Robert Rawlins - Think Blue wrote: 

Hi Chris,

 

OK, Well hopefully with two brains on the job we'll be able to solve the
issue. J

 

I'm very new to the idea of a ro file system, it's something we'd never
worked with before until coming to voyage and even then we disabled it from
the get-go to save problems like this arising. However, it's something we're
now keen to solve as it's caused us problems with duplication having them in
RW.

 

My knowledge on the RO system was that the applications could 'write' data
to the fs but that it was properly written to the disk and thus lots after a
reboot? Is that not correct? From what you're saying it sounds as nothing
can be written to the disk when in RO mode, how do things like syslog work
in this situation? Surely they're writing to something?

 

Thanks,

 

Robert

 

From: Chris 
Sent: 08 May 2009 00:16
To: Robert Rawlins - Think Blue
Cc: voyage-linux at voyage.hk
Subject: Re: [Voyage-linux] MySQL

 

Hi Robert,

Sorry, I have been away all week.
We have found that after apt-getting mysql and without even setting it up,
voyage is not able to remountro on boot up after mysql has been started.
There has been a number of power cuts over the past few days and we have
lost 2 systems as a result. 
We have other units not running mysql that work find after a powercut
because they are read-only.

I assume that there is some sort of temp file that need to be put into tmpfs
or something. We have switched off all logs on mysql conf, so that should
not be the problem.

In this system - on reboot everything is transferred off the network back
onto the computer, so there is no need for database files to persist across
reboots.

I guess what I really need to know is what mysql is doing to take control of
the filesystem so it can't be remounted read only.

Thanks for the help!
Chris


Robert Rawlins - Think Blue wrote: 

Gustin, thanks for the advice!
 
I'll likely be DDing the entire disk so at least that won't be too much of a
challenge. Things generally seem pretty simple here then, that's good to
know.
 
I'll try this out later today and see how I get on, I'll once I've got it up
and running I'll look into the MySQL configuration to see what needs to be
changed in respect to that to get things working.
 
I'd be interested to hear from Chris (the original poster) about the
problems he had with MySQL, even in read only I'd expect the server to be
able to write files, they'd just be lost after a reboot? Correct?
 
Thanks again,
 
Robert
 
-----Original Message-----
From: Gustin Johnson 
Sent: 07 May 2009 12:09
To: Robert Rawlins - Think Blue
Cc: voyage-linux at voyage.hk
Subject: Re: [Voyage-linux] MySQL
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
 
Robert Rawlins - Think Blue wrote:
  

Hi Rainer,
 
This is something we have talked about in the past but I have not tried to
do it yet. I've never worked with multiple partitions in Linux before. I
like this idea very much.
 
    

This is nothing new.  There is a lot of documentation out there.
Basically, you create the partition, then format it, then add an entry
in /etc/fstab so that it is mounted on boot.
 
  

Do you have any advice on how to create this second partition? And how I can
    

 
I use cfdisk, but my main environment is Linux.  You may wish to RTFM
partitioning under Linux.  It is easy to turf an existing partition
regardless of the OS you are using.
 
  

write files to it? Are there any gotchas I need to watch out for? We're
    

 
Once mounted, the new partition appears as another folder on your file
system.  You write files to it like you would any other folder.
 
  

currently creating our disks using the Live CD. I assume this is where I
create the second partition?
    

 
Sure.  You could also do it from within voyage, assuming that there is
free space to partition.
  

Also, do you know if this second partition included in a disk replication
using DD?
 
    

If you dd the whole disk (eg. /dev/sda), then yes all partitions are
preserved in the resulting image.  If you want to carve out one of these
partitions from the resulting single image, things can get complicated
(I had to do it once, I documented this here:
http://meganerd.ca/site/node/11).  A better solution in this case is to
dd each partition individually (eg. /dev/sda1 and /dev/sda2).  An even
better solution is to use partimage.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
 
iD8DBQFKAsFHwRXgH3rKGfMRAg80AKCgUeMKH8siiMHcPD/ZT4LmcxlrmgCfcrsp
+TdysYMhRf+wc0MrCXBcZs0=
=IKL0
-----END PGP SIGNATURE-----
 
 
_______________________________________________
Voyage-linux mailing list
Voyage-linux at list.voyage.hk
http://list.voyage.hk/mailman/listinfo/voyage-linux
 
  
 



  _____  



 
_______________________________________________
Voyage-linux mailing list
Voyage-linux at list.voyage.hk
http://list.voyage.hk/mailman/listinfo/voyage-linux
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.voyage.hk/pipermail/voyage-linux/attachments/20090511/ca45e410/attachment-0002.html>


More information about the Voyage-linux mailing list