Mirror Server
24 Jun 2008 12:55
TAGS: blog dev lighttpd mirror php wikidot
Today I've (almost) managed to create a mirror server for wikidot.com service.
Features:
- CentOS distribution
- almost live Wikidot read only mirror
- database is replicated from the original service in real time to this server
- user uploaded files are replicated in real time to this server using FS mirror
- avatars are to be mirrored with rsync every now and then
- uses Portable IP address: 67.228.37.27
- lighttpd serves ALL content with FastCGI PHP
- database is read-only (as being replication slave)
- CVS configured to use SSH keys (no password asking)
- Wikidot PHP source mainly from the current production server
- Improvements (from CVS): uploaded files served like in OpenSource version
Problems:
- FS mirror is not 100% exact, it may not synchronize some (little fraction of) files every now and then, so we must rsync them additionally, to make sure nothing's lost
- if you were logged in to Wikidot before, it'll complain about not being able to write to ozone_session (because it's read only)
- Flickr Gallery not working and causing the whole page to display just nothing
- magic file recognition not working (it may be a problem in PHP configuration or an extension):
PHP Warning: finfo_open(): Failed to load magic database at '/usr/share/misc/magic'. in /var/www/www.wikidot.com/wikidot/php/utils/- on line 3
PHP Warning: finfo_file(): supplied argument is not a valid file_info resource in /var/www/www.wikidot.com/wikidot/php/utils/- on line 4
PHP Warning: finfo_close(): supplied argument is not a valid file_info resource in /var/www/www.wikidot.com/wikidot/php/utils/- on line 5
UPDATE: Flickr problem solution:
- yum install php-pear-HTTP-Request
- chgrp lighttpd /var/lib/php/session
Remember:
- when switching to mirror, we must restart memcached (or force to invalidate every item in it)
Hi guys
We moved to another solution. Rather that using FileInfo extension to PHP, we now use file command, which gives as good results, but is way easier to configure (i.e. no need to configure it in contrast to the PHP functions).
You can find how we made this in Wikidot source code :).
Cheers!
Piotr Gabryjeluk
visit my blog
Post preview:
Close preview