Permalink
Switch branches/tags
ver2.2.m4 vXAP9.0.2 vXAP-9.0.2 v2.2.0m2 v2.2.0M3_2491_59 v2.2.m5 v2.2.m4 v2.1.1GA Chef-10.12.0-Cloudify-2.2m4 2.7.1_m5_build6205_04_13_2014 2.7.1_m4_build6204_04_01_2014 2.7.1_m3_build6203_03_18_2014 2.7.1_m2_build6202_03_03_2014 2.7.1_m1_build6201_02_17_2014 2.7.1_ga_build6300_08_14_2014 2.7.1_ga_build6210_08_07_2014 2.7.0_rc2_build6000_11_27_2014 2.7.0_rc2_build5999_04_08_2014 2.7.0_rc2_build5999_03_26_2014 2.7.0_rc2_build5998_03_28_2014 2.7.0_rc2_build5997_03_25_2014 2.7.0_rc2_build5995_01_07_2014 2.7.0_rc_build5994_12_23_2013 2.7.0_m8_build5993_12_11_2013 2.7.0_m7_build5992_11_27_2013 2.7.0_m6_build5991_11_13_2013 2.7.0_m5_build5988_10_30_2013 2.7.0_m4_build5987_10_01_2013 2.7.0_m3_build5985_09_08_2013 2.7.0_m2_build5984_08_19_2013 2.7.0_m1_build5985_08_06_2013 2.7.0_m1_build5981_08_01_2013 2.7.0_ga_build5996_01_20_2014 2.6.2_ga_build5400_10_13_2013 2.6.1_ga_build5223_11_25_2013 2.6.1_ga_build5222_11_22_2013 2.6.1_ga_build5221_11_12_2013 2.6.1_ga_build5220_10_29_2013 2.6.1_ga_build5210_10_25_2013 2.6.1_ga_build5200_08_29_2013 2.6.0_rc_build4986_06_26_2013 2.6.0_rc_build4985_06_11_2013 2.6.0_m4_build4985_06_12_2013 2.6.0_m4_build4984_06_11_2013 2.6.0_m3_build4983_05_21_2013 2.6.0_m2_build4982_05_06_2013 2.6.0_m1_build4981_04_22_2013 2.6.0_ga_build5000_07_09_2013 2.5.2_ga_build4400_06_23_2013 2.5.1_ga_build4200_05_01_2013 2.5.0_rc_build3993_03_11_2013 2.5.0_m7_build3991_02_27_2013 2.5.0_m6_build3987_02_04_2013 2.5.0_m5_build3986_01_24_2013 2.5.0_m4_build3985_01_06_2013 2.5.0_m3_build3984_12_30_2012 2.5.0_ga_build4510_04_09_2013 2.5.0_ga_build4023_07_03_2013 2.5.0_ga_build4022_04_28_2013 2.5.0_ga_build4021_04_28_2013 2.5.0_ga_build4020_04_23_2013 2.5.0_ga_build4010_04_10_2013 2.5.0_ga_build4000_04_03_2013 2.3.1_ga_build3720_02_10_2013 2.3.1_ga_build3720_02_09_2013 2.3.1_ga_build3700_01_23_2013 2.3.0_rc_build3483_12_06_2012 2.3.0_m2_build3482_11_20_2012 2.3.0_m1_build3481_11_06_2012 2.3.0_ga_build3510_01_14_2013 2.3.0_ga_build3500_12_16_2012 2.3.0_ga_build3500_12_13_2012 2.2.0_rc_build2496_10_03_2012 2.2.0_m5_build2495_09_21_2012 2.2.0_m4_build2494_09_09_2012 2.2.0_ga_build2500_10_19_2012
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
219 lines (181 sloc) 5.93 KB
/*******************************************************************************
* Copyright (c) 2012 GigaSpaces Technologies Ltd. All rights reserved
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
import groovy.sql.*
import com.mysql.jdbc.Driver
service {
name "mysql"
icon "mysql.png"
type "DATABASE"
elastic true
numInstances 1
minAllowedInstances 1
maxAllowedInstances 3
compute {
template "SMALL_LINUX"
}
lifecycle{
install "mysql_install.groovy"
start "mysql_start.groovy"
startDetectionTimeoutSecs 900
startDetection "mysql_startDetection.groovy"
stopDetection {
!ServiceUtils.isPortOccupied(jdbcPort)
}
preStop ([
"Win.*":"killAllMysql.bat",
"Linux.*":"mysql_stop.groovy"
])
shutdown ([
"Linux.*":"mysql_uninstall.groovy"
])
locator {
//hack to avoid monitoring started processes by cloudify
//return [] as LinkedList
def myPids = ServiceUtils.ProcessUtils.getPidsWithQuery("State.Name.re=mysql.*\\.exe|mysqld")
println ":mysql-service.groovy: current PIDs: ${myPids}"
return myPids
}
details {
def currPublicIP
if ( context.isLocalCloud() ) {
currPublicIP = InetAddress.localHost.hostAddress
}
else {
currPublicIP =context.getPublicAddress()
}
return [
"MySQL IP":currPublicIP,
"MySQL Port":jdbcPort
]
}
}
customCommands ([
/*
This custom command enables users to create a database snapshot (mysqldump)
and to upload the backup to an external storage (Amazon S3 for example).
Usage : invoke mysql mysqldump actionUser dumpPrefix dbName backupType bucketName
Example: invoke mysql mysqldump root myPrefix_ myDbName s3 myBucketName
*/
"mysqldump" : "mysql_dump.groovy" ,
/*
This custom command enables users to invoke an SQL statement
Usage : invoke mysql query actionUser [puserPassword] dbName query
Examples:
1. invoke mysql query root myDbName "update users set city=\"NY\" where uid=15"
2. invoke mysql query root pmyRootPassword myDbName "update users set city=\"NY\" where uid=15"
*/
"query" : "mysql_query.groovy" ,
/*
This custom command enables users to add a slave to the master.
It should be invoked only on a master instance (by a remote slave)
and only if masterSlaveMode is set to true on both the slave and master.
As a result, the following will be invoked :
mysql -u root -D dbName -e
"GRANT REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO slaveUser@'slaveHostIP' IDENTIFIED BY 'slavePassword';"
Usage : invoke mysqlmaster addSlave actionUser dbName slaveUser slavePassword slaveHostIP
*/
"addSlave": "mysql_addSlave.groovy" ,
/*
This custom command enables users to show the master's status.
It should be invoked only on a master instance (either by the master or by a remote slave)
and only if masterSlaveMode is set to true.
As a result, the following will be invoked :
mysql -u root -D dbName -e "show master status;"
and the mysql-bin will be stored in context.attributes.thisApplication["masterBinLogFile"]
and the master's log's position will be stored in context.attributes.thisApplication["masterBinLogPos"]
Usage : invoke mysqlmaster showMasterStatus actionUser dbName
*/
"showMasterStatus": "mysql_showMasterStatus.groovy" ,
/*
This custom command enables users to import a zipped file to a database
Usage : invoke mysql import actionUser dbName zipFileURL
Example: invoke mysql import root myDbName http://www.mysite.com/myFile.zip
*/
"import" : "mysql_import.groovy"
])
userInterface {
metricGroups = ([
metricGroup {
name "server"
metrics([
"Server Uptime",
"Client Connections",
"Total Queries",
"Slow Queries",
"Opens",
"Current Open Tables",
"Queries Per Second"
])
}
])
widgetGroups = ([
widgetGroup {
name "Server Uptime"
widgets ([
barLineChart{
metric "Server Uptime"
axisYUnit Unit.REGULAR
},
])
} ,
widgetGroup {
name "Client Connections"
widgets ([
barLineChart{
metric "Client Connections"
axisYUnit Unit.REGULAR
},
])
} ,
widgetGroup {
name "Total Queries"
widgets ([
barLineChart{
metric "Total Queries"
axisYUnit Unit.REGULAR
},
])
} ,
widgetGroup {
name "Opens"
widgets ([
barLineChart{
metric "Opens"
axisYUnit Unit.REGULAR
},
])
} ,
widgetGroup {
name "Current Open Tables"
widgets ([
barLineChart{
metric "Current Open Tables"
axisYUnit Unit.REGULAR
},
])
} ,
widgetGroup {
name "Queries Per Second"
widgets ([
barLineChart{
metric "Queries Per Second"
axisYUnit Unit.REGULAR
},
])
} ,
])
}
}