On 03/04/2012, at 4:48 PM, Vaillancourt, Tim wrote:
> Hello Traffiserver users!
>
> I'd like to start off by thanking the ASF, Yahoo!/Inktomai and other
> contributes for making (and donating) this great piece of software! My team
> is currently implementing Trafficserver in hopes to replace many Apache
> HTTPd/mod_proxy proxy servers in our team's production.
>
> I am e-mailing the list due to an issue (or PEBKAC) I am experiencing when
> running several instances of Trafficserver on one system, under custom
> directories.
>
> In our environment we install what we call "Binary packages" and "Instance
> packages", meaning we will install a compiled "Binary package" version of
> Trafficserver to say '/opt/tools/trafficserver3' and use that set of binaries
> in several smaller "Instance packages" under say
> '/opt/instances/ts_uploadprx'. Upon install of an "Instance Package" we
> symlink the bin, lib, modules dir over from the "Binary package"
> ('/opt/tools/trafficserver3') into our instance package, but we'll have a
> unique 'conf' dir for the given instance. This is working quite well for us
> with standard Apache HTTPd, allowing us to spawn several unique instances of
> Apache, all using one set of binaries.
>
> When we try this methodology with Trafficserver 3.0.4, we run into several
> issues preventing Trafficserver to function.
>
> Here is an example of an ls on our "ts_uploadprx" instance (notice binaries
> are symlinked while cache, conf, logs and share are instance-specific):
>
> "
> [tim@app013 ts_uploadprx]$ ls -al
> total 44
> drwxr-xr-x 6 root root 4096 Apr 3 00:08 .
> drwxr-xr-x 11 traf traf 4096 Apr 2 23:48 ..
> lrwxrwxrwx 1 root root 34 Apr 2 23:48 bin ->
> /opt/tools/trafficserver3/bin
> drwxrwxr-x 2 root traf 4096 Apr 2 23:47 cache
> drwxrwxr-x 3 root traf 4096 Apr 2 23:48 conf
> lrwxrwxrwx 1 root root 38 Apr 2 23:48 include ->
> /opt/tools/trafficserver3/include
> lrwxrwxrwx 1 root root 34 Apr 2 23:48 lib ->
> /opt/tools/trafficserver3/lib
> drwxrwxr-x 2 root traf 4096 Apr 3 00:14 logs
> lrwxrwxrwx 1 root root 38 Apr 2 23:48 modules ->
> /opt/tools/trafficserver3/modules
> drwxrwxr-x 2 root traf 4096 Apr 2 23:47 share
> "
>
> To allow this all to function, I had to get trafficserver to source different
> values for TS_DAEMON, TC_DAEMON, TM_DAEMON, etc on startup so I created a
> 'ts-defaults' script (similar something you'd put into /etc/defaults/) to set
> the environment variables for my instance (here is me sourcing 'ts-defaults'
> from cmd-line):
>
> "
> [tim@app013 ts_uploadprx]$ set -x; . ts-defaults; set +x
> + . ts-defaults
> ++ MY_PATH=/opt/instances/ts_uploadprx
> ++ TC_NAME=traffic_cop
> ++ TM_NAME=traffic_manager
> ++ TS_NAME=traffic_server
> ++ TC_DAEMON=/opt/instances/ts_uploadprx/bin/traffic_cop
> ++ TC_DAEMON_ARGS=
> ++ TM_DAEMON=/opt/instances/ts_uploadprx/bin/traffic_manager
> ++ TM_DAEMON_ARGS='-path /opt/instances/ts_uploadprx/conf -recordsConf
> /opt/instances/ts_uploadprx/conf/records.config'
> ++ TS_DAEMON=/opt/instances/ts_uploadprx/bin/traffic_server
> ++ TS_DAEMON_ARGS='-d /opt/instances/ts_uploadprx'
> ++ TC_PIDFILE=/opt/instances/ts_uploadprx/logs/cop.lock
> ++ TM_PIDFILE=/opt/instances/ts_uploadprx/logs/manager.lock
> ++ TS_PIDFILE=/opt/instances/ts_uploadprx/logs/server.lock
> ++ PIDFILE_CHECK_RETRIES=30
> ++ STDOUTLOG=/opt/instances/ts_uploadprx/logs/traffic_server.stdout
> ++ STDERRLOG=/opt/instances/ts_uploadprx/logs/traffic_server.stderr
> + set +x
> "
>
> And I modified 'bin/trafficserver' to load this script if it exists (after
> the other lines that source defaults files):
>
> "
> [tim@app013 ts_uploadprx]$ cat -n bin/trafficserver|grep -P "\s+143"
> 142
> 143 test -f /opt/instances/ts_uploadprx/ts-defaults && .
> /opt/instances/ts_uploadprx/ts-default
> "
>
> Upon starting trafficserver up, I can see the 'bin/trafficserver' script get
> my new environment variables from my 'ts-defaults' script and everything
> starts, but I notice only 'traffic_cop' runs under the correct instance dir
> and settings and that 'traffic_manager' and 'traffic_server' run out of the
> '/opt/tools/trafficserver3' "Binary package" path, causing logs, configs, etc
> to be loaded from the "Binary Package" path and not my "Instance Package"
> path and in general nothing works, and the unique settings are not loaded:
traffic_cop looks at the proxy.config.manager_binary and
proxy.config.proxy_binary to figure out where traffic_manager and
traffic_server are. If you set these configuration paths in the appropriate
records.config, does it help?
J