Configuring the Hue Server to Store Data in MySQL
To configure the Hue Server to store data in MySQL:
- Create a new database and grant privileges to a Hue user to manage this database.
For example:
mysql> create database hue; Query OK, 1 row affected (0.01 sec) mysql> grant all on hue.* to 'hue'@'localhost' identified by 'secretpassword'; Query OK, 0 rows affected (0.00 sec)
- Using the Cloudera Manager Admin Console, click the service instance for the Hue database you are reconfiguring. The Hue service instance page in Cloudera Manager Admin Console appears.
- Click Configuration > View and Edit. In the Category pane, click the instance of Database under Service-Wide.
- Specify the settings for Hue's Database Type, Hue's Database Hostname,
Hue's Database Port, Hue's Database Username, Hue's Database
Password, and Hue's Database Name. For example, for a MySQL database
on the local host, you might use the following values:
Hue's Database Type = mysql Hue's Database Hostname = localhost Hue's Database Port = 3306 Hue's Database Username = hue Hue's Database Password = secretpassword Hue's Database Name = hue
- The following steps are for restoring the Hue data to the new database. If you would like Hue to start from a fresh state, you can start your Hue service now.
- Click Actions and click Synchronize Database.
- Determine the foreign key ID.
$ mysql -uhue -psecretpassword mysql > SHOW CREATE TABLE auth_permission;
- (InnoDB only) Drop the foreign key that you retrieved in the previous step.
mysql > ALTER TABLE auth_permission DROP FOREIGN KEY content_type_id_refs_id_XXXXXX;
- Delete the rows in the django_content_type table.
mysql > DELETE FROM hue.django_content_type;
- In Hue service instance page, click Actions, and click Load Database. Confirm you want to load the database by clicking Load Database.
- (InnoDB only) Add back the foreign key.
mysql > ALTER TABLE auth_permission ADD FOREIGN KEY (`content_type_id`) REFERENCES `django_content_type` (`id`);