github.com/cayleygraph/cayley@v0.7.7/docs/configuration.md (about)

     1  # Configuration
     2  
     3  Cayley can be configured using configuration file written in YAML / JSON or by passing flags to the command line. By default. All command line flags take precedence over the configuration file.
     4  
     5  * [Recommended Configuration](configuration.md#Recommended-Configuration)
     6  * [Configuration Options](configuration.md#Configuration-Options)
     7    * [Store](configuration.md#Store)
     8    * [Per-Store Options](configuration.md#Per-Store-Options)
     9    * [Query](configuration.md#Query)
    10    * [Load](configuration.md#Load)
    11  * [Configuration File Location](configuration.md#Configuration-File-Location)
    12  
    13  ## Recommended Configuration
    14  
    15  By default, Cayley is using the `memstore` store. `memstore` works best for datasets that can fit into the memory of the machine and workloads which doesn't require persistency. For large datasets and/or workloads with require persistency it is recommended to use the `bolt` store.
    16  
    17  ## Configuration Options
    18  
    19  ### Store
    20  
    21  #### **`store.backend`**
    22  
    23  * Type: String
    24  * Default: `"memory"`
    25  
    26  Determines the type of the underlying database. Options include:
    27  
    28  * `memstore`: An in-memory store, based on an initial N-Quads file. Loses all changes when the process exits.
    29  
    30  **Key-Value backends**
    31  
    32  * `btree`: An in-memory store, used mostly to quickly verify KV backend functionality.
    33  * `leveldb`: A persistent on-disk store backed by [LevelDB](https://github.com/google/leveldb).
    34  * `bolt`: Stores the graph data on-disk in a [Bolt](https://github.com/boltdb/bolt) file. Uses more disk space and memory than LevelDB for smaller stores, but is often faster to write to and comparable for large ones, with faster average query times.
    35  
    36  **NoSQL backends**
    37  
    38  Slower, as it incurs network traffic, but multiple Cayley instances can disappear and reconnect at will, across a potentially horizontally-scaled store.
    39  
    40  * `mongo`: Stores the graph data and indices in a [MongoDB](https://www.mongodb.com/) instance.
    41  * `elastic`: Stores the graph data and indices in a [ElasticSearch](https://www.elastic.co/products/elasticsearch) instance.
    42  * `couch`: Stores the graph data and indices in a [CouchDB](http://couchdb.apache.org/) instance.
    43  * `pouch`: Stores the graph data and indices in a [PouchDB](https://pouchdb.com/). Requires building with [GopherJS](https://github.com/gopherjs/gopherjs).
    44  
    45  **SQL backends**
    46  
    47  * `postgres`: Stores the graph data and indices in a [PostgreSQL](https://www.postgresql.org) instance.
    48  * `cockroach`: Stores the graph data and indices in a [CockroachDB](https://www.cockroachlabs.com/product/cockroachdb/) cluster.
    49  * `mysql`: Stores the graph data and indices in a [MySQL](https://www.mysql.com/) or [MariaDB](https://mariadb.org/) instance.
    50  * `sqlite`: Stores the graph data and indices in a [SQLite](https://www.sqlite.org) database.
    51  
    52  #### **`store.address`**
    53  
    54  * Type: String
    55  * Default: ""
    56  * Alias: `store.path`
    57  
    58  Where does the database actually live? Dependent on the type of database. For each datastore:
    59  
    60  * `memstore`: Path parameter is not supported.
    61  * `leveldb`: Directory to hold the LevelDB database files.
    62  * `bolt`: Path to the persistent single Bolt database file.
    63  * `mongo`: "hostname:port" of the desired MongoDB server. More options can be provided in [mgo](https://godoc.org/github.com/globalsign/mgo#Dial) address format.
    64  * `elastic`: `http://host:port` of the desired ElasticSearch server.
    65  * `couch`: `http://user:pass@host:port/dbname` of the desired CouchDB server.
    66  * `postgres`,`cockroach`: `postgres://[username:password@]host[:port]/database-name?sslmode=disable` of the PostgreSQL database and credentials. Sslmode is optional. More option available on [pq](https://godoc.org/github.com/lib/pq) page.
    67  * `mysql`: `[username:password@]tcp(host[:3306])/database-name` of the MqSQL database and credentials. More option available on [driver](https://github.com/go-sql-driver/mysql#dsn-data-source-name) page.
    68  * `sqlite`: `filepath` of the SQLite database. More options available on [driver](https://github.com/mattn/go-sqlite3#connection-string) page.
    69  
    70  #### **`store.read_only`**
    71  
    72  * Type: Boolean
    73  * Default: false
    74  
    75  If true, disables the ability to write to the database using the HTTP API \(will return a 400 for any write request\). Useful for testing or instances that shouldn't change.
    76  
    77  #### **`store.options`**
    78  
    79  * Type: Object
    80  
    81  See Per-Database Options, below.
    82  
    83  ### Per-Store Options
    84  
    85  The `store.options` object in the main configuration file contains any of these following options that change the behavior of the datastore.
    86  
    87  #### Memory
    88  
    89  No special options.
    90  
    91  #### LevelDB
    92  
    93  **write\_buffer\_mb**
    94  
    95  * Type: Integer
    96  * Default: 20
    97  
    98  The size in MiB of the LevelDB write cache. Increasing this number allows for more/faster writes before syncing to disk. Default is 20, for large loads, a recommended value is 200+.
    99  
   100  **cache\_size\_mb**
   101  
   102  * Type: Integer
   103  * Default: 2
   104  
   105  The size in MiB of the LevelDB block cache. Increasing this number uses more memory to maintain a bigger cache of quad blocks for better performance.
   106  
   107  #### Bolt
   108  
   109  **nosync**
   110  
   111  * Type: Boolean
   112  * Default: false
   113  
   114  Optionally disable syncing to disk per transaction. Nosync being true means much faster load times, but without consistency guarantees.
   115  
   116  #### Mongo
   117  
   118  **database\_name**
   119  
   120  * Type: String
   121  * Default: "cayley"
   122  
   123  The name of the database within MongoDB to connect to. Manages its own collections and indices therein.
   124  
   125  #### PostgreSQL
   126  
   127  Postgres version 9.5 or greater is required.
   128  
   129  **db\_fill\_factor**
   130  
   131  * Type: Integer
   132  * Default: 50
   133  
   134  Amount of empty space as a percentage to leave in the database when creating a table and inserting rows. See [PostgreSQL CreateTable](http://www.postgresql.org/docs/current/static/sql-createtable.html).
   135  
   136  **local\_optimize**
   137  
   138  * Type: Boolean
   139  * Default: true
   140  
   141  Whether to skip checking quad store size.
   142  
   143  Connection pooling options used to configure the Go sql connection. Go defaults will be used when not specified.
   144  
   145  **maxopenconnections**
   146  
   147  * Type: Integer
   148  * Default: -1.
   149  
   150  **maxidleconnections**
   151  
   152  * Type: Integer
   153  * Default: -1.
   154  
   155  **connmaxlifetime**
   156  
   157  * Type: String
   158  * Default: "".
   159  
   160  #### Per-Replication Options
   161  
   162  The `replication_options` object in the main configuration file contains any of these following options that change the behavior of the replication manager.
   163  
   164  ### Query
   165  
   166  #### **`timeout`**
   167  
   168  * Type: Integer or String
   169  * Default: 30
   170  
   171  The maximum length of time the Javascript runtime should run until cancelling the query and returning a 408 Timeout. When timeout is an integer is is interpreted as seconds, when it is a string it is [parsed](http://golang.org/pkg/time/#ParseDuration) as a Go time.Duration. A negative duration means no limit.
   172  
   173  ### Load
   174  
   175  #### **`load.ignore_missing`**
   176  
   177  * Type: Boolean
   178  * Default: false
   179  
   180  Optionally ignore missing quad on delete.
   181  
   182  #### **`load.ignore_duplicate`**
   183  
   184  * Type: Boolean
   185  * Default: false
   186  
   187  Optionally ignore duplicated quad on add.
   188  
   189  #### **`load.batch`**
   190  
   191  * Type: Integer
   192  * Default: 10000
   193  
   194  The number of quads to buffer from a loaded file before writing a block of quads to the database. Larger numbers are good for larger loads.
   195  
   196  ## Configuration File Location
   197  
   198  Cayley looks in the following locations for the configuration file \(named `cayley.yml` or `cayley.json`\):
   199  
   200  * Command line flag
   201  * The environment variable `$CAYLEY_CFG`
   202  * Current directory
   203  * `$HOME/.cayley/`
   204  * `/etc/`
   205