A newer version of this documentation is available.

View Latest

Command Line Options


    To configure Sync Gateway, you can specify command-line options when you start Sync Gateway. Command-line options can only specify a limited set of configuration properties, and cannot be used to configure multiple databases. For more comprehensive configuration, use a JSON configuration file. For information about using a configuration file, see the configuration file guide.

    Configuration determines the runtime behavior of Sync Gateway, including server configuration and the database or set of databases with which a Sync Gateway instance can interact.

    You can only specify a small subset of configuration properties as command-line options. Two command-line options do not have corresponding configuration properties: -help and -verbose.

    When specifying command-line options, the format of the sync_gateway command is:

    sync_gateway [command-line options]

    Command-line options

    You can prefix command-line options with one hyphen (-) or with two hyphens (--). For command-line options that take an argument, you specify the argument after an equal sign (=), for example, -bucket=db, or as a following item on the command line, for example, -bucket db. Command-line options are case-insensitive. Here we use lower camel case.

    Deprecation Notice
    The -bucket command line option is deprecated at Release 2.7. It will be removed in Release 2.10. Instead, use the JSON configuration file option bucket — see $dbname.bucket

    Following are the command-line options that you can specify when starting Sync Gateway.

    Option Default Description


    Port or TCP network address (IP address and the port) that the Admin REST API listens on.



    Deprecated Name of the Couchbase Server bucket.



    Name of the Couchbase Server database to serve through the Public REST API.



    Path to log files, as a fallback default value when logFilePath is not specified. This option is generally used in service scripts.



    Lists the available options and exits.



    Port or TCP network address (IP address and the port) that the Public REST API listens on.



    Comma-separated list of log keywords to enable. The log keyword HTTP is enabled by default, which means that HTTP requests and error responses are always logged. Omitting HTTP from your list does not disable HTTP logging. HTTP logging can be disabled through the Admin API.



    Path to log files.



    Name of the Couchbase Server pool in which to find buckets.



    Pretty-print JSON responses to improve readability. This is useful for debugging, but reduces performance.



    URL of the database server. (Deprecated) An HTTP URL implies Couchbase Server. A walrus: URL implies the built-in Walrus database. A combination of a Walrus URL and a file-style URI (for example, walrus:///tmp/walrus) implies the built-in Walrus database and persisting the database to a file.


    Non-verbose logging

    Logs more information about requests.


    The following command does not include any parameters and just uses the default values. It connects to the bucket named sync_gateway in the pool named default of the built-in Walrus database. It is served from port 4984, with the Admin interface on port 4985.

    $ sync_gateway

    The following command creates an ephemeral, in-memory Walrus database, served as db, and specifies use of pretty-printed JSON responses. Because Walrus is the default database, the option -url could be omitted.

    $ sync_gateway -url=walrus: -bucket=db -pretty

    The following command starts Sync Gateway and specifies the address of a Couchbase Server instance (instead of using the default database server, which is Walrus):

    $ ./sync_gateway -url http://cbserver:8091

    The following command accomplishes the same things as the prior command, persists the Walrus database to a file named /tmp/walrus/db.walrus, and turns on additional logging for the log keys HTTP+ and CRUD.

    $ sync_gateway -url=walrus:///tmp/walrus -bucket=db -log=HTTP+,CRUD