AMBARI-16056. Ambari support for bucket caching parameter - hbase.bucketcache.ioengine (smohanty)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/7e3702f8 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/7e3702f8 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/7e3702f8 Branch: refs/heads/branch-2.2 Commit: 7e3702f87ccc063c3196094b68ce15d1ec74a21c Parents: 2886bf6 Author: Sumit Mohanty <[email protected]> Authored: Tue Apr 26 10:53:00 2016 -0700 Committer: Sumit Mohanty <[email protected]> Committed: Tue Apr 26 10:53:00 2016 -0700 ---------------------------------------------------------------------- .../HBASE/0.96.0.2.0/package/scripts/hbase.py | 15 + .../0.96.0.2.0/package/scripts/params_linux.py | 1 + .../stacks/2.0.6/HBASE/test_hbase_master.py | 28 +- .../2.0.6/configs/default_with_bucket.json | 1207 ++++++++++++++++++ 4 files changed, 1250 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/7e3702f8/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase.py b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase.py index 521dc93..c27c3f2 100644 --- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase.py +++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/hbase.py @@ -61,6 +61,21 @@ def hbase(name=None): mode=0777, ) + # If a file location is specified in ioengine parameter, + # ensure that directory exists. Otherwise create the + # directory with permissions assigned to hbase:hadoop. + ioengine_input = params.ioengine_param + if ioengine_input != None: + if ioengine_input.startswith("file:/"): + ioengine_fullpath = ioengine_input[5:] + ioengine_dir = os.path.dirname(ioengine_fullpath) + Directory(ioengine_dir, + owner = params.hbase_user, + group = params.user_group, + recursive = True, + mode = 0755 + ) + parent_dir = os.path.dirname(params.tmp_dir) # In case if we have several placeholders in path while ("${" in parent_dir): http://git-wip-us.apache.org/repos/asf/ambari/blob/7e3702f8/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py index 18f3eb2..aeda2d3 100644 --- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py +++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/params_linux.py @@ -134,6 +134,7 @@ elif OSCheck.is_ubuntu_family(): pid_dir = status_params.pid_dir tmp_dir = config['configurations']['hbase-site']['hbase.tmp.dir'] local_dir = config['configurations']['hbase-site']['hbase.local.dir'] +ioengine_param = default('/configurations/hbase-site/hbase.bucketcache.ioengine', None) client_jaas_config_file = format("{hbase_conf_dir}/hbase_client_jaas.conf") master_jaas_config_file = format("{hbase_conf_dir}/hbase_master_jaas.conf") http://git-wip-us.apache.org/repos/asf/ambari/blob/7e3702f8/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py index c75f3c4..0c7bebc 100644 --- a/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py +++ b/ambari-server/src/test/python/stacks/2.0.6/HBASE/test_hbase_master.py @@ -89,6 +89,24 @@ class TestHBaseMaster(RMFTestCase): user = 'hbase' ) self.assertNoMoreResources() + pass + + def test_start_default_bucketcache(self): + self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/hbase_master.py", + classname = "HbaseMaster", + command = "start", + config_file="default_with_bucket.json", + hdp_stack_version = self.STACK_VERSION, + target = RMFTestCase.TARGET_COMMON_SERVICES + ) + + self.assert_configure_default(bucketcache_ioengine_as_file=True) + self.assertResourceCalled('Execute', '/usr/lib/hbase/bin/hbase-daemon.sh --config /etc/hbase/conf start master', + not_if = 'ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E test -f /var/run/hbase/hbase-hbase-master.pid && ps -p `ambari-sudo.sh [RMF_ENV_PLACEHOLDER] -H -E cat /var/run/hbase/hbase-hbase-master.pid` >/dev/null 2>&1', + user = 'hbase' + ) + self.assertNoMoreResources() + pass def test_stop_default(self): self.executeScript(self.COMMON_SERVICES_PACKAGE_DIR + "/scripts/hbase_master.py", @@ -233,7 +251,7 @@ class TestHBaseMaster(RMFTestCase): ) self.assertNoMoreResources() - def assert_configure_default(self): + def assert_configure_default(self, bucketcache_ioengine_as_file=False): self.assertResourceCalled('Directory', '/etc/hbase', mode = 0755 ) @@ -246,6 +264,14 @@ class TestHBaseMaster(RMFTestCase): recursive = True, mode = 0777 ) + if bucketcache_ioengine_as_file: + self.assertResourceCalled('Directory', '/mnt/bucket', + recursive = True, + owner = 'hbase', + group = 'hadoop', + mode = 0755 + ) + pass self.assertResourceCalled('Directory', '/hadoop', recursive = True, cd_access = 'a',
