Connection timeout on AWS ec2

Hi folks,

I had one Couchbase server setup in the AWS cloud using the Couchbase marketplace, and I have no problem connect and use the database from my local machine, but once I push my web server code to another ec2 instance that connect the database node through public DNS name, it always throws time out exception, I’ve done some research around it, it seems to be a public/private IP resolving issue on Couchbase server, not sure if we have any guideline on this issue.

Thanks.

Hey @jgue,

The usual suspect when this happens is that your servers were set up using their private IPs, rather than based on static DNS entries. This causes the client to fetch addresses from the cluster which it cannot access itself. Can you perhaps run the sdk-doctor from your application server and take a look, then send us the details?

Cheers, Brett

Hi Brett,

Thanks a lot for pointing me at the sdk-doctor, here is the config I got from the diagnose

[
{
“clusterCompatibility”: 262149,
“clusterMembership”: “active”,
“couchApiBase”: “http://172.31.3.239:8092/”,
“hostname”: “172.31.3.239:8091”,
“interestingStats”: {
“cmd_get”: 0,
“couch_docs_actual_disk_size”: 9.66181e+06,
“couch_docs_data_size”: 4.694398e+06,
“couch_spatial_data_size”: 0,
“couch_spatial_disk_size”: 0,
“couch_views_actual_disk_size”: 0,
“couch_views_data_size”: 0,
“curr_items”: 0,
“curr_items_tot”: 0,
“ep_bg_fetched”: 0,
“get_hits”: 0,
“mem_used”: 5.0418392e+07,
“ops”: 0,
“vb_replica_curr_items”: 0
},
“mcdMemoryAllocated”: 3013,
“mcdMemoryReserved”: 3013,
“memoryFree”: 2.849726464e+09,
“memoryTotal”: 3.950219264e+09,
“os”: “x86_64-unknown-linux-gnu”,
“otpNode”: "ns_1@127.0.0.1",
“ports”: {
“direct”: 11210,
“proxy”: 11211
},
“recoveryType”: “none”,
“services”: [
“index”,
“kv”,
“n1ql”
],
“status”: “healthy”,
“systemStats”: {
“cpu_utilization_rate”: 8.653846153846153,
“mem_free”: 2.849726464e+09,
“mem_total”: 3.950219264e+09,
“swap_total”: 4.2949632e+09,
“swap_used”: 0
},
“thisNode”: true,
“uptime”: “106129”,
“version”: “4.5.0-2601-community”
}
]

As you have mentioned that the IP address seems to be a private IP address, so I wonder how could I make this node publicly accessible? Do I need to change the configuration somewhere or do I need to add ec2 instance in the same VPC? Thanks!