Okay; I've been following some threads for a while about people storing
image data in a DB, and just about everyone says it's bad, inefficient, etc.

Here's my situation, and my idea.. I don't know if this is the best way, but
it works, so far.  :)

I have four separate server groups in geographically different areas
(network, etc.).  They all run the same application and are DNS load
balanced.  I have a MySQL DB at each location, which are slave replicators
from the master mysql DB that sits in our central location.

I have binary data (in this case they're small MP3 clips -- 50k max), that I
need all of the servers to have instant access to once they're uploaded into
the system.

All writes from all of the servers go back across the network to the master
DB (there are very few writes).

Right now, these MP3's are addslash'd, and inserted into the master DB,
which then replicates it out over the slave links to the three slave

This way, I have a 'local' copy of each file at each server site for fast

I tried the NFS method; which sucked (and was insecure as heck going over
the public internet).

rsync isn't an option -- I need these files instantly distributed.

FYI; I have just around 90,000 mp3's in this database so far (no, they're
not pirated music, just radio clips/sound effects), using MySQL on Linux
boxes.  I don't notice any slowdowns compared to straight file accessing.

Also, backing this setup up is kind of cool; I have a fifth DB server I have
sitting on my desk that replicates off the master; I just detach the master
from the slave, shutdown the database server, back the MYD/FRM files up to
tape, and start it back up.. the master catches the slave back up.

Also, if one of the DB's dies, I can switch the servers using it to another
one in another location (it gets slow, but it works) by just changing a
single line in the config file.

(oh, and I've already worked around the 2GB file limit in linux -- I have
the DB split into multiple RAID0 chunks using MySQL's raid functionality)

I am a little wary of the 'everything in one file' syndrome, but... I've had
the power drop out on the master db a few times (eek), even in the middle of
updates, and after a good hour of churning, it was able to come back online.
That's the only disadvantage I've found with this. (and yeah, I have a BIG
ups for the box now).

Is this a bad idea?  what is the downside to doing it this way?  as far as
disk usage goes, I seem to have more disk space this way -- inodes aren't
getting wasted.  The DB servers don't seem to mind at all.


PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to