瀏覽代碼

AMBARI-16035. Add support for Rolling and Express Upgrade for Ranger Tagsync (Mugdha Varadkar via gautam)

Gautam Borad 9 年之前
父節點
當前提交
004d496038

+ 3 - 0
ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/params.py

@@ -68,6 +68,8 @@ ranger_conf    = '/etc/ranger/admin/conf'
 ranger_ugsync_conf = '/etc/ranger/usersync/conf'
 ranger_ugsync_conf = '/etc/ranger/usersync/conf'
 ranger_tagsync_home  = format('{stack_root}/current/ranger-tagsync')
 ranger_tagsync_home  = format('{stack_root}/current/ranger-tagsync')
 ranger_tagsync_conf = format('{stack_root}/current/ranger-tagsync/conf')
 ranger_tagsync_conf = format('{stack_root}/current/ranger-tagsync/conf')
+tagsync_bin = '/usr/bin/ranger-tagsync'
+tagsync_services_file = format('{stack_root}/current/ranger-tagsync/ranger-tagsync-services.sh')
 
 
 if upgrade_direction == Direction.DOWNGRADE and version and not check_stack_feature(StackFeature.CONFIG_VERSIONING, version):
 if upgrade_direction == Direction.DOWNGRADE and version and not check_stack_feature(StackFeature.CONFIG_VERSIONING, version):
   stack_supports_rolling_upgrade = True
   stack_supports_rolling_upgrade = True
@@ -94,6 +96,7 @@ if stack_supports_ranger_tagsync:
   ranger_tagsync_home  = format('{stack_root}/current/ranger-tagsync')
   ranger_tagsync_home  = format('{stack_root}/current/ranger-tagsync')
   tagsync_bin = '/usr/bin/ranger-tagsync'
   tagsync_bin = '/usr/bin/ranger-tagsync'
   ranger_tagsync_conf = format('{stack_root}/current/ranger-tagsync/conf')
   ranger_tagsync_conf = format('{stack_root}/current/ranger-tagsync/conf')
+  tagsync_services_file = format('{stack_root}/current/ranger-tagsync/ranger-tagsync-services.sh')
 
 
 usersync_services_file = format('{stack_root}/current/ranger-usersync/ranger-usersync-services.sh')
 usersync_services_file = format('{stack_root}/current/ranger-usersync/ranger-usersync-services.sh')
 
 

+ 1 - 1
ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_service.py

@@ -54,7 +54,7 @@ def ranger_service(name, action=None):
       )
       )
   elif name == 'ranger_tagsync' and params.stack_supports_ranger_tagsync:
   elif name == 'ranger_tagsync' and params.stack_supports_ranger_tagsync:
     no_op_test = format('ps -ef | grep proc_rangertagsync | grep -v grep')
     no_op_test = format('ps -ef | grep proc_rangertagsync | grep -v grep')
-    cmd = format('{tagsync_bin} start')
+    cmd = format('{tagsync_services_file} start')
     try:
     try:
       Execute(cmd,
       Execute(cmd,
         environment=env_dict,
         environment=env_dict,

+ 1 - 1
ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/ranger_tagsync.py

@@ -52,7 +52,7 @@ class RangerTagsync(Script):
     import params
     import params
     env.set_params(params)
     env.set_params(params)
 
 
-    Execute(format('{tagsync_bin} stop'), environment={'JAVA_HOME': params.java_home}, user=params.unix_user)
+    Execute(format('{tagsync_services_file} stop'), environment={'JAVA_HOME': params.java_home}, user=params.unix_user)
     File(params.tagsync_pid_file,
     File(params.tagsync_pid_file,
       action = "delete"
       action = "delete"
     )
     )

+ 3 - 4
ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger_xml.py

@@ -417,7 +417,6 @@ def setup_tagsync(upgrade_type=None):
   ranger_tagsync_conf = params.ranger_tagsync_conf
   ranger_tagsync_conf = params.ranger_tagsync_conf
 
 
   tagsync_log4j_file = format('{ranger_tagsync_conf}/log4j.xml')
   tagsync_log4j_file = format('{ranger_tagsync_conf}/log4j.xml')
-  tagsync_services_file = format('{ranger_tagsync_home}/ranger-tagsync-services.sh')
 
 
   Directory(format("{ranger_tagsync_conf}"),
   Directory(format("{ranger_tagsync_conf}"),
     owner = params.unix_user,
     owner = params.unix_user,
@@ -464,7 +463,7 @@ def setup_tagsync(upgrade_type=None):
   )
   )
 
 
   if upgrade_type is not None:
   if upgrade_type is not None:
-    src_file = format('{ranger_tagsync_home}/ews/webapp/WEB-INF/classes/conf.dist/log4j.xml')
+    src_file = format('{ranger_tagsync_home}/conf.dist/log4j.xml')
     dst_file = format('{tagsync_log4j_file}')
     dst_file = format('{tagsync_log4j_file}')
     Execute(('cp', '-f', src_file, dst_file), sudo=True)
     Execute(('cp', '-f', src_file, dst_file), sudo=True)
 
 
@@ -472,7 +471,7 @@ def setup_tagsync(upgrade_type=None):
     File(tagsync_log4j_file, owner=params.unix_user, group=params.unix_group)
     File(tagsync_log4j_file, owner=params.unix_user, group=params.unix_group)
   else:
   else:
     Logger.warning('Required file {0} does not exist, copying the file to {1} path'.format(tagsync_log4j_file, ranger_tagsync_conf))
     Logger.warning('Required file {0} does not exist, copying the file to {1} path'.format(tagsync_log4j_file, ranger_tagsync_conf))
-    src_file = format('{ranger_tagsync_home}/ews/webapp/WEB-INF/classes/conf.dist/log4j.xml')
+    src_file = format('{ranger_tagsync_home}/conf.dist/log4j.xml')
     dst_file = format('{tagsync_log4j_file}')
     dst_file = format('{tagsync_log4j_file}')
     Execute(('cp', '-f', src_file, dst_file), sudo=True)
     Execute(('cp', '-f', src_file, dst_file), sudo=True)
     File(tagsync_log4j_file, owner=params.unix_user, group=params.unix_group)
     File(tagsync_log4j_file, owner=params.unix_user, group=params.unix_group)
@@ -487,7 +486,7 @@ def setup_tagsync(upgrade_type=None):
          mode = 0640
          mode = 0640
     )
     )
 
 
