Select your cookie preferences

We use essential cookies and similar tools that are necessary to provide our site and services. We use performance cookies to collect anonymous statistics, so we can understand how customers use our site and make improvements. Essential cookies cannot be deactivated, but you can choose “Customize” or “Decline” to decline performance cookies.

If you agree, AWS and approved third parties will also use cookies to provide useful site features, remember your preferences, and display relevant content, including relevant advertising. To accept or decline all non-essential cookies, choose “Accept” or “Decline.” To make more detailed choices, choose “Customize.”

Connecting to Memached Cache Nodes Manually

Focus mode
Connecting to Memached Cache Nodes Manually - Amazon ElastiCache

If your client program does not use Auto Discovery, it can manually connect to each of the Memcached cache nodes. This is the default behavior for Memcached clients.

You can obtain a list of cache node hostnames and port numbers from the AWS Management Console. You can also use the AWS CLI aws elasticache describe-cache-clusters command with the --show-cache-node-info parameter.

Example

The following Java code snippet shows how to connect to all of the nodes in a four-node cache cluster:

... ArrayList<String> cacheNodes = new ArrayList<String>( Arrays.asList( "mycachecluster.fnjyzo.0001.use1.cache.amazonaws.com:11211", "mycachecluster.fnjyzo.0002.use1.cache.amazonaws.com:11211", "mycachecluster.fnjyzo.0003.use1.cache.amazonaws.com:11211", "mycachecluster.fnjyzo.0004.use1.cache.amazonaws.com:11211")); MemcachedClient cache = new MemcachedClient(AddrUtil.getAddresses(cacheNodes)); ...
Important

If you scale up or scale down your cache cluster by adding or removing nodes, you will need to update the list of nodes in the client code.

PrivacySite termsCookie preferences
© 2025, Amazon Web Services, Inc. or its affiliates. All rights reserved.