How to Setup Clustered Cache!

Vangerwen

File Master
File Master
Dec 28, 2012
345
6
16
Narnia
Step 1: Firstly you need to choose yourself a port different from what you csp is using,for the cache which must be forwarded in your router and instead of tcp define it as a udp port lets say for example "15000 "

Step 2: make sure you forward this port in UDP to your CSP Server's ip address,

Step 3: in your proxy xml file locate this :

PHP:
<cache-handler class="com.bowman.cardserv.DefaultCache">
<cache-config>
<cw-max-age>14</cw-max-age>
<max-cache-wait>11</max-cache-wait>
</cache-config>
</cache-handler>


It is normally near the bottom of the xml file, don?t worry if its not exactly the same, now you are going to delete all of that and replace it, I will show with what shortly.

Step 4: you need to locate where your csp is kept, for example mine is /usr/local/csp
there also should be a cache directory, you need to open that and make a file just called " cluster "

Step 5: open / edit the new file ( cluster ) you made, in there will go your dns and port that you forwarded earlier ... ie myserver.homelinux.net :15000
also if someone has already given you details to exchange cache that would go on the next line

So you would have a file that looks like:

myserver.homelinux.net :15000
frie$$$.dyndns.addy :30001

Save that file and if any other cache exchange lines are given to you they will go in there as well.

Step 6: You will need to chmod the new file ie chmod 755 /usr/local/csp/cache/cluster or whatever path your csp is in.

Step 7: This will be the replacement part of the xml file that you have deleted as of step 3
now remember the udp port you have forwarded also your dns you put in the cluster file and also the path where the cluster file is.

PHP:
<cache-handler class="com.bowman.cardserv.ClusteredCache">
<cache-config>
<cw-max-age>11</cw-max-age>
<max-cache-wait>150ms</max-cache-wait>
<local-host>myserver.homelinux.net </local-host>
<local-port>15000</local-port>
<tracker-url>file:///usr/local/csp/cache/cluster</tracker-url>
<tracker-update>1</tracker-update>
<sync-period>5</sync-period>
<hide-names>true</hide-names>
<debug>true</debug>
</cache-config>
</cache-handler>


Save the xml - " save changes "

Step 8: Restart your CSP Proxy

That's all

To check if it works , go to Status page and you should see Cache-Handler: com.bowman.cardserv.ClusteredCache

Click on it and it opens up. you should see something like the example below:


avg-received-bytes/s: 113
avg-sent-bytes/s: 292
cache-peers: 3
cached-ecms: 73
instant-hits: 893
pending-ecms: 6
received-cached: 37926
received-discarded: 15322
received-pending: 30190
remote-hits: 533
sent-cached: 15895
sent-pending: 17336
timeouts: 443
tracker-failures: 0
wait-hits: 1225