SQWareProduction:mysql:etc:sqwmys GlobalVar.cfg

De WikiFr

Configuration file $gvsqw_MysBin/../etc/sqwmys_GlobalVar.cfg:
Global var for Mysql
Contient les variables operationnelles de SQWareProduction.

Contenu du fichier:

#!/bin/ksh
###################################################################
# SQWareProduction for Mysql module of dbSQWare
# 
# dbSQWare is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# CGU/CGA for more details.
# 
# You should have received a copy of the CGU/CGA
# along with this program.  If not, see <http://www.dbsqware.com/licenses/>.
# 
# For information : contact@dbsqware.com or www.dbsqware.com
###################################################################
## @Synopsis	Global var for Mysql
## @Copyright	Copyright 2010-2020, dbSQWare (www.dbsqware.com)

#global
if [ -r $MYSQL_HOME/tmp/$MYSQL_SID.sock ]
then
	export gvsqw_MysqlSock='$MYSQL_HOME/tmp/$MYSQL_SID.sock'
elif [ -r $MYSQL_DATA/tmp/$MYSQL_SID.sock ]
then
	export gvsqw_MysqlSock='$MYSQL_DATA/tmp/$MYSQL_SID.sock'
elif [ -r /tmp/$MYSQL_SID.sock ]
then
	export gvsqw_MysqlSock='/tmp/$MYSQL_SID.sock'
elif [ -r "/var/lib/mysql/mysql.sock" ]
then
	export gvsqw_MysqlSock='/var/lib/mysql/mysql.sock'
elif [ -r "/var/lib/mysqld/mysql.sock" ]
then
	export gvsqw_MysqlSock='/var/lib/mysqld/mysql.sock'
elif [ -r "/var/lib64/mysql/mysql.sock" ]
then
	export gvsqw_MysqlSock='/var/lib64/mysql/mysql.sock'
elif [ -r "/var/lib64/mysqld/mysql.sock" ]
then
	export gvsqw_MysqlSock='/var/lib64/mysqld/mysql.sock'
elif [ -r /tmp/mysql.sock ]
then
	export gvsqw_MysqlSock='/tmp/mysql.sock'
fi

export gvsqw_DbaUser="$gvsqw_UserExec"
export gvsqw_ConnectString='-S $gvsqw_MysqlSock -u $gvsqw_DbaUser'
export gvsqw_DistConnectString='-h $gvsqw_MysqlHost -P $gvsqw_MysqlPort -u$gvsqw_DbaUser -p$gvsqw_DbaUserPasswd'
export gvsqw_SuppArchSlow=30
export gvsqw_RootAdmin='$HOME/${MYSQL_SID}'
export gvsqw_RootAdminDisable='$HOME'
export gvsqw_RootAdminDist='$HOME/admin/mysql/${MYSQL_SID}'
export gvsqw_RootCfg='$gvsqw_RootAdmin/sqwConfig'
export gvsqw_RootDbf='/$(echo ${HOME}|cut -d/ -f2)/data/${MYSQL_SID}'
#export gvsqw_GenExcludeDatabasesWhereClause="and SCHEMA_NAME not in ('SQWareProduction','${MYSQL_SID}','tmp','logs') and SCHEMA_NAME not like '%#%' and SCHEMA_NAME not like '% %'"
export gvsqw_GenExcludeDatabasesWhereClause="and table_schema not like '%#%' and table_schema not like '% %' and table_schema != 'performance_schema' and table_schema != 'sys'"
export gvsqw_DbAlias='$MYSQL_SID'
export gvsqw_NbThreadOptimize=2
export gvsqw_NbThreadAnalyze=2
export gvsqw_NbThreadDump=2
export gvsqw_NbThreadCopyDump=2
export gvsqw_NbThreadRestore=2
export gvsqw_NbThreadCheck=2
export gvsqw_NotMysqlErrorMsg="_ERROR |_FAILED |_ERREUR |_ECHEC |'ERROR |'FAILED |'ERREUR |'ECHEC "
#To ignore mysqldump errors, example : gvsqw_NotMysqldumpErrorMsg="mysqldump: Error 1412" to ignore "mysqldump: Error 1412: Table definition has changed, please retry transaction when dumping table ..."
export gvsqw_NotMysqldumpErrorMsg="mysqldump: Error ToBeCustomize"

#for indicators
export gvsqw_SizeMinTableIndicators=10
export gvsqw_GenExcludeDatabasesObjects="and TABLES.TABLE_SCHEMA not in ('performance_schema','mysql','information_schema','sys')"
export gvsqw_GenExcludeDatabasesObjectsExtra=""

#for Dump scripts
export gvsqw_RootDump='$HOME/mys_dump/$MYSQL_SID'
export gvsqw_RootDumpSource='$HOME/mys_dump/$lvsqw_InstanceSource'
export gvsqw_ExcludeDatabasesCopy='^mysql$|^information_schema$|^performance_schema$'
export gvsqw_DumpNbGeneration=2
export gvsqw_DumpCompressorExt=gz
export gvsqw_DefCopyDumpNbGeneration=1
export gvsqw_ConsistentInnoDb="--single-transaction"
export gvsqw_ConsistentOthers="--lock-tables"
export gvsqw_MysqlDumpOpt='$gvsqw_ConnectString --create-options -f --max_allowed_packet=1000000000 --net_buffer_length=16M ${lfsqw_SqlOpt}${lvsqw_AdditionalOption} -R -q --databases ${lvsqw_DbName}'
export gvsqw_RsyncDefaultSourceDir='$HOME/mys_dump/$MYSQL_SID'
export gvsqw_DropDb=Enable
export gvsqw_CreateDb=Enable

#for XtraBackup scripts
export gvsqw_RootXtraBackup='$HOME/XtraBackup/$MYSQL_SID'
export gvsqw_RootXtraBackupSource='$HOME/XtraBackup/$lvsqw_InstanceSource'
export gvsqw_XtraBackupNbGeneration=2
export gvsqw_XtraBackupWaitTimeOut=900

#for MariaBackup scripts
export gvsqw_RootMariaBackup='$HOME/MariaBackup/$MYSQL_SID'
export gvsqw_RootMariaBackupSource='$HOME/MariaBackup/$lvsqw_InstanceSource'
export gvsqw_MariaBackupNbGeneration=2
export gvsqw_MariaBackupWaitTimeOut=900

#for rotate slowquery (put yes to no copy to webdba)
export gvsqw_LocalSlowQuery=no

##Globaly forcing return code for scripts
#export gvsqw_ForcedReturnCodeScript_sqwmys_DumpDatabase=0

#for SQWareWeb
#export gvsqw_WebDbaDirSlowQuery='Directory to store SlowQuery files'


Explication de variables:

#General variables
gvsqw_SqwVersion => SQWare Production version
gvsqw_MysqlSock => Path to MySQL sock file
gvsqw_ConnectDb => if connection to db evalable then Enable else Disable
gvsqw_Hostname => Hostname for prompt and trace
gvsqw_GlobalMsgMail => Begining of email subject
gvsqw_GlobalMail => email adress, put NoNail in gvsqw_GlobalMail if you don't want to send mail on error
gvsqw_SendmailHtmlFormat => Html format for email, put disable in gvsqw_SendmailHtmlFormat if you don't want to send mail in html format
gvsqw_PreFormatHtlml => enable if file is already formated
gvsqw_Colors => enable, put disable in gvsqw_Colors if you don't want to print in color
gvsqw_TraceJobDb => enable, put disable in gvsqw_TraceJobDb if you don't want to trace job execution in SQWareRepository
gvsqw_EgrepIvFs => for 'egrep -v' on 'df' command
gvsqw_SuppLogsHisto => number of days to delete log files
gvsqw_GzipLogsHisto => number of days to compress log files
gvsqw_SuppArchAlert => number of days to delete archives of alert files
gvsqw_SuppArchSlow => number of days to delete archives of slow query files
gvsqw_RootAdmin => admin directory
gvsqw_RootCfg => configuration directory
gvsqw_RootDbf => datafiles directory
gvsqw_InitInstanceSourceCommand => Init profile instance command
gvsqw_NbThread => default number of thread for parallelism
gvsqw_MysqlErrorMsg => format of MySQL errors
gvsqw_SshOptions => ssh default options
gvsqw_ScpOptions => scp default options

#Html tags
gvsqw_CHtmlError => font tag for error
gvsqw_CHtmlOk => font tag for OK
gvsqw_CHtmlInfo => font tag for info
gvsqw_CHtmlEnd => end font tag
gvsqw_THtmlBegin => table tag
gvsqw_THtmlEnd => end table tag
gvsqw_THtmlThBegin => th tag
gvsqw_THtmlThEnd => end th tag
gvsqw_THtmlThInter => inter th tag
gvsqw_THtmlTdBegin1 => td tag sqwnc
gvsqw_THtmlTdBegin2 => td tag sqwc_
gvsqw_THtmlTdEnd => end td tag
gvsqw_THtmlTdInter => inter td tag
gvsqw_THtmlPre => tag for pre formated text
gvsqw_THtmlPreEnd => end tag for pre formated text
gvsqw_HtmlCss => CSS style

#for Dump scripts
gvsqw_NbThreadDump => default number of thread for parallelism for mysqlDump
gvsqw_RootDump => default mysqlDump directory
gvsqw_DumpNbGeneration => default number generation of mysqlDump to keep online
gvsqw_ConsistentInnoDb => command to make mysqlDump consistent where engine = InnoDb
gvsqw_ConsistentOthers => command to make mysqlDump consistent where engine != InnoDb
gvsqw_MysqlDumpOpt => mysql Dump command
#Put disable in gvsqw_TraceBackup if you don't want to trace backup execution in SQWareRepository
gvsqw_TraceBackup => to trace backup execution in SQWare repository

#for optimize scripts
gvsqw_NbThreadOptimize => default number of thread for parallelism for optimize

#for analyse scripts
gvsqw_NbThreadAnalyze => default number of thread for parallelism for analyse

##Globaly forcing return code for scripts
gvsqw_ForcedReturnCodeScript_sqwmys_DumpDatabase => To force return code of sqwmys_DumpDatabase.ksh
...

#for SQWare Web
gvsqw_WebDbaURL => SQWare Web URL
gvsqw_WebDbaUserConn => Connection string ssh user@hostname to SQWare Web
gvsqw_WebDbaDirSlowQuery => Directory to store SlowQuery files on SQWare Web
Information.png
Information:
Vous pouvez surcharger les variables contenues dans $gvsqw_MysBin/../etc/sqwmys_GlobalVar.cfg

en mettant les memes noms de variables dans $gvsqw_MysBin/../etc_cust/sqwmys_GlobalVar.cfg pour tous vos environnements
ou dans $HOME/sqwConfig/sqwmys_GlobalVar.cfg pour cet utilisateur specialement.