Moving Oozie to MySQL with Ambari
The following provide directions to swap out the default Derby DB in Ambari for Ooize to Mysql.
- followed *some* steps from this for preparing to create the MySQL db creation - http://docs.hortonworks.com/HDPDocuments/HDP2/HDP-2.1-latest/bk_installing_manually_book/content/rpm-chap8-3.html
- Setup databse (dropped the existing DB first)
- $ mysqldump -u oozie -p -h <host> oozie > oozie.dump.sql
- $ mysql -u oozie -p -h <host> -e "drop database oozie"
- $ sudo mysql
- mysql> create database oozie;
- Query OK, 1 row affected (0.03 sec)
- mysql> grant all privileges on oozie.* to 'oozie'@'localhost' identified by 'oozie'
- Query OK, 0 rows affected (0.03 sec)
- mysql> grant all privileges on oozie.* to 'oozie'@'%' identified by 'oozie';
- Query OK, 0 rows affected (0.03 sec)
- mysql> exit
- backup oozie-site.xml
- modify the following in oozie-site.xml
- change db info to mysql (note: use the proper password for the grants: pass=oozie). This is used for creating the database. We need to manually change it because Ambari disables this options once it's been set.
<property>
<name>oozie.service.JPAService.jdbc.driver</name>
<value>com.mysql.jdbc.Driver</value>
</property>
<property>
<name>oozie.service.JPAService.jdbc.url</name>
<value>jdbc:mysql://<hostname>:3306/oozie</value>
</property>
<property>
<name>oozie.service.JPAService.jdbc.username</name>
<value>oozie</value>
</property>
<property>
<name>oozie.service.JPAService.jdbc.password</name>
<value>oozie</value>
</property>
- change db info to mysql (note: use the proper password for the grants: pass=oozie). This is used for creating the database. We need to manually change it because Ambari disables this options once it's been set.
- copy mysql-connector-java.jar to oozie/libext (/var/lib/oozie/)
- install the Oozie DB
- sudo -u oozie /usr/lib/oozie/bin/ooziedb.sh create -run
- Check out the Ambari Oozie settings via the CLI API
/var/lib/ambari-server/resources/scripts/configs.sh -u admin -p <password> get 127.0.0.1 <clustername> oozie-site | python -m json.tool
cat <(echo {) <(/var/lib/ambari-server/resources/scripts/configs.sh -u admin -p <password> get 127.0.0.1 <clustername> oozie-site|tail -n +4) <(echo })|python -m json.tool - Update the Oozie properties in Ambari
- create a tmp dir, e.g. /tmp/oozie and cd to it
- Get the global config
/var/lib/ambari-server/resources/scripts/configs.sh -u admin -p <password> get 127.0.0.1 <clustername> global global.json - Update the following:
- "oozie_database" : "Existing MySQL Database"
- "oozie_database_type" : "MySQL"
- Update the global config
- /var/lib/ambari-server/resources/scripts/configs.sh -u admin -p <password> set 127.0.0.1 <clustername> global global.json
- Get the oozie-site config
- /var/lib/ambari-server/resources/scripts/configs.sh -u admin -p <password> get 127.0.0.1 <clustername> oozie-site oozie-site.json
- Update the following:
- "oozie.db.schema.name" : "oozie"
- "oozie.service.JPAService.jdbc.driver" : "com.mysql.jdbc.Driver"
- "oozie.service.JPAService.jdbc.url" : "jdbc:mysql://<hostname>:3306/oozie"
- Update the oozie-site config
- /var/lib/ambari-server/resources/scripts/configs.sh -u admin -p <password> set 127.0.0.1 <clustername> oozie-site oozie-site.json

