php and cURL running on a specific node
"Paul Robbins" <[email protected]>
| Newsgroups | gmane.linux.cluster.ssic.user |
|---|---|
| Message-ID | <AF076C22BA142647B37E4C91141947D41D7CCD@exchange.isrighthereltd.local> |
Hi,
I have a requirement to have a curl command run from just one of the
nodes in my 3 server openSSI cluster instead of all 3.
Currently I am using apache served php scripts to issue curl xml
requests and it all works fine except that the receiving server sees the
request come from three different IP addresses on a semi-random basis
(as you would expect). However - due to security settings which cannot
be changed the receiving server can only be configured to accept
connections from 2 of the IP addresses and hence 1 in three connections
fails (is ignored by the receiver).
Q. Does anyone have any experience of forcing a php script to be run
from a specific node?
Q. Am I over complicating things? Is there a simpler method?
Q. Is there any kind of filelist.conf file on openssi, that can be used
to indicate that a specific script should only be run on the initnode or
nodeX? (I see /etc/rc.d/rc.nodeinfo but suspect that is only for
startup scripts)
For Information; I have tried the following:
A test script which simply echoes "my node is (nodename) at (time)" is
being called using different methods from a second.php script being
served by all 3 servers. What I am is expecting is that regardless of
the node the 1st script is being served from, the test script should
always echo "my node is 1 at (time)". The results are as follows:
-------------SUCCESS WHEN TRYING THE SCRIPT FROM web server NODE
1-------------------
...
Running Command on Node server1 <-- NOTE: SERVER1 is trying to call
the test script.
Command1 to be run is: exec ('onnode 1
/cluster/node1/nmdx_xml_post.php')
Response1: [my node is - server1 at. 14/06/06 01:47:39]
Command2 to be run is: shell_exec('onnode 1 /usr/bin/php -f
/cluster/node1/nmdx_xml_post.php')
Response2: [my node is - server1 at. 14/06/06 01:47:39]
my node is - server1 at. 14/06/06 01:47:39
code: 0
...
-----------------END OF SUCCESSFUL
SCRIPT--------------------------------
-------------FAIL WHEN RUNNING THE SCRIPT FROM web server NODE
3--------------------
...
Running Command on Node server3 <-- NOTE: SERVER3 is trying to call
the test script.
Command1 to be run is: exec ('onnode 1 /cluster/node1/testecho.php')
Response1: []
Command2 to be run is: shell_exec('onnode 1 /usr/bin/php -f
/cluster/node1/testecho.php')
Response2: []
/cluster/node1/testecho.php not found. <-- HUH? How is that
possible??
code: 255
...
----------------------END OF FAILED
SCRIPT--------------------------------
if i run from the command line:
# onnode 2 /usr/bin/php -q /cluster/node1/nmdx_xml_post.php
I get echoed back...
my node is - server2<br />at. 14/06/06 01:51:04
So i can see the script can be told to run on different nodes from a
command line and responds correctly, however if it is told to do so by
any php script that is not being served from node1 it will fail with a
'file not found' kind of message?? (hence the placing it in the
/cluster/node1/ folder to try and make sure it was available to all
nodes in a fixed location, originally I had it placed in a folder in the
web root, which i realise should still be available to all nodes.. but
it still didn't work).
Thanks.. Paul.