Database-backed sessions are scalable (using an appropriate database strategy), persistent, and can be made high-concurrency and highly-available.
The downside to this approach is that 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. To enable, follow the below steps to initialise the database and configure it for use
Start the mysql command line client by running:
$ 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.
mysql> GRANT ALL ON dash.* TO 'dash'@'%' IDENTIFIED BY 'yourpassword';
Enter quit at the mysql>
prompt to exit MySQL.
In the /etc/openstack-dashboard/local_settings.py
file, 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': 'yourpassword', 'HOST': 'localhost', 'default-character-set': 'utf8' } }
After configuring the local_settings.py
as shown, you can run
the manage.py syncdb command to populate this newly-created
database.
$ /usr/share/openstack-dashboard/manage.py syncdb
As a result, you should see the following at the end of what returns:
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.
If you want to avoid a warning when restarting apache2, create a blackhole directory in the dashboard directory like so:
# sudo mkdir -p /var/lib/dash/.blackhole
Restart Apache to pick up the default site and symbolic link settings.
# /etc/init.d/apache2 restart
# service httpd restart
Restart the nova-api service to ensure the API server can connect to the Dashboard and to avoid an error displayed in the Dashboard.
sudo restart nova-api