« Archives in October, 2007

Yahoo Search Marketing $100 Promo Coupon

For new self-service accounts with minimum $30 deposit (meaning you get $130 for $30).

Coupon: US2245
Link: http://searchmarketing.yahoo.com/arp/choose.php?o=US2245

Load balancing FastCGI

Run this command on a worker

spawn-fcgi -p 8081 -a 192.168.2.100 -f /usr/bin/php-cgi -u lighttpd -g lighttpd -C 5 -P /var/run/spawn-fcgi-8081.pid

Don’t forget to open up the right port (8081 in the example) and monitor the processes (say restart when it dies)

Reference

http://www.cyberciti.biz/tips/lighttpd-mod_proxy-to-run-php-fastcgi-app-server.html

Bind to a socket

spawn-fcgi -s /tmp/php-fastcgi-ext.sock -f /usr/bin/php-cgi -u lighttpd -g lighttpd -C 5 -P /var/run/spawn-fcgi.pid

Bind to an IP:port

spawn-fcgi -p 8081 -a 192.168.2.100 -f /usr/bin/php-cgi -u lighttpd -g lighttpd -C 5 -P /var/run/spawn-fcgi-8081.pid

Reference

http://trac.lighttpd.net/trac/wiki/Docs%3AModFastCGI#load-balancing

Need also to turn on lighttpd (service lighttpd start) so reporter can get status on this server directly (through port 80)

Using an external fcgi in lighttpd.conf to load balance only a specific file

fastcgi.server = (
"/index.php"=>
(
 ("socket"=>"/tmp/php-fastcgi.socket",
  "bin-path"=>"/usr/bin/php-cgi",
  "min-procs"=>2,
  "max-procs"=>4,
  "bin-environment"=>("PHP_FCGI_CHILDREN"=>"10","PHP_FCGI_MAX_REQUESTS"=>"5000")
 ),
 ("host"=>"192.168.2.100",
  "port"=>8081,
  "check-local"=>"disable",
  "disable-time"=>30
 )
),
".php"=>
(
 ("socket"=>"/tmp/php-fastcgi.socket",
  "bin-path"=>"/usr/bin/php-cgi",
  "min-procs"=>1,
  "max-procs"=>2,
  "bin-environment"=>("PHP_FCGI_CHILDREN"=>"5","PHP_FCGI_MAX_REQUESTS"=>"1000")
 )
)
)

MySQL slaves catch up with master

Even if running “show slave status” will show there is no delay but it could still receiving data from the master. Check it by running “show processlist” on the master. If the status is “Writing to net”, it’s still sending data to that slave. If it’s “Has sent all binlog to slave; waiting for binlog to be updated”, then you can be sure it’s done and all rows match. It takes a while for about 11 slaves to sync with our chained master.

MySQL upgrade breaks replication

Upgrade from 4.1.x and 5.0.22 to 5.0.42 and going forward (5.0.46, 5.0.48) in CentOS breaks replication. The error log now placed as /var/run/mysqld/mysqld.err instead of into the default datadir and the name is mysqld.err instead of .err, is it a MySQL bug?

mysql> start slave;
ERROR 1201 (HY000): Could not initialize master info structure; more error messages can be found in the MySQL error log

071005 13:06:38 [ERROR] Failed to open the relay log ‘/var/run/mysqld/mysqld-relay-bin.000074’ (relay_log_pos 598368274)
071005 13:06:38 [ERROR] Could not find target log during relay log initialization