Repository: ambari Updated Branches: refs/heads/trunk 11c63bc57 -> 9d0dea40b
AMBARI-5542. Fix Hive and Mysql on Ubuntu (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/9d0dea40 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/9d0dea40 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/9d0dea40 Branch: refs/heads/trunk Commit: 9d0dea40b0fb25e546c9c1f6caba8ec2d0179add Parents: 11c63bc Author: Andrew Onishuk <aonis...@hortonworks.com> Authored: Wed Apr 23 15:41:07 2014 +0300 Committer: Andrew Onishuk <aonis...@hortonworks.com> Committed: Wed Apr 23 15:41:07 2014 +0300 ---------------------------------------------------------------------- .../stacks/HDP/2.0.6/services/HIVE/metainfo.xml | 55 ++------------------ .../HIVE/package/scripts/mysql_server.py | 2 - .../HIVE/package/scripts/mysql_service.py | 10 ++-- .../services/HIVE/package/scripts/params.py | 6 +++ .../HIVE/package/scripts/status_params.py | 4 +- .../stacks/2.0.6/HIVE/test_mysql_server.py | 30 +++++------ 6 files changed, 30 insertions(+), 77 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/9d0dea40/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/metainfo.xml ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/metainfo.xml b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/metainfo.xml index aa35673..02e6dc1 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/metainfo.xml +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/metainfo.xml @@ -74,59 +74,19 @@ <type>rpm</type> <name>mysql-connector-java</name> </package> - <package> - <type>rpm</type> - <name>mysql</name> - </package> - </packages> - </osSpecific> - <osSpecific> - <osFamily>centos6</osFamily> - <packages> - <package> - <type>rpm</type> - <name>mysql-server</name> - </package> - </packages> - </osSpecific> - <osSpecific> - <osFamily>centos5</osFamily> - <packages> - <package> - <type>rpm</type> - <name>mysql-server</name> - </package> - </packages> - </osSpecific> - <osSpecific> - <osFamily>redhat6</osFamily> - <packages> - <package> - <type>rpm</type> - <name>mysql-server</name> - </package> </packages> </osSpecific> <osSpecific> - <osFamily>redhat5</osFamily> + <osFamily>redhat5,redhat6,suse11</osFamily> <packages> <package> <type>rpm</type> - <name>mysql-server</name> - </package> - </packages> - </osSpecific> - <osSpecific> - <osFamily>oraclelinux6</osFamily> - <packages> - <package> - <type>rpm</type> - <name>mysql-server</name> + <name>mysql</name> </package> </packages> </osSpecific> <osSpecific> - <osFamily>oraclelinux5</osFamily> + <osFamily>redhat5,redhat6,debian12</osFamily> <packages> <package> <type>rpm</type> @@ -143,15 +103,6 @@ </package> </packages> </osSpecific> - <osSpecific> - <osFamily>sles11</osFamily> - <packages> - <package> - <type>rpm</type> - <name>mysql-client</name> - </package> - </packages> - </osSpecific> </osSpecifics> <commandScript> http://git-wip-us.apache.org/repos/asf/ambari/blob/9d0dea40/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/mysql_server.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/mysql_server.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/mysql_server.py index 5d9c067..8fdc92e 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/mysql_server.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/mysql_server.py @@ -48,8 +48,6 @@ class MysqlServer(Script): path='/usr/sbin:/sbin:/usr/local/bin:/bin:/usr/bin' ) - mysql_service(daemon_name=params.daemon_name, action='stop') - def start(self, env): import params env.set_params(params) http://git-wip-us.apache.org/repos/asf/ambari/blob/9d0dea40/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/mysql_service.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/mysql_service.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/mysql_service.py index cfb3e08..c0ce7f6 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/mysql_service.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/mysql_service.py @@ -22,15 +22,17 @@ from resource_management import * def mysql_service(daemon_name=None, action='start'): - cmd = format('service {daemon_name} {action}') - + if action == 'status': logoutput = False else: logoutput = True - + # required for running hive + replace_bind_address = format("sed -i 's|^bind-address[ \t]*=.*|bind-address = 0.0.0.0|' {mysql_configname}") + Execute(replace_bind_address) + + cmd = format('service {daemon_name} {action}') Execute(cmd, - path="/usr/local/bin/:/bin/:/sbin/", tries=1, logoutput=logoutput) http://git-wip-us.apache.org/repos/asf/ambari/blob/9d0dea40/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py index 827fd10..ab4aee7 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/params.py @@ -172,6 +172,12 @@ tez_local_api_jars = '/usr/lib/tez/tez*.jar' tez_local_lib_jars = '/usr/lib/tez/lib/*.jar' tez_user = config['configurations']['global']['tez_user'] +if System.get_instance().os_family == "debian": + mysql_configname = '/etc/mysql/my.cnf' +else: + mysql_configname = '/etc/my.cnf' + + # Hive security hive_authorization_enabled = config['configurations']['hive-site']['hive.security.authorization.enabled'] http://git-wip-us.apache.org/repos/asf/ambari/blob/9d0dea40/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/status_params.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/status_params.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/status_params.py index 8fed3d4..ea7ecc2 100644 --- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/status_params.py +++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/services/HIVE/package/scripts/status_params.py @@ -29,7 +29,7 @@ hive_metastore_pid = 'hive.pid' hcat_pid_dir = config['configurations']['global']['hcat_pid_dir'] #hcat_pid_dir -if System.get_instance().os_family == "suse": +if System.get_instance().os_family == "suse" or System.get_instance().os_family == "debian": daemon_name = 'mysql' else: - daemon_name = 'mysqld' + daemon_name = 'mysqld' \ No newline at end of file http://git-wip-us.apache.org/repos/asf/ambari/blob/9d0dea40/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_mysql_server.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_mysql_server.py b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_mysql_server.py index 4b47e3f..c6d50fc 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_mysql_server.py +++ b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_mysql_server.py @@ -38,9 +38,10 @@ class TestMySqlServer(RMFTestCase): config_file="default.json" ) + self.assertResourceCalled('Execute', "sed -i 's|^bind-address[ \t]*=.*|bind-address = 0.0.0.0|' /etc/my.cnf", + ) self.assertResourceCalled('Execute', 'service mysql start', logoutput = True, - path = ['/usr/local/bin/:/bin/:/sbin/'], tries = 1, ) self.assertNoMoreResources() @@ -52,9 +53,10 @@ class TestMySqlServer(RMFTestCase): config_file="default.json" ) + self.assertResourceCalled('Execute', "sed -i 's|^bind-address[ \t]*=.*|bind-address = 0.0.0.0|' /etc/my.cnf", + ) self.assertResourceCalled('Execute', 'service mysql stop', logoutput = True, - path = ['/usr/local/bin/:/bin/:/sbin/'], tries = 1, ) self.assertNoMoreResources() @@ -76,9 +78,10 @@ class TestMySqlServer(RMFTestCase): config_file="secured.json" ) + self.assertResourceCalled('Execute', "sed -i 's|^bind-address[ \t]*=.*|bind-address = 0.0.0.0|' /etc/my.cnf", + ) self.assertResourceCalled('Execute', 'service mysql start', logoutput = True, - path = ['/usr/local/bin/:/bin/:/sbin/'], tries = 1, ) self.assertNoMoreResources() @@ -89,18 +92,20 @@ class TestMySqlServer(RMFTestCase): command = "stop", config_file="secured.json" ) - + + self.assertResourceCalled('Execute', "sed -i 's|^bind-address[ \t]*=.*|bind-address = 0.0.0.0|' /etc/my.cnf", + ) self.assertResourceCalled('Execute', 'service mysql stop', logoutput = True, - path = ['/usr/local/bin/:/bin/:/sbin/'], tries = 1, ) self.assertNoMoreResources() def assert_configure_default(self): + self.assertResourceCalled('Execute', "sed -i 's|^bind-address[ \t]*=.*|bind-address = 0.0.0.0|' /etc/my.cnf", + ) self.assertResourceCalled('Execute', 'service mysql start', logoutput = True, - path = ['/usr/local/bin/:/bin/:/sbin/'], tries = 1, ) self.assertResourceCalled('File', '/tmp/addMysqlUser.sh', @@ -112,16 +117,12 @@ class TestMySqlServer(RMFTestCase): tries = 3, try_sleep = 5, ) - self.assertResourceCalled('Execute', 'service mysql stop', - logoutput = True, - path = ['/usr/local/bin/:/bin/:/sbin/'], - tries = 1, - ) def assert_configure_secured(self): + self.assertResourceCalled('Execute', "sed -i 's|^bind-address[ \t]*=.*|bind-address = 0.0.0.0|' /etc/my.cnf", + ) self.assertResourceCalled('Execute', 'service mysql start', logoutput = True, - path = ['/usr/local/bin/:/bin/:/sbin/'], tries = 1, ) self.assertResourceCalled('File', '/tmp/addMysqlUser.sh', @@ -133,8 +134,3 @@ class TestMySqlServer(RMFTestCase): tries = 3, try_sleep = 5, ) - self.assertResourceCalled('Execute', 'service mysql stop', - logoutput = True, - path = ['/usr/local/bin/:/bin/:/sbin/'], - tries = 1, - )