Table of Contents | |||
Long Term Support Stable, tested ServerTemplate assets |
|
To set up a Memcached server in a public or private cloud environment.
The following are prequisites for completing this tutorial:
This tutorial describes the steps for launching one or more Memcached servers in the cloud. A Memcached server offloads traffic from your database by allowing your applications to access commonly used objects from the Memcached server instead of the database server. The RightScale Memcached ServerTemplate allows you to deploy Memcached servers where needed.
In the following architecture example diagram, the application servers can still make writes to the database, but many commonly used objects will be retrieved from one of the Memcached servers instead of the Master-DB server.
You must configure your applications to connect to a Memcached server.
Currently, the Memcached ServerTemplate does not contain scripts to connect to either an application or database tier. However, there are a number of Memcached-specific tags that can be used by a script to connect to the Memcached server so you could configure the application servers to query for the memcached server using the tags below to establish connections.
Example
Alternatively, you could also configure the application servers to connect to the Memcached server(s) using a DNS A record. After you launch the Memcached server later in the tutorial, you can create a DNS record that points to the private IP address of the Memcached server (assuming the application servers can establish a connection using the private IP network).
If the cloud supports security groups (e.g. AWS EC2) you must create a security group with the appropriate firewall permissions.
Follow these steps to add a memcached server to the deployment.
The next step is to define the properties of your Memcached server or servers by entering values for inputs. As a best practice, you should define required inputs for the servers at the deployment level. For a detailed explanation of how inputs are defined and used in Chef recipes and RightScripts, see Inputs and their Hierarchy.
To enter inputs for the Chef recipes that will run on your Memcached servers, open the deployment's Inputs tab, click Edit, and use the following settings to configure input values. We recommend that you set up credentials for password values and any other sensitive data as shown in the examples.
Input Name | Description | Example Value |
SSL Certificate | Specify the SSL Certificate to enable authentication with stunnel. Should contain both certificate and key. Certificate should be provided for both the Clients and the Logging Server. | cred:LOGGING_SSL_CRED |
Logging Protocol | Protocol used to send logging messages from client to server. | text: udp |
Remote Server | Configures an instance to forward its log data to a remote server. Specify either the remote server's FQDN or IP address. | text: syslog.example.com or 192.168.0.1 |
Input Name | Description | Example Value |
Memcached connection limit | Option to either reduce the number of connections (to prevent overloading memcached service) or to increase the number making more effective use of the server running memcached. | text: 1024 |
Memcached listening interface | Interface used for memcached connections. | text: any |
Memcached Cache size percentage | Set the amount of memory allocated to memcached for object storage in percentage from total system memory. | text: 90 |
Memcached TCP Port | The TCP port to use for connections. | text: 11211 |
Memcached used threads | The number of threads to use when processing incoming requests. | text: 1 |
Memcached UDP Port | The UDP port to use for connections. | text: 11211 |
Memcached user | The user for executing Memcached. Use one of the users that is preconfigured at boot time.
| text: nobody |
Memcached cluster_id | Used to associate an application server with a memcached cluster. | text: cache_cluster |
Memcached logging output level | Without the verbose options, Memcached normally produces no output during normal operating. | text: off |
Input Name | Description | Example Value |
Process List | A space-separated list of additional processes to monitor in the RightScale Dashboard. | text: sshd crond |
Process Match List | A space-separated list of pairs used to match the name(s) of additional processes to monitor in the RightScale Dashboard. Paired arguments are passed in using the following syntax 'name/regex'. | text: ssh/ssh* cron/cron* |
Input Name | Description | Example Value |
Firewall | Enables an iptables firewall for this server which allows port 22, 80 and 443 open by default. Use the 'sys_firewall::setup_rule' recipe to enable/disable extra ports.
| text: enabled |
If the applications servers are connecting to the Memcached server using a DNS record, update the DNS record with the private IP address of the Memcached server.
If the cloud (of the Memcached server) does not support security groups you must use iptables to create the necessary firewall rule that will allow the application servers to connect to the Memcached server over the specified Memcached ports. If you are using the ServerTemplate's default settings, you must create two firewall rules for TCP port 11211 and UDP port 11211.
Now that the Memcached server is operational and configured to accept requests from its related application servers, launch a few application servers and test their connections to the Memcached server.
© 2006-2014 RightScale, Inc. All rights reserved.
RightScale is a registered trademark of RightScale, Inc. All other products and services may be trademarks or servicemarks of their respective owners.