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

I installed the Couchbase Server 4.0 AMIs on Amazon Web Services and it looks like its running ok.

I created a Swift iOS 9 iPhone app (I have attached my Couchbase swift code) and I created the database, create a document, save it. I also have the Replication Running for push and pull.

Server URL: (changed some of the ip numbers)
http://ec2-01-28-371-452.compute-1.amazonaws.com/relist

All records are saved fine on the local database but none of them are synced to the Couchbase Server on Amazon.

Any help is greatly appreciated, am I using the wrong server url? Not getting any errors. How do you check if the Sync gateway is running on Amazon, I did not see it on the control panel.

Thank you

Just try an HTTP GET to the server root URL, i.e. using curl, and look for a JSON response something like this:

$ curl http://example.com/
{"couchdb":"Welcome","vendor":{"name":"Couchbase Sync Gateway","version":1},"version":"Couchbase Sync Gateway/()"}

You can also GET the database URL and the JSON should be something like:

$ curl http://example.com/dbname/
{"committed_update_seq":64,"compact_running":false,"db_name":"dynamo","disk_format_version":0,"instance_start_time":1445967000886600,"purge_seq":0,"update_seq":64}

Tried curl on both server and server/db link with port 4984, 80,11211 but receive Operation timed out.

On port 11215, 11214 it refused connection.

On port 8092
http://ec2-01-28-371-452.compute-1.amazonaws.com:8092
{“couchdb”:“Welcome”,“version”:"",“couchbase”:“4.0.0-4051-community”}

On port 8092
http://ec2-01-28-371-452.compute-1.amazonaws.com:8092/mylist/
{“error”:“not_found”,“reason”:“missing”}

For some reason now it does not find the mylist DB.

Port 8092 is for Couchbase Server view queries; that’s not Sync Gateway.

Make sure that the AMI you installed explicitly says that it includes and runs Sync gateway. I know very little about this area, but I thought that SG still wasn’t part of the default image.

That must be it. I went back and looked at the AMI and it says Couchbase Server 4.0 Community Edition but nothing about Sync Gateway.

I will research to see how to install the Sync Gateway with the current Couchbase Server.

Thanks for the help.

@traun, any advice here?

So far I have not found any information on how to install the Couchbase Sync Gateway on the current Couchbase Server 4.0 hosted on Amazon. Do I need to setup a new Server for the Sync Gateway or?

Thanks.

Update:

I have installed a new Amazon Server with Couchbase Sync Gateway. I also still have the other Amazon Server Couchbase Server 4.0.

I connected via ssh into the Couchbase Sync Gateway and I looked at the documentation on Connecting a Sync Gateway to Coucbase Server at http://developer.couchbase.com/documentation/mobile/1.1.0/develop/guides/sync-gateway/running-sync-gateway/connecting-sync-gateway-to-couchbase-server/index.html

Unfortunately I do not see how you connect the Sync Gateway to the Couchbase Server.

Thanks.

http://developer.couchbase.com/documentation/mobile/1.1.0/develop/guides/sync-gateway/configuring-sync-gateway/config-properties/index.html

Thanks, that helped.

I logged into the Amazon AMI Couchbase Sync Gateway via ssh and type in the commands at that page but the file is not found. I am wondering if the AMI has something different…

At the terminal I type sync_gateway or ./sync_gateway but error says “No such file or directory”

Below is the results from connecting to sync gateway server via ssh and running the ./sync_gateway command to start it.

   __|  __|_  )
   _|  (     /   Amazon Linux AMI
  ___|\___|___|

https://aws.amazon.com/amazon-linux-ami/2015.09-release-notes/
[ec2-user@ip-275-20-25-00 ~]$ ./sync_gateway
-bash: ./sync_gateway: No such file or directory
[ec2-user@ip-172-31-41-13 ~]$ dir
config.json sync_gateway.rpm

I come from a Windows background some of this still is very new to me and not sure why it does not find the sync_gateway since it shows it there.

Thanks.

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