Next: , Up: Global Configuration


4.6.1 Database Specification

Buildbot requires a connection to a database to maintain certain state information, such as tracking pending build requests. By default this is stored in a sqlite file called 'state.sqlite' in the base directory of your master. This can be overridden with the db_url parameter.

The format of this parameter is completely documetned at http://www.sqlalchemy.org/docs/dialects/, but is generally of the form:

     driver://[username:password@]host:port/database[?args]

For sqlite databases, since there is no host and port, relative paths are specified with sqlite:/// and absolute paths with sqlite:////. Examples:

Notes for particular database backends:

SQLite

     c['db_url'] = "sqlite:///state.sqlite"

No special configuration is required to use SQLite.

MySQL

     c['db_url'] = "mysql://user:pass@somehost.com/database_name?max_idle=300"

The max_idle argument for MySQL connections is unique to Buildbot, and should be set to something less than the wait_timeout configured for your server. This controls the SQLAlchemy pool_recycle parameter, which defaults to no timeout. Setting this parameter ensures that connections are closed and re-opened after the configured amount of idle time. If you see errors such as _mysql_exceptions.OperationalError: (2006, 'MySQL server has gone away'), this means your max_idle setting is probably too high. show global variables like 'wait_timeout'; will show what the currently configured wait_timeout is on your MySQL server.

Buildbot requires use_unique=True and charset=utf8, and will add them automatically, so they do not need to be specified in db_url.

MySQL defaults to the MyISAM storage engine, but this can be overridden with the storage_engine URL argument. Note that, because of InnoDB's extremely short key length limitations, it cannot be used to run Buildbot. See http://bugs.mysql.com/bug.php?id=4541 for more information.

Buildbot uses temporary tables internally to manage large transactions. MySQL has trouble doing replication with temporary tables, so if you are using a replicated MySQL installation, you may need to handle this situation carefully. The MySQL documentation (http://dev.mysql.com/doc/refman/5.5/en/replication-features-temptables.html) recommends using --replicate-wild-ignore-table to ignore temporary tables that should not be replicated. All Buildbot temporary tables begin with bbtmp_, so an option such as --replicate-wild-ignore-table=bbtmp_.* may help.

Postgres

     c['db_url'] = "postgresql://username@hostname/dbname"

No special configuration is required to use Postgres.