How to create sync-gateway with multiple channels


#1

Hi ,
i have installed standalone couchbase server and sync gateway on same server
i have started the sync-gateway.json file with multiple channels .
when i start the syn-gateway with below config file i see an error.

{
“log”: [""],
“databases”: {
“db”: {
“server”: “http://localhost:8091”,
“bucket”: “Bucket1”,
“username”: “test”,
“password”: “syncgt”,
“enable_shared_bucket_access”: true,
“import_docs”: “continuous”,
“users”: { “GUEST”: { “disabled”: false, “admin_channels”: ["
"] } },
“sync”: function (doc, oldDoc) { if (doc.sdk) { channel(doc.sdk); } }
}
}
},
{
“log”: [""],
“databases”: {
“sales_db”: {
“server”: “http://localhost:8091”,
“bucket”: “Bucket1”,
“username”: “test”,
“password”: “syncgt”,
“enable_shared_bucket_access”: true,
“import_docs”: “continuous”,
“users”: { “GUEST”: { “disabled”: false, “admin_channels”: ["
"] } },
“sync”: function (doc, oldDoc) { if (doc.sdk) { channel(doc.sdk); } }
}
}
},
{
“log”: [""],
“story_db”: {
“db”: {
“server”: “http://localhost:8091”,
“bucket”: “Bucket1”,
“username”: “test”,
“password”: “syncgt”,
“enable_shared_bucket_access”: true,
“import_docs”: “continuous”,
“users”: { “GUEST”: { “disabled”: false, “admin_channels”: ["
"] } },
“sync”: function (doc, oldDoc) { if (doc.sdk) { channel(doc.sdk); } }
}
}
},

accesslog file :slight_smile: 2018-09-07T00:21:14.826Z [INF] Auth: Attempting credential authentication http://localhost:8091?http_idle_conn_timeout=90000&http_max_idle_conns=64000&http_max_idle_conns_per_host=256

2018-09-07T00:21:14.830Z [INF] Successfully opened bucket

2018-09-07T00:21:14.833Z [INF] Initializing indexes with numReplicas: 1…

2018-09-07T00:21:14.847Z [INF] Query: Index sg_syncDocs_1 doesn’t exist, creating…

2018-09-07T00:21:14.850Z [ERR] Error opening database sales_db: Unable to install index syncDocs: Error installing Couchbase index: sg_syncDocs_1: Unable to create indexes with the specified number of replicas (1). Increase the number of index nodes, or modify ‘num_index_replicas’ in your Sync Gateway database config. – rest.RunServer() at config.go:902

2018-09-07T04:28:49.478Z [ERR] Error reading config file /home/sync_gateway/sync_gateway.json: invalid character ‘,’ after top-level value – rest.ParseCommandLine() at config.go:711

2018-09-07T04:28:49.828Z [ERR] Error reading config file /home/sync_gateway/sync_gateway.json: invalid character ‘,’ after top-level value – rest.ParseCommandLine() at config.go:711

2018-09-07T04:28:50.075Z [ERR] Error reading config file /home/sync_gateway/sync_gateway.json: invalid character ‘,’ after top-level value – rest.ParseCommandLine() at config.go:711

2018-09-07T04:28:50.327Z [ERR

can some correct me with my config file.


#2

As this error indicate that your config is trying to create index replicas, which is the default behaviour of SG 2.1. So you would need more than one SG for that. In case if you don’t want to create index replicas, you can add “num_index_replicas” property in SG config and set it to “0” or “null” - “num_index_replicas”:null. This will tell SG not to create index replicas.

I think this will resolve your issue.

FYI - this is a sample config

{"Interface":":4984","AdminInterface":"0.0.0.0:4985","Logging":{"log_file_path":"/home/sync_gateway/logs","console":{"enabled":true,"log_level":"info","log_keys":["HTTP"]},"error":{"rotation":{}},"warn":{"rotation":{}},"info":{"rotation":{}},"debug":{"enabled":true,"rotation":{}},"default":{}},"MaxCouchbaseConnections":16,"MaxIncomingConnections":0,"MaxFileDescriptors":90000,"CompressResponses":false,"Databases":{"db":{"server":"http://localhost:8091","pool":"default","bucket":"data-bucket","username":"data-bucket","password":"password","name":"db","session_cookie_name":"","num_index_replicas":null,"use_views":true},"db2":{"server":"http://localhost:8091","pool":"default","bucket":"data-bucket","username":"data-bucket","password":"password","name":"db2","session_cookie_name":"","num_index_replicas":null,"use_views":true}}}


#3

so i just need add this property in my sg config file ,which i have attached in my post ?


#4

Yes. I’ve provided a sample config too for reference in my post.


#5

Still after adding this property , I see the same error

Thanks

Rohith vuppala

203-900-7999


#6

can you please share your new config and the error you are seeing now?


#7

i just used your sample config and was able to start the service , but see some error
2018-09-09T16:38:36.013+00:00 [INFO] Using plain authentication for user <ud>test</ud>

2018-09-09T16:38:37.013Z [WRN] Error processing DCP stream - will attempt to restart/reconnect if appropriate: pkt.Receive, err: EOF. – base.(*DCPReceiver).OnError() at dcp_feed.go:138

2018-09-09T16:38:38.013+00:00 [INFO] Using plain authentication for user <ud>test</ud>

2018-09-09T16:38:39.013Z [WRN] Error processing DCP stream - will attempt to restart/reconnect if appropriate: pkt.Receive, err: EOF. – base.(*DCPReceiver).OnError() at dcp_feed.go:138

2018-09-09T16:38:40.014+00:00 [INFO] Using plain authentication for user <ud>test</ud>

2018-09-09T16:38:41.014Z [WRN] Error processing DCP stream - will attempt to restart/reconnect if appropriate: pkt.Receive, err: EOF. – base.(*DCPReceiver).OnError() at dcp_feed.go:138

2018-09-09T16:38:42.014+00:00 [INFO] Using plain authentication for user <ud>test</ud>

2018-09-09T16:38:43.014Z [WRN] Error processing DCP stream - will attempt to


#8

{“Interface”:":4984",“AdminInterface”:“0.0.0.0:4985”,“Logging”:{“log_file_path”:"/home/sync_gateway/logs",“console”:{“enabled”:true,“log_level”:“info”,“log_keys”:[“HTTP”]},“error”:{“rotation”:{}},“warn”:{“rotation”:{}},“info”:{“rotation”:{}},“debug”:{“enabled”:true,“rotation”:{}},“default”:{}},“MaxCouchbaseConnections”:16,“MaxIncomingConnections”:0,“MaxFileDescriptors”:90000,“CompressResponses”:false,“Databases”:{“bu_db”:{“server”:“http://localhost:8091”,“pool”:“default”,“bucket”:“Bucket1”,“username”:“test”,“password”:“testuser”,“name”:“db”,“session_cookie_name”:"",“num_index_replicas”:null,“use_views”:true},“db2”:{“server”:“http://localhost:8091”,“pool”:“default”,“bucket”:“Bucket1”,“username”:“test”,“password”:“testuser”,“name”:“db2”,“session_cookie_name”:"",“num_index_replicas”:null,“use_views”:true}}}


#9

Config looks ok, can you provide the error now you are getting?


#10

here is the error/warning:
2018-09-10T14:23:41.359+00:00 [INFO] Using plain authentication for user test
2018-09-10T14:23:42.359Z [WRN] Error processing DCP stream - will attempt to restart/reconnect if appropriate: pkt.Receive, err: EOF. – base.(*DCPReceiver).OnError() at dcp_feed.go:138
2018-09-10T14:23:43.360+00:00 [INFO] Using plain authentication for user test
2018-09-10T14:23:44.360Z [WRN] Error processing DCP stream - will attempt to restart/reconnect if appropriate: pkt.Receive, err: EOF. – base.(*DCPReceiver).OnError() at dcp_feed.go:138


#11

Hi rvuppala,
Can you check whether sync gateway is up and running? Also did you set up couchbase server and sync gateway on same machine , I see on config that server is localhost. It looks like sync gateway is not able to communicate to couchbase server. Could you let me know how the sync gateway and couchbase server set up?


#12

sridevi.saragadam
Couchbase

    September 12

Hi rvuppala,

Can you check whether sync gateway is up and running? Also did you set up couchbase server and sync gateway on same machine , I see on config that server is localhost. It looks like sync gateway is not able to communicate to couchbase server. Could you let me know how the sync gateway and couchbase server set up?


Visit Topic or reply to this email to respond.

To unsubscribe from these emails, click here.