You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ja...@apache.org on 2016/02/16 20:32:35 UTC
ambari git commit: AMBARI-15022: Add Custom action to sync Standby
with Master (goutamtadi via jaoki)
Repository: ambari
Updated Branches:
refs/heads/branch-2.2 b6c8e5dce -> 8a8f16a41
AMBARI-15022: Add Custom action to sync Standby with Master (goutamtadi via jaoki)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8a8f16a4
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8a8f16a4
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8a8f16a4
Branch: refs/heads/branch-2.2
Commit: 8a8f16a41343dedca7441255591552b2ba115259
Parents: b6c8e5d
Author: Jun Aoki <ja...@apache.org>
Authored: Tue Feb 16 11:32:27 2016 -0800
Committer: Jun Aoki <ja...@apache.org>
Committed: Tue Feb 16 11:32:27 2016 -0800
----------------------------------------------------------------------
.../common-services/HAWQ/2.0.0/metainfo.xml | 14 ++++--
.../HAWQ/2.0.0/package/scripts/hawqmaster.py | 2 +-
.../HAWQ/2.0.0/package/scripts/hawqsegment.py | 2 +-
.../HAWQ/2.0.0/package/scripts/hawqstandby.py | 10 ++++-
.../hawq/activateStandby/step3_controller.js | 2 +-
ambari-web/app/controllers/main/service/item.js | 46 ++++++++++----------
ambari-web/app/messages.js | 5 ++-
ambari-web/app/models/host_component.js | 28 ++++++++----
ambari-web/app/utils/helper.js | 15 +++++++
ambari-web/app/views/main/service/item.js | 45 ++++++++++---------
10 files changed, 109 insertions(+), 60 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a8f16a4/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/metainfo.xml
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/metainfo.xml b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/metainfo.xml
index 7a71604..780a327 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/metainfo.xml
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/metainfo.xml
@@ -39,7 +39,7 @@
</commandScript>
<customCommands>
<customCommand>
- <name>IMMEDIATE_STOP_CLUSTER</name>
+ <name>IMMEDIATE_STOP_HAWQ_SERVICE</name>
<commandScript>
<script>scripts/hawqmaster.py</script>
<scriptType>PYTHON</scriptType>
@@ -77,8 +77,16 @@
<timeout>600</timeout>
</commandScript>
<customCommands>
+ <customCommand>
+ <name>ACTIVATE_HAWQ_STANDBY</name>
+ <commandScript>
+ <script>scripts/hawqstandby.py</script>
+ <scriptType>PYTHON</scriptType>
+ <timeout>1200</timeout>
+ </commandScript>
+ </customCommand>
<customCommand>
- <name>ACTIVATE_STANDBY</name>
+ <name>RESYNC_HAWQ_STANDBY</name>
<commandScript>
<script>scripts/hawqstandby.py</script>
<scriptType>PYTHON</scriptType>
@@ -110,7 +118,7 @@
</commandScript>
<customCommands>
<customCommand>
- <name>IMMEDIATE_STOP</name>
+ <name>IMMEDIATE_STOP_HAWQ_SEGMENT</name>
<commandScript>
<script>scripts/hawqsegment.py</script>
<scriptType>PYTHON</scriptType>
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a8f16a4/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqmaster.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqmaster.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqmaster.py
index 8c7b0b5..d2f9ad0 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqmaster.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqmaster.py
@@ -51,7 +51,7 @@ class HawqMaster(Script):
from hawqstatus import get_pid_file
check_process_status(get_pid_file())
- def immediate_stop_cluster(self, env):
+ def immediate_stop_hawq_service(self, env):
master_helper.stop(hawq_constants.IMMEDIATE, hawq_constants.CLUSTER)
if __name__ == "__main__":
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a8f16a4/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py
index 6bc9802..0a597b6 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqsegment.py
@@ -73,7 +73,7 @@ class HawqSegment(Script):
from hawqstatus import get_pid_file
check_process_status(get_pid_file())
- def immediate_stop(self, env):
+ def immediate_stop_hawq_segment(self, env):
self.stop(env, mode=hawq_constants.IMMEDIATE)
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a8f16a4/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqstandby.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqstandby.py b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqstandby.py
index 67152c1..77c06f0 100644
--- a/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqstandby.py
+++ b/ambari-server/src/main/resources/common-services/HAWQ/2.0.0/package/scripts/hawqstandby.py
@@ -18,6 +18,7 @@ limitations under the License.
"""
from resource_management import Script
from resource_management.libraries.functions.check_process_status import check_process_status
+from resource_management.core.logger import Logger
import master_helper
import common
@@ -51,9 +52,16 @@ class HawqStandby(Script):
from hawqstatus import get_pid_file
check_process_status(get_pid_file())
- def activate_standby(self, env):
+ def activate_hawq_standby(self, env):
import utils
utils.exec_hawq_operation(hawq_constants.ACTIVATE, "{0} -a -M {1} -v".format(hawq_constants.STANDBY, hawq_constants.FAST))
+
+ def resync_hawq_standby(self,env):
+ import params
+ import utils
+ Logger.info("HAWQ Standby Master Re-Sync started in fast mode ...")
+ utils.exec_hawq_operation(hawq_constants.INIT, "{0} -n -a -v -M {1}".format(hawq_constants.STANDBY, hawq_constants.FAST))
+ Logger.info("HAWQ Standby host {0} Re-Sync successful".format(params.hostname))
if __name__ == "__main__":
HawqStandby().execute()
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a8f16a4/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js
index 55da44e..7dbf992 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/hawq/activateStandby/step3_controller.js
@@ -25,7 +25,7 @@ App.ActivateHawqStandbyWizardStep3Controller = App.HighAvailabilityProgressPageC
clusterDeployState: 'ACTIVATE_HAWQ_STANDBY',
- hawqActivateStandbyCustomCommand: "ACTIVATE_STANDBY",
+ hawqActivateStandbyCustomCommand: "ACTIVATE_HAWQ_STANDBY",
hawqServiceName: "HAWQ",
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a8f16a4/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index 6ed7b73..49d017b 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -501,29 +501,6 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
},
/**
- * On click handler for hawq stop cluster command from items menu
- */
-
- immediateStopHawqCluster: function(context) {
- var controller = this;
- return App.showConfirmationPopup(function() {
- App.ajax.send({
- name: 'service.item.executeCustomCommand',
- sender: controller,
- data: {
- command: context.command,
- context: Em.I18n.t('services.service.actions.run.immediateStopHawqCluster.context'),
- hosts: App.Service.find(context.service).get('hostComponents').findProperty('componentName', 'HAWQMASTER').get('hostName'),
- serviceName: context.service,
- componentName: context.component
- },
- success : 'executeCustomCommandSuccessCallback',
- error : 'executeCustomCommandErrorCallback'
- });
- });
- },
-
- /**
* On click handler for rebalance Hdfs command from items menu
*/
rebalanceHdfsNodes: function () {
@@ -926,6 +903,29 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
displayName: (event && event.label) || component.get('displayName')
});
},
+
+ /**
+ * On click handler for custom hawq command from items menu
+ * @param context
+ */
+ executeHawqCustomCommand: function(context) {
+ var controller = this;
+ return App.showConfirmationPopup(function() {
+ App.ajax.send({
+ name : 'service.item.executeCustomCommand',
+ sender: controller,
+ data : {
+ command : context.command,
+ context : context.label,
+ hosts : App.Service.find(context.service).get('hostComponents').findProperty('componentName', context.component).get('hostName'),
+ serviceName : context.service,
+ componentName : context.component
+ },
+ success : 'executeCustomCommandSuccessCallback',
+ error : 'executeCustomCommandErrorCallback'
+ });
+ });
+ },
/**
* On click handler for custom command from items menu
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a8f16a4/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 6b1802a..a7e4ff3 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1675,9 +1675,12 @@ Em.I18n.translations = {
'services.service.actions.run.stopLdapKnox.title':'Stop Demo LDAP Knox Gateway',
'services.service.actions.run.stopLdapKnox.context':'Stop Demo LDAP',
'services.service.actions.run.startStopLdapKnox.error': 'Error during remote command: ',
- 'services.service.actions.run.immediateStopHawqCluster.context':'Stop HAWQ Cluster (Immediate Mode)',
+ 'services.service.actions.run.immediateStopHawqService.context':'Stop HAWQ Service (Immediate Mode)',
+ 'services.service.actions.run.immediateStopHawqService.label':'Stop HAWQ Service (Immediate Mode)',
'services.service.actions.run.immediateStopHawqSegment.label':'Stop (Immediate Mode)',
'services.service.actions.run.immediateStopHawqSegment.context':'Stop HAWQ Segment (Immediate Mode)',
+ 'services.service.actions.run.resyncHawqStandby.context':'Re-Sync HAWQ Standby',
+ 'services.service.actions.run.resyncHawqStandby.label':'Re-Synchronize HAWQ Standby',
'services.service.actions.manage_configuration_groups.short':'Manage Config Groups',
'services.service.actions.serviceActions':'Service Actions',
'services.service.summary.unknown':'unknown',
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a8f16a4/ambari-web/app/models/host_component.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/host_component.js b/ambari-web/app/models/host_component.js
index 36369c5..5d919b9 100644
--- a/ambari-web/app/models/host_component.js
+++ b/ambari-web/app/models/host_component.js
@@ -265,6 +265,7 @@ App.HostComponentActionMap = {
getMap: function(ctx) {
var HM = ctx.get('controller.content.hostComponents').findProperty('componentName', 'HAWQMASTER');
var HS = ctx.get('controller.content.hostComponents').findProperty('componentName', 'HAWQSTANDBY');
+ var HMComponent = App.MasterComponent.find('HAWQMASTER');
return {
RESTART_ALL: {
action: 'restartAllHostComponents',
@@ -367,20 +368,30 @@ App.HostComponentActionMap = {
hasSubmenu: ctx.get('controller.isSeveralClients'),
submenuOptions: ctx.get('controller.clientComponents')
},
- IMMEDIATE_STOP_CLUSTER: {
- action: 'immediateStopHawqCluster',
- customCommand: 'IMMEDIATE_STOP_CLUSTER',
- context: Em.I18n.t('services.service.actions.run.immediateStopHawqCluster.context'),
- label: Em.I18n.t('services.service.actions.run.immediateStopHawqCluster.context'),
+ IMMEDIATE_STOP_HAWQ_SERVICE: {
+ action: 'executeHawqCustomCommand',
+ customCommand: 'IMMEDIATE_STOP_HAWQ_SERVICE',
+ context: Em.I18n.t('services.service.actions.run.immediateStopHawqService.context'),
+ label: Em.I18n.t('services.service.actions.run.immediateStopHawqService.label'),
cssClass: 'icon-stop',
disabled: !HM || HM.get('workStatus') != App.HostComponentStatus.started
+
},
- IMMEDIATE_STOP: {
- customCommand: 'IMMEDIATE_STOP',
+ IMMEDIATE_STOP_HAWQ_SEGMENT: {
+ customCommand: 'IMMEDIATE_STOP_HAWQ_SEGMENT',
context: Em.I18n.t('services.service.actions.run.immediateStopHawqSegment.context'),
label: Em.I18n.t('services.service.actions.run.immediateStopHawqSegment.label'),
cssClass: 'icon-stop'
},
+ RESYNC_HAWQ_STANDBY: {
+ action: 'executeHawqCustomCommand',
+ customCommand: 'RESYNC_HAWQ_STANDBY',
+ context: Em.I18n.t('services.service.actions.run.resyncHawqStandby.context'),
+ label: Em.I18n.t('services.service.actions.run.resyncHawqStandby.label'),
+ cssClass: 'icon-refresh',
+ isHidden : App.get('isSingleNode') || !HS ,
+ disabled: !((!!HMComponent && HMComponent.get('startedCount') === 1) && (!!HS && HS.get('workStatus') === App.HostComponentStatus.started))
+ },
MASTER_CUSTOM_COMMAND: {
action: 'executeCustomCommand',
cssClass: 'icon-play-circle',
@@ -394,8 +405,9 @@ App.HostComponentActionMap = {
isHidden: App.get('isSingleNode') || HS,
disabled: false
},
- TOGGLE_ACTIVATE_HAWQ_STANDBY: {
+ ACTIVATE_HAWQ_STANDBY: {
action: 'activateHawqStandby',
+ context: Em.I18n.t('admin.activateHawqStandby.button.enable'),
label: Em.I18n.t('admin.activateHawqStandby.button.enable'),
cssClass: 'icon-arrow-up',
isHidden: App.get('isSingleNode') || !HS,
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a8f16a4/ambari-web/app/utils/helper.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/helper.js b/ambari-web/app/utils/helper.js
index ba80ab2..8ac754a 100644
--- a/ambari-web/app/utils/helper.js
+++ b/ambari-web/app/utils/helper.js
@@ -524,6 +524,21 @@ App.format = {
if (result === ' Refreshqueues ResourceManager') {
result = Em.I18n.t('services.service.actions.run.yarnRefreshQueues.title');
}
+ // HAWQ custom commands on back Ops page.
+ if (result === ' Resync Hawq Standby HAWQ Standby Master') {
+ result = Em.I18n.t('services.service.actions.run.resyncHawqStandby.label');
+ }
+ if (result === ' Immediate Stop Hawq Service HAWQ Master') {
+ result = Em.I18n.t('services.service.actions.run.immediateStopHawqService.label');
+ }
+ if (result === ' Immediate Stop Hawq Segment HAWQ Segment') {
+ result = Em.I18n.t('services.service.actions.run.immediateStopHawqSegment.label');
+ }
+ if(result === ' Activate Hawq Standby HAWQ Standby Master') {
+ result = Em.I18n.t('admin.activateHawqStandby.button.enable');
+ }
+ //<---End HAWQ custom commands--->
+
return result;
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/8a8f16a4/ambari-web/app/views/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/service/item.js b/ambari-web/app/views/main/service/item.js
index 5a09427..145b64b 100644
--- a/ambari-web/app/views/main/service/item.js
+++ b/ambari-web/app/views/main/service/item.js
@@ -42,9 +42,10 @@ App.MainServiceItemView = Em.View.extend({
'RESOURCEMANAGER': ['DECOMMISSION', 'REFRESHQUEUES'],
'HBASE_MASTER': ['DECOMMISSION'],
'KNOX_GATEWAY': ['STARTDEMOLDAP','STOPDEMOLDAP'],
- 'HAWQMASTER': ['IMMEDIATE_STOP_CLUSTER'],
- 'HAWQSTANDBY': ['ACTIVATE_STANDBY'],
- 'HAWQSEGMENT': ['IMMEDIATE_STOP']
+ 'HAWQMASTER': ['IMMEDIATE_STOP_HAWQ_SERVICE'],
+ 'HAWQSEGMENT': ['IMMEDIATE_STOP_HAWQ_SEGMENT'],
+ 'HAWQSTANDBY' : ['RESYNC_HAWQ_STANDBY','ACTIVATE_HAWQ_STANDBY']
+
},
addActionMap: function() {
@@ -172,8 +173,7 @@ App.MainServiceItemView = Em.View.extend({
options.push(actionMap.TOGGLE_RA_HA);
break;
case 'HAWQ':
- options.push(actionMap.TOGGLE_ADD_HAWQ_STANDBY);
- options.push(actionMap.TOGGLE_ACTIVATE_HAWQ_STANDBY);
+ options.push(actionMap.TOGGLE_ADD_HAWQ_STANDBY);
break;
}
}
@@ -198,22 +198,25 @@ App.MainServiceItemView = Em.View.extend({
}
});
}
-
- var hawqMasterComponent = App.StackServiceComponent.find().findProperty('componentName','HAWQMASTER');
- if (serviceName === 'HAWQ' && hawqMasterComponent) {
- var hawqMasterCustomCommands = hawqMasterComponent.get('customCommands');
- customCommandToStopCluster = 'IMMEDIATE_STOP_CLUSTER';
- if (hawqMasterCustomCommands && hawqMasterCustomCommands.contains(customCommandToStopCluster)) {
- options.push(self.createOption(actionMap.IMMEDIATE_STOP_CLUSTER, {
- label: Em.I18n.t('services.service.actions.run.immediateStopHawqCluster.context'),
- context: {
- label: Em.I18n.t('services.service.actions.run.immediateStopHawqCluster.context'),
- service: hawqMasterComponent.get('serviceName'),
- component: hawqMasterComponent.get('componentName'),
- command: customCommandToStopCluster
- }
- }));
- }
+ /**
+ * Display all custom commands of Master and StandBy on Service page.
+ **/
+ if(serviceName === 'HAWQ') {
+ var hawqMasterComponent = App.StackServiceComponent.find().findProperty('componentName','HAWQMASTER');
+ var hawqStandByComponent = App.StackServiceComponent.find().findProperty('componentName','HAWQSTANDBY');
+ components = [hawqMasterComponent,hawqStandByComponent]
+ components.forEach(function(component){
+ component.get('customCommands').forEach(function(command){
+ options.push(self.createOption(actionMap[command], {
+ context: {
+ label: actionMap[command].context,
+ service: component.get('serviceName'),
+ component: component.get('componentName'),
+ command: command
+ }
+ }));
+ });
+ });
}
self.addActionMap().filterProperty('service', serviceName).forEach(function(item) {