Sync Gateway does not save new databases added by REST API


#1

Hello,

I am using the Rest API to create a new entry in the Sync Gateway.

I started the gateway by this command:

sync_gateway.exe -adminInterface=":4985" -interface=":80" -url=“walrus:data” -verbose=“true”

data/sync_gateway.walrus has been created.

Now I use the REST API to create a new database:

curl -X PUT -H “Content-Type: application/json” -d “{ “server”: “http://192.168.200.162:8091/”, “sync”: “function(doc) { channel(doc.channels); }”, “bucket”: “new-bucket” }” http://localhost:4985/new-bucket-sync/

On first try I always get this error:

12:47:26.104660 HTTP: #022: PUT /new-bucket-sync/ (ADMIN)
12:47:26.104660 Opening db /new-bucket-sync as bucket “new-bucket”, pool “default”, server http://192.168.200.162:8091/
12:47:26.105160 Opening Couchbase database new-bucket on <http.//192.168.200.162:8091/>
12:47:26.293698 WARNING: Error from Incr in lastSequence(): MCResponse status=DELTA_BADVAL, opcode=INCREMENT, opaque=0, msg: Non-numeric ser
ver-side value for incr or decr – db.(*sequenceAllocator).lastSequence() at sequence_allocator.go:34
12:47:26.294198 HTTP: #022: --> 502 Non-numeric server-side value for incr or decr (DELTA_BADVAL) (189.5 ms)

{“error”:“Bad Gateway”,“reason”:“Non-numeric server-side value for incr or decr (DELTA_BADVAL)”}

And when doing it again the database is created successfully.

Anyway… after restarting the sync gateway this bucket is lost. data/sync_gateway.walrus does not mention “new-bucket” anywhere. Even if change the database to save to data/, it will not be loaded after restart.

So whats wrong?


#2

Hi,

The following Json:

"server": "http://192.168.200.162:8091/"

is used to create a new database on a Couchbase server accessible on http://192.168.200.162:8091/.

If you want to use walrus, you should replace it by

"server" : "walrus:data"

Cheers