Webapp Database Setup¶
You must tell Django to create the database tables used by the graphite webapp. This is very straight forward, especially if you are using the default SQLite setup.
The following configures the Django database settings. Graphite uses the database for storing user profiles, dashboards, and for the Events functionality. Graphite uses an SQLite database file located at STORAGE_DIR/graphite.db
by default. If running multiple Graphite-web instances, a database such as PostgreSQL or MySQL is required so that all instances may share the same data source.
Note
As of Django 1.2, the database configuration is specified by the DATABASES
dictionary instead of the old DATABASE_*
format. Users must use the new
specification to have a working database.
See the Django documentation for full documentation of the DATABASES setting.
Note
Remember, setting up a new database requires running PYTHONPATH=$GRAPHITE_ROOT/webapp django-admin.py syncdb --settings=graphite.settings
to create the initial schema.
Note
If you are using a custom database backend (other than SQLite) you must first create a $GRAPHITE_ROOT/webapp/graphite/local_settings.py file that overrides the database related settings from settings.py. Use $GRAPHITE_ROOT/webapp/graphite/local_settings.py.example as a template.
If you are experiencing problems, uncomment the following line in /opt/graphite/webapp/graphite/local_settings.py:
# DEBUG = True
and review your webapp logs. If you’re using the default graphite-example-vhost.conf, your logs will be found in /opt/graphite/storage/log/webapp/.
If you’re using the default SQLite database, your webserver will need permissions to read and write to the database file. So, for example, if your webapp is running in Apache as the ‘nobody’ user, you will need to fix the permissions like this:
sudo chown nobody:nobody /opt/graphite/storage/graphite.db