After you have downloaded and installed memcached on each Vibe Tomcat node in the cluster, as described in Section C.2, Downloading and Installing Memcached, you need to configure it on each node.
You configure memcached by adding the desired switches to the MEMCACHED_PARAMS variable.
Navigate to the etc/sysconfig directory.
Open the memcached file in a text editor.
Uncomment the MEMCACHED_PARAMS variable and add any switches that you feel are appropriate. When you uncomment the MEMCACHED_PARAMS variable, the following switches are already present:
-d: Runs as a daemon. This is recommended.
-l: Determines the interface to listen on. The default value is the localhost. You should either delete this switch with its default address (this is recommended for a simple setup), or change the default address to the address that you want memcached to listen on. For example, -l 172.17.2.3.
To see a complete list of switches that are available with memcached, type memcached -h from the command line of a machine where memcached is installed.
(Recommended) Increase the maximum memory to use for items to 1024 MB. You do this by adding the -m switch to the MEMCACHED_PARAMS variable. For example:
-m 1024
(Recommended) You should configure memcached to start automatically each time you reboot the Linux server where Vibe is running. To configure memcached to start automatically, enter the following command from the command line:
chkconfig --add memcached
To verify that automatic startup is enabled, enter the following command from the command line:
chkconfig memcached
Validate that memcached is running from the local server by typing the following command:
netstat -ap|grep memcached
After you have verified that memcached is running on the local server, log in to a remote server, then validate that memcached is running to ensure that no networking problems exist:
From the command line of a remote server, make a network connection to the server where memcached is running. For example, you can use the telnet command.
telnet 172.17.2.3 11211
Type a simple memcached command, such as stats and stats settings.
After you have verified that memcached is running as expected, type quit to exit telnet.
Following is an example of what you see:
07309:~/Desktop # telnet xxx.xxx.xxx.xx 11211 Trying xxx.xxx.xxx.xx... Connected to xxx.xxx.xxx.xx. Escape character is '^]'. stats STAT pid 2486 STAT uptime 313 STAT time 1334337169 STAT version 1.2.6 STAT pointer_size 64 STAT rusage_user 0.028001 STAT rusage_system 0.000000 STAT curr_items 10 STAT total_items 17 STAT bytes 7971 STAT curr_connections 4 STAT total_connections 6 STAT connection_structures 5 STAT cmd_get 79 STAT cmd_set 17 STAT get_hits 62 STAT get_misses 17 STAT evictions 0 STAT bytes_read 14249 STAT bytes_written 67674 STAT limit_maxbytes 67108864 STAT threads 1 END quit Connection closed by foreign host. 07309:~/Desktop #
Repeat Step 1 through Step 7 for each Vibe node in the cluster.
Continue with Section C.4, Configuring Memcached in the Vibe Installation Program.