Hi all !
I have SCGI setup and working correctly on a new host. I configured a
cluster using:
scgi_cluster config -e production -p 20000 -c 2
Now, I want to tell mod_scgi that I have two children. How do I do
that ? I can’t seem to find anything on the SRR site, nor on the
mailing list.
Thanks for any tips !
You know, I could have swore I did this to test the cluster, but now
that
I look at my setup I think it actually wasn’t working with a cluster.
I’m
actually quite stumped how you’d do this. In lighttpd you just say
there’s 3 servers and that’s it. It uses them. In Apache I’m thinking
you’ll have to scgimount the three backends to different URLs, and then
somehow use mod_rewrite to balance between them.
That seriously can’t be right. There’s got to be a simpler way. Anyone
have other thoughts?
Zed
2005/12/8, [email protected] [email protected]:
You know, I could have swore I did this to test the cluster, but now that
I look at my setup I think it actually wasn’t working with a cluster. I’m
actually quite stumped how you’d do this. In lighttpd you just say
there’s 3 servers and that’s it. It uses them. In Apache I’m thinking
you’ll have to scgimount the three backends to different URLs, and then
somehow use mod_rewrite to balance between them.
One could use random RewriteMap for “balancing”.
In Apache config:
SCGIMount /scgi0/ 127.0.0.1:9999
SCGIMount /scgi1/ 127.0.0.1:10000
SCGIMount /scgi2/ 127.0.0.1:10001
RewriteMap scginums rnd:/web/scgi-nums.txt
File /web/scgi-nums.txt:
num 0|1|2
And change rewrite rule to “balance” between them:
RewriteRule ^(.*)$ /scgi${scginums:num}/$1 [QSA,L]
Setup Rails routing:
config/routes.rb:
map.connect ‘:controller/:action/:id’
map.connect ‘scgi0/:controller/:action/:id’
map.connect ‘scgi1/:controller/:action/:id’
map.connect ‘scgi2/:controller/:action/:id’
Now, it will work as a cluster, but it’s definitely very poor
“solution”.