How to configure a standalone SCSP proxy

When initially installed with the caringo-install.sh script , the standalone SCSP proxy is not fully operational.
 
The configuration options are available in the proxy documentation so I will not belabor that here.   There are a few necessary steps to get a standalone proxy installation viable in your environment.
 
First, the /etc/caringo/scspproxy/ directory includes configuration samples but these examples but not live files.
 
hosts.cfg.sample
scspproxy.cfg.sample
 
To make functional configuration files, simple copy them without the ".sample" extension:
 
root@c-csn1-proxy1:/etc/caringo/scspproxy>cp scspproxy.cfg{.sample,}
root@c-csn1-proxy1:/etc/caringo/scspproxy>cp hosts.cfg{.sample,}
 
There is nothing required to configure in the hosts.cfg file, just leave it empty.
 
Looking at the /etc/caringo/scspproxy/scspproxy.cfg file, you will notice a few options that must be configured to make the proxy aware of the Swarm cluster.
 
In the [scsp] section you have a parameter called "hosts".  If you have static Swarm node IPs, you can fill one or more of these here (space separated).
 
Like:
[scsp]
#list of castor nodes to be used with --staticlocator option
hosts = 192.168.201.84
 
If you want the proxy to use avahi-browse to locate the available Swarm nodes, do NOT fill in the hosts parameter. Use the clusterName parameter, like:
 
clusterName = cluster.example.com
 
This assumes that avahi-browse is configured and active on this proxy.  This also assumes that the proxy has an interface on the Swarm VLAN.
 
If you are unclear whether avahi-browse is working and whether you are seeing Swarm nodes, you can type:
 
avahi-browse -tr _scsp._tcp
 
If you get nothing returned, check to see if iptables is active:
iptables -S
 
A default CentOS build has iptables active and this will block avahi.
 
Also, verify the service called messagebus is active:
 
service messagebus status
 
Once you think you have these parameters set correctly, start the proxy service:
 
service scspproxy start
 
and then check the status:

service scspproxy status
 
If the status is up, great.  Verify that your proxy is seeing your configured Swarm nodes.  You may need to change forceReportHosts to True (restart scspproxy service) to get the following to work.  Alternatively, you can curl the private side IP of the scsp proxy instead of 127.0.0.1.
 
curl 127.0.0.1
 
This should return the list of nodes from your "hosts" parameter or from avahi-browse via the clusterName.
 
You may then test the proxy by writing a sample stream through the proxy.    Write to the outside interface IP of the proxy (I will use 10.1.1.64 in the example below):
 
curl -v --post301 --data-binary "hello world" "10.1.1.64?alias=yes" -D header.txt
 
Assuming your cluster doesn't require a domain (enforceTenancy=true in your cluster.cfg) that should write a stream to the cluster and show you that you used the proxy:
 
< X-Forwarded-For: c-csn1-proxy1
< X-Forwarded-Server: c-csn1-proxy1
Scsp-Proxy-Agent: ScspProxyService/8.2.1
 
That means you have a fully functional proxy.
 
Next, let's change a couple configuration parameters to enable logging and log rotation.  By default, logging is to localhost and CentOS is not setup to capture these logs in a default log location.
 
This FAQ will only describe how to setup logging to the local proxy, but you can easily setup logging to an external log location by following the proxy documentation.
 
I like to log to the location: /var/log/caringo/ just like on a CSN.  To do that, you need to first create that directory:
 
mkdir -p /var/log/caringo
 
Next, change the log level in the scspproxy.cfg file to something besides 40.  40 is not much information at all.  Let's change to 30 at a minimum:
 
[log]
#<10 = CHATTER, which includes twisted.internet logs
#10 = DEBUG - Turns on detail message handling logs
#20 = INFO - Turns on request and response echo and connection pool logging
#40 = ERROR - Turns on error logging
level = 30
 
In the [log section], comment out the "host" line:
[log]
#host = localhost
 
Then include:
file = /var/log/caringo/scspproxy.log
 
That will log the file locally to that location.  Since we created the directory already, that will be enough to log the file to scspproxy.log.
 
To pick up these changes, type:
 
service scspproxy restart
 
Next, we want to ensure that we are rotating that log file.
 
Verify that /etc/logrotate.conf has:
include /etc/logrotate.d
 
Then, create the file called: /etc/logrotate.d/caringo-scspproxy with the following parameters:
 
#
# SCSP Proxy logrotate.d file
#
#
/var/log/caringo/scspproxy.log {
        daily
        rotate 20
        size 512M
        compress
        missingok
        copytruncate
}
 
You may use what values you like in here, but I keep 20 days minimum and rotate daily.  It only rotates as necessary. 
 
That should complete your standalone proxy configuration.


© DataCore Software Corporation. · https://www.datacore.com · All rights reserved.