-  File(tagsync_services_file,
+  File(params.tagsync_services_file,
     mode = 0755,
     mode = 0755,
   )
   )
 
 

+ 2 - 0
ambari-server/src/main/resources/stacks/HDP/2.5/services/stack_advisor.py

@@ -421,6 +421,8 @@ class HDP25StackAdvisor(HDP24StackAdvisor):
     servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
     servicesList = [service["StackServices"]["service_name"] for service in services["services"]]
 
 
     putTagsyncAppProperty = self.putProperty(configurations, "tagsync-application-properties", services)
     putTagsyncAppProperty = self.putProperty(configurations, "tagsync-application-properties", services)
+    putTagsyncSiteProperty = self.putProperty(configurations, "ranger-tagsync-site", services)
+
     has_ranger_tagsync = False
     has_ranger_tagsync = False
     if 'RANGER' in servicesList:
     if 'RANGER' in servicesList:
       ranger_tagsync_host = self.__getHostsForComponent(services, "RANGER", "RANGER_TAGSYNC")
       ranger_tagsync_host = self.__getHostsForComponent(services, "RANGER", "RANGER_TAGSYNC")

+ 8 - 0
ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/nonrolling-upgrade-2.5.xml

@@ -210,6 +210,7 @@
       <service name="RANGER">
       <service name="RANGER">
         <component>RANGER_USERSYNC</component>
         <component>RANGER_USERSYNC</component>
         <component>RANGER_ADMIN</component>
         <component>RANGER_ADMIN</component>
+        <component>RANGER_TAGSYNC</component>
       </service>
       </service>
 
 
       <service name="RANGER_KMS">
       <service name="RANGER_KMS">
@@ -313,6 +314,7 @@
       <service name="RANGER">
       <service name="RANGER">
         <component>RANGER_ADMIN</component>
         <component>RANGER_ADMIN</component>
         <component>RANGER_USERSYNC</component>
         <component>RANGER_USERSYNC</component>
+        <component>RANGER_TAGSYNC</component>
       </service>
       </service>
     </group>
     </group>
 
 
@@ -706,6 +708,12 @@
           <task xsi:type="restart-task"/>
           <task xsi:type="restart-task"/>
         </upgrade>
         </upgrade>
       </component>
       </component>
+
+      <component name="RANGER_TAGSYNC">
+        <upgrade>
+          <task xsi:type="restart-task"/>
+        </upgrade>
+      </component>
     </service>
     </service>
 
 
     <service name="RANGER_KMS">
     <service name="RANGER_KMS">

+ 7 - 0
ambari-server/src/main/resources/stacks/HDP/2.5/upgrades/upgrade-2.5.xml

@@ -128,6 +128,7 @@
       <service name="RANGER">
       <service name="RANGER">
         <component>RANGER_ADMIN</component>
         <component>RANGER_ADMIN</component>
         <component>RANGER_USERSYNC</component>
         <component>RANGER_USERSYNC</component>
+        <component>RANGER_TAGSYNC</component>
       </service>
       </service>
     </group>
     </group>
 
 
@@ -493,6 +494,12 @@
           <task xsi:type="restart-task" />
           <task xsi:type="restart-task" />
         </upgrade>
         </upgrade>
       </component>
       </component>
+
+      <component name="RANGER_TAGSYNC">
+        <upgrade>
+          <task xsi:type="restart-task" />
+        </upgrade>
+      </component>
     </service>
     </service>
 
 
     <service name="RANGER_KMS">
     <service name="RANGER_KMS">