简体   繁体   中英

PouchDB - Unable to start sync gateway

I am trying to the Sync Ionic app with Couchbase and PouchDB for that I have used couchbase sync gateway.

Here is my sync-gateway-config.json

{
    "log":["CRUD+", "REST+", "Changes+", "Attach+"],
    "databases": {
        "test-database": {
            "server":"http://localhost:8091",
            "sync":`
                function (doc) {
                    channel (doc.channels);
                }
            `,
            "users": {
                "GUEST": {
                    "disabled": false,
                    "admin_channels": ["*"]
                }
            }
        }
    },
    "CORS": {
        "Origin": ["http://localhost:9000"],
        "LoginOrigin": ["http://localhost:9000"],
        "Headers": ["Content-Type"],
        "MaxAge": 17280000
    }
}

From terminal I execute the following command to start Sync Gateway :

./sync_gateway /ionic-pouchdb/sync-gateway-config.json

I got the error below:

2016-08-26T12:19:34.178+05:30 WARNING: Error installing Couchbase design doc: no available couch rest URLs -- db.installViews() at database.go:333 2016-08-26T12:19:34.178+05:30 FATAL: Error opening database: no available couch rest URLs -- rest.RunServer() at config.go:480

Appreciate for Help.

Note : i have already set up bucket in couchbase server.

Please find screenshot below:

在此处输入图片说明

{
    "log":["CRUD+", "REST+", "Changes+", "Attach+"],
    "databases": {
        "test-database": {
            "server":"http://localhost:8091",
            "bucket":"your bucket name",
            "sync":`
                function (doc) {
                    channel (doc.channels);
                }
            `,
            "users": {
                "GUEST": {
                    "disabled": false,
                    "admin_channels": ["*"]
                }
            }
        }
    },
    "CORS": {
        "Origin": ["http://localhost:9000"],
        "LoginOrigin": ["http://localhost:9000"],
        "Headers": ["Content-Type"],
        "MaxAge": 17280000
    }
}

May be you have to provide bucket name.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM