How to connect to Couchbase Server (AMI) on Amazon?

What you see there is an RPM package. It’s a redhat package installer. You need to install it.

Yea, I tried it but it says it’s installed and nothing to update.

sudo yum install ./sync_gateway.rpm
Loaded plugins: priorities, update-motd, upgrade-helper
Examining ./sync_gateway.rpm: couchbase-sync-gateway-1.1.0-28.x86_64
./sync_gateway.rpm: does not update installed package.
Error: Nothing to do

Thanks.

In that case sync_gateway should be installed in one of the normal Linux places, like /usr/bin or /usr/local/bin. One more mysterious thing that can cause this error message is if you are trying to run on a 32-bit system (The command uname -m will tell you, a 64-bit OS will output x86_64)

I used the Amazon AMI Couchbase Sync Gateway image and I think it has issues :smile: I am going to delete this server and try to re-create. If that does not work I think I will create a VM and install it manually.

Thanks.

Finally found where the sync_gateway is on the AMI… /opt/couchbase-sync-gateway/bin/sync_gateway

Sync Gateway is now running with below command line, but when my iOS app tries to connect to Sync Gateway Server to start Replication the connection is refused…lol I checked the Ports and they are open on the firewall.

Sync Server but with curl it gives Connection Refused.
Bucket currently has no password
http://ec2-01-23-456-009.compute-1.amazonaws.com:4984

Sync Gateway Command (fyi)
/opt/couchbase-sync-gateway/bin/sync_gateway -url=http://ec2-01-28-371-452.compute-1.amazonaws.com:8091 -interface=:4984 -bucket=sync_gateway -dbname=mylist

Any thoughts on my when I try to reach the sync gateway server it would refuse connection?
Thanks

If your app is running on iOS 9, the problem is probably on the client side — iOS 9 won’t allow an app to make an insecure (http:) connection by default. In the long run you should use SSL; in the short term you can add a key to the Info.plist to bypass the error. (Look up App Transport Security; Apple has a technote with the details.)

What is the exact output of the curl command that fails?

Hi Marco,

I went through the whole process of getting it working, which was a pretty bumpy ride … (we need to do some serious improvements here!). I wrote up a README here:

I think the main change you need to make is to use -interface=0.0.0.0:4984 rather than -interface=:4984. In my testing, using -interface=:4984 only listened on localhost.

Let me know if it works!

Thanks Traun! Can you make sure this info gets incorporated into our docs, and/or attached to the AMI image, so future users will find it?

Already on it! https://issues.couchbase.com/browse/DOC-919

That is awesome, I really appreciate it. I will make the necessary changes and updated once I know its working.

Regarding iOS 9 I already have the App Transport Security open to all URL’s.

  • Changing to -interface=0.0.0.0:4984 allows connection to Sync Gateway… but :smile:

  • When I try to add records from iOS 9 app I receive error:
    22:16:29.160‖ WARNING: CBLSocketChangeTracker[0x7f922a3ac2e0 ]: Can’t connect, giving up: Error Domain=CBLHTTP Code=404 “404 not_found” UserInfo={NSURL=http://ec2-01-23-456-009.compute-1.amazonaws.com:4984/_changes?feed=normal&heartbeat=300000&style=all_docs, NSLocalizedFailureReason=not_found, NSLocalizedDescription=404 not_found}

Show I delete and recreate the Sync Gateway AMI image?
In my scenarios I have one AMI for Couchbase Server 4.0 and once server AMI for Sync Gateway. The Sync Gateway connects to the remote Couchbase Server.

Thank you for the help.

  1. That’s a redirect asking you to append a “/” to the URL.
  2. You didn’t put a database name in the replication URL.

Yea… :slight_smile: Its working… Thank you guys very much for the help.

A question on the sync_gateway commands. At this point I am using the -dbname for the app I am using. Let’s say I would like to use multiple databases to sync with Couchbase Server. Do I pass multiple DB’s names for the sync_gateway or should the -dbname default to sync_gateway?

/opt/couchbase-sync-gateway/bin/sync_gateway -url=http://ec0-00-00-000-123.compute-1.amazonaws.com:8091/ -interface=0.0.0.0:4984 -bucket=sync_gateway -dbname=relist

You can use a configuration file to specify multiple databases as specified in the documentation

Great. I will create a config.json and upload it to sync gateway server.

Hey @marco,

Also adding in these two blogs for reference on how to get started with Couchbase AMI and setting up Sync Gateway with a Mobile application for yourself and for anyone reading up on this topic thread in the future.

Part 1 : Database on Amazon: Installing Couchbase AMI on AWS
Part 2 : Database on Amazon: Connecting Couchbase Sync Gateway to Couchbase AMI on AWS

@sweetiewill Thanks for adding the detailed info on the blog.

ps: I am also setting up the new Azure Virtual Machine (not Classic but the new suggested Resource Manager VM ) Couchbase Server and Sync Gatway on the same Virtual Machine.

Just a suggestion for a similar blog for the new Azure VM Resource Manager Couchbase Sync Gateway setup :smile:
ps: There is an older blog on Azure but uses the Classic VM.

Thanks.

Cool! Let us know how that goes @marco and thanks for the suggestions :grinning: Will investigate and keep you posted!

I have the Azure VM (Resource Manager) setup with Couchbase Server 4.0 and Sync Gateway 1.1 running.

So far its working great. Love it. Everyone that is involved with Couchbase has done an incredible job. I am starting to use it for our Mobile and Web apps. The offline sync and attaching blobs are key features in our decision.