OS X Server (Mountain Lion): Advanced configuration of the
Caching service
If you're running OS X Server (Mountain Lion), read on to
learn about the advanced settings you can use with the Caching service.
If you're running OS X Server (Mavericks), see the
"Configure advanced cache settings" section of the OS X Server
Advanced Administration Guide to learn about the Caching service's advanced
settings.
For more information about the Caching service, run the
Server app and choose Server Help from the Help menu.
You can specify advanced configuration settings for the
Caching service with the command line or by editing
/Library/Server/Caching/Config/Config.plist. The keys and description of values
are listed below.
Note: Settings in the Config.plist file not outlined below
should not be changed.
Key
|
Default
|
Description
|
CacheLimit
|
0 (unlimited)
|
The maximum number of bytes of disk space will be
used to cache assets. This can be set using Server app.
|
DataPath
|
/Library/Server/Caching/Data
|
The path to the directory used to store cached
assets. This can be set using Server app.
|
Interface
|
Listen on all interfaces
|
The BSD name of a network interface to be used by
the Caching service.
|
ListenRanges
|
None
|
An array of dictionaries used to define which
Caching servers clients on a given network will prefer. More details are
outlined below.
|
ListenRangesOnly
|
False
|
If ListenRangesOnly is set to true, it will cause
the server to provide assets only to clients in the ranges specified by the
ListenRanges key. You must specify the ListenRanges key in order to use the
ListenRangesOnly key.
|
LogLevel
|
info
|
The level of verbosity used when logging. You can
set this to any of the following:
Note: You should leave
the logging level at the default setting on a production system; there may be
a performance penalty incurred by raising it. If you do increase the logging
level above the default, the additional logging will be saved to
/Library/Server/Caching/Logs/Debug.log, and won't appear in Server app under
the Logs section.
|
MaxConcurrentClients
|
0 (allow unlimited clients)
|
The maximum allowed number of simultaneous client
requests.
|
Port
|
0 (use any port)
|
The TCP port number on which the Caching service
accepts requests for downloads.
|
ReservedVolumeSpace
|
25000000000
|
The minimum number of bytes of free disk space to be
maintained for the volume which stores the cached assets.
|
The ListenRanges key
The ListenRanges key can be used to specify preferred Caching
servers in advanced network topologies where multiple Caching servers are used
behind the same public IP address. For example:
caching1.example.com uses the ListenRanges
key to specify a range of 10.0.0.1 through 10.0.0.254 and 10.1.0.1 through
10.1.0.254.
caching2.example.com uses the ListenRanges
key to specify a range of 10.1.0.1 through 10.1.0.39 (note the overlap with
caching1's second range).
If a client whose IP address is 10.0.0.10
requests an asset, it will be directed to caching1.
If a client whose IP address is 10.1.0.10
requests an asset, it will be directed to either caching1 or caching2. The server
will be chosen randomly.
If a client whose IP address is 10.2.0.10
requests an asset, it will be directed to either caching1 or caching2. The
server will be chosen randomly.
If caching1 is shut down or loses power but
caching2 remains available, all clients will be directed to caching2.
Setting values for a
key
To set a key with a simple value, you can use the
serveradmin(8) command. For example, to set the Interface key to en1, you would
execute this command as an administrator:
sudo
serveradmin settings caching:Interface = en1
The ListenRanges key has a complex value, making it easier to
edit /Library/Server/Caching/Config/Config.plist in order to set it. If you
edit this file manually, be sure to first stop the Caching service and quit
Server app. Once you've finished editing the file, set the user and group
ownership to _assetcache prior to starting the Caching service with this
command:
sudo
chown _assetcache:_assetcache /Library/Server/Caching/Config/Config.plist
Below is an example Config.plist file.
<?xml
version="1.0" encoding="UTF-8"?>
<!DOCTYPE
plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist
version="1.0">
<dict>
<key>CacheLimit</key>
<!-- Set a CacheLimit of 200 GB -->
<integer>200000000000</integer>
<key>DataPath</key>
<string>/Volumes/BigDisk/Caching/Data</string>
<key>Interface</key>
<string>en1</string>
<key>ListenRanges</key>
<array>
<dict>
<key>type</key>
<string>IPv4</string>
<key>first</key>
<string>10.0.0.1</string>
<key>last</key>
<string>10.0.0.254</string>
</dict>
<dict>
<key>type</key>
<string>IPv4</string>
<key>first</key>
<string>10.1.0.1</string>
<key>last</key>
<string>10.1.0.254</string>
</dict>
</array>
<key>ListenRangesOnly</key>
<true/>
<key>LogLevel</key>
<string>info</string>
<key>MaxConcurrentClients</key>
<integer>100</integer>
<key>Port</key>
<integer>12345</integer>
<key>ReservedVolumeSpace</key>
<!-- Set the ReservedVolumeSpace to 1 GB
-->
<integer>1000000000</integer>
</dict>
</plist>
0 komentar:
Post a Comment