Database-backed sessions are scalable, persistent, and can be made high-concurrency and highly-available.
However, database-backed sessions are one of the slower session storages and incur a high overhead under heavy usage. Proper configuration of your database deployment can also be a substantial undertaking and is far beyond the scope of this documentation.
Start the mysql command-line client:
$ mysql -u root -p
Enter the MySQL root user's password when prompted.
To configure the MySQL database, create the dash database:
mysql> CREATE DATABASE dash;
Create a MySQL user for the newly-created dash database that has full control of the database. Replace
DASH_DBPASS
with a password for the new user:mysql> GRANT ALL PRIVILEGES ON dash.* TO 'dash'@'%' IDENTIFIED BY '
DASH_DBPASS
'; mysql> GRANT ALL PRIVILEGES ON dash.* TO 'dash'@'localhost' IDENTIFIED BY 'DASH_DBPASS
';Enter quit at the
mysql>
prompt to exit MySQL.In the
local_settings
file (on Fedora/RHEL/CentOS:/etc/openstack-dashboard/local_settings
, on Ubuntu/Debian:/etc/openstack-dashboard/local_settings.py
and on openSUSE:/srv/www/openstack-dashboard/openstack_dashboard/local/local_settings.py
), change these options:SESSION_ENGINE = 'django.core.cache.backends.db.DatabaseCache' DATABASES = { 'default': { # Database configuration here 'ENGINE': 'django.db.backends.mysql', 'NAME': 'dash', 'USER': 'dash', 'PASSWORD': '
DASH_DBPASS
', 'HOST': 'localhost', 'default-character-set': 'utf8' } }After configuring the
local_settings
as shown, you can run the manage.py syncdb command to populate this newly-created database.$ /usr/share/openstack-dashboard/manage.py syncdb
Note on openSUSE the path is
/srv/www/openstack-dashboard/manage.py
.As a result, the following output is returned:
Installing custom SQL ... Installing indexes ... DEBUG:django.db.backends:(0.008) CREATE INDEX `django_session_c25c2c28` ON `django_session` (`expire_date`);; args=() No fixtures found.
On Ubuntu: If you want to avoid a warning when you restart apache2, create a blackhole directory in the dashboard directory, as follows:
# mkdir -p /var/lib/dash/.blackhole
Restart Apache to pick up the default site and symbolic link settings:
On Ubuntu:
# /etc/init.d/apache2 restart
On Fedora/RHEL/CentOS:
# service httpd restart
# service apache2 restart
On openSUSE:
# systemctl restart apache2.service
On Ubuntu, restart the
nova-api
service to ensure that the API server can connect to the dashboard without error:# service nova-api restart