2016-08-14

Hi,

I'm new to Couchbase and I've gone through tutorials to try to learn how to use Couchbase Lite with Sync Gateway and Couchbase Server. My CRUD operations are working fine and I'm able to create a document and store it in the local Couchbase Lite database, but I am unable to push a document to the walrus server let alone Couchbase Server.

I'm running Couchbase Lite from Xamarin for Visual Studio on Windows and I have the latest Couchbase Lite 1.3.0. update.

Here's my C# code - I'm calling StartReplications from the OnCreate method:

Uri syncGatewayURI = new Uri("http://127.0.0.1:4984/db");

Here's my serviceconfig.json file:

{
"log": ["CRUD+", "REST+", "Changes+", "Attach+"],
"adminInterface": "127.0.0.1:4985",
"interface": "0.0.0.0:4984",
"databases": {
"db": {
"server": "walrus:data",
"sync":
function(doc){
channel(doc.channels);
},
"users": {
"GUEST": {"disabled": true, "admin_channels": ["*"]}
}
}
}
}

Here's the section of my logs that shows the errors:

Thread started: #7
08-13 22:18:30.664 D/Mono (19876): [0xb89144e8] worker starting
[0:] INFO) SYNC (Replication): [9] 2016-8-13 10:18:30.664-05:00 Attempting to start puller (5016c5c3-5932-43e1-94b8-e045e4db6b03)
[0:] INFO) SYNC (Replication): [9] 2016-8-13 10:18:30.670-05:00 Attempting to start pusher (d264b8ac-a1f9-4521-8b28-b9a8ecec32e8)
[0:] INFO) SYNC (NetworkReachabilityManager): [9] 2016-8-13 10:18:30.766-05:00 Didn't get successful connection to http://127.0.0.1:4984/db
[0:] INFO) SYNC (Replication): [9] 2016-8-13 10:18:30.779-05:00 Remote endpoint is not reachable, going offline...
[0:] INFO) SYNC (Replication): [9] 2016-8-13 10:18:30.785-05:00 Error set during replication (application may continue):
System.Net.WebException: Error: ConnectFailure (Connection refused) ---> System.Net.Sockets.SocketException: Connection refused
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x000cb] in /Users/builder/data/lanes/3540/1cf254db/source/mono/mcs/class/System/System.Net.Sockets/Socket.cs:1313
at System.Net.WebConnection.Connect (System.Net.HttpWebRequest request) [0x0019b] in /Users/builder/data/lanes/3540/1cf254db/source/mono/mcs/class/System/System.Net/WebConnection.cs:195
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x0005e] in /Users/builder/data/lanes/3540/1cf254db/source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:1005
at System.Net.HttpWebRequest.GetResponse () [0x0000e] in /Users/builder/data/lanes/3540/1cf254db/source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:1019
at Couchbase.Lite.NetworkReachabilityManager.CanReach (System.String remoteUri, TimeSpan timeout) [0x00000] in /Users/jenkins/jenkins/workspace/couchbase-lite-net-build@2/1.3.0/Android/couchbase-lite-net/src/Couchbase.Lite.Shared/Util/ArraySegment.cs:194
[0:] INFO) SYNC (Replication): [9] 2016-8-13 10:18:30.830-05:00 NotifyChangeListeners (0/0, state=Running (batch=0, net=0))
[0:] INFO) SYNC (Replication): [9] 2016-8-13 10:18:30.873-05:00 Beginning replication process...
[0:] INFO) SYNC (NetworkReachabilityManager): [9] 2016-8-13 10:18:30.876-05:00 Didn't get successful connection to http://127.0.0.1:4984/db
[0:] INFO) SYNC (Replication): [9] 2016-8-13 10:18:30.882-05:00 Remote endpoint is not reachable, going offline...
[0:] INFO) SYNC (Replication): [9] 2016-8-13 10:18:30.886-05:00 Error set during replication (application may continue):
System.Net.WebException: Error: ConnectFailure (Connection refused) ---> System.Net.Sockets.SocketException: Connection refused
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x000cb] in /Users/builder/data/lanes/3540/1cf254db/source/mono/mcs/class/System/System.Net.Sockets/Socket.cs:1313
at System.Net.WebConnection.Connect (System.Net.HttpWebRequest request) [0x0019b] in /Users/builder/data/lanes/3540/1cf254db/source/mono/mcs/class/System/System.Net/WebConnection.cs:195
--- End of inner exception stack trace ---
at System.Net.HttpWebRequest.EndGetResponse (IAsyncResult asyncResult) [0x0005e] in /Users/builder/data/lanes/3540/1cf254db/source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:1005
at System.Net.HttpWebRequest.GetResponse () [0x0000e] in /Users/builder/data/lanes/3540/1cf254db/source/mono/mcs/class/System/System.Net/HttpWebRequest.cs:1019
at Couchbase.Lite.NetworkReachabilityManager.CanReach (System.String remoteUri, TimeSpan timeout) [0x00000] in /Users/jenkins/jenkins/workspace/couchbase-lite-net-build@2/1.3.0/Android/couchbase-lite-net/src/Couchbase.Lite.Shared/Util/ArraySegment.cs:194
[0:] INFO) SYNC (Replication): [9] 2016-8-13 10:18:30.897-05:00 NotifyChangeListeners (0/0, state=Running (batch=0, net=0))
[0:] INFO) SYNC (Replication): [9] 2016-8-13 10:18:31.165-05:00 Beginning replication process...

Later on in my logs I found something related to a System.AggregateException:

[0:] WARN) SYNC (RemoteSession): [6] 2016-8-13 10:18:38.193-05:00 Http Message failed to send, or got error response, passing to callback... http://127.0.0.1:4984/db/_local/d42e4cc12c98f5546f34c0a4dd9fa7f07a56374c, :
System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.AggregateException: One or more errors occurred. ---> System.Net.WebException: Error: ConnectFailure (Connection refused) ---> System.Net.Sockets.SocketException: Connection refused
at System.Net.Sockets.Socket.Connect (System.Net.EndPoint remoteEP) [0x000cb] in /Users/builder/data/lanes/3540/1cf254db/source/mono/mcs/class/System/System.Net.Sockets/Socket.cs:1313
at System.Net.WebConnection.Connect (System.Net.HttpWebRequest request) [0x0019b] in /Users/builder/data/lanes/3540/1cf254db/source/mono/mcs/class/System/System.Net/WebConnection.cs:195
--- End of inner exception stack trace ---

I've looked around and took other steps to ensure nothing else besides my connection was wrong. I've checked out the topic here:

Persistent data with walrus Couchbase Lite

I didn't understand if i can have data persistency using the default database walrus or if i'm forced to install couchbase server.

According to the guide in the website, it is possible by writing "walrus:data" in the serviceconfig.json to get a small persistent database.

Using grocery-sync example it worked well and i had a file inside the "data" folder. Now i'm developing a small project of mine, i don't know what i've done and that file is disappeared and i don't have persistence.

This …

and made sure that the data directory exists where I am running sync_gateway and that my user account has write access to the directory. It didn't exist for me, so I added in the directory:


My Sync Gateway is also running properly and I'm able to view the admin port:



walrus.PNG748x346 10.4 KB

Going to http://127.0.0.1:4984/db/ in the browser gives me this:

db.PNG1411x121 3.48 KB

How do I resolve this connection issue?

Show more