Managing "Node" mode

This commit is contained in:
Philippe Caseiro 2018-04-12 17:38:56 +02:00
parent e87d3ccf69
commit 414154a832
2 changed files with 22 additions and 2 deletions

View File

@ -192,6 +192,14 @@
<target type='variable'>dbSlowQueryLogTime</target> <target type='variable'>dbSlowQueryLogTime</target>
<target type='variable'>dbSlowQueryLogFile</target> <target type='variable'>dbSlowQueryLogFile</target>
</condition> </condition>
<condition name='disabled_if_in' source="dbClusterPosition">
<param>Node</param>
<target type='variable'>dbCreateFixAdmin</target>
<target type='variable'>accName</target>
<target type='variable'>accLimits</target>
<target type='variable'>accLimitTarget</target>
</condition>
</constraints> </constraints>
<help/> <help/>
</creole> </creole>

View File

@ -2,6 +2,12 @@
todo=$(CreoleGet dbCreateFixAdmin 'non') todo=$(CreoleGet dbCreateFixAdmin 'non')
autoRepair=$(CreoleGet dbAutoOptimizeAndRepare 'non') autoRepair=$(CreoleGet dbAutoOptimizeAndRepare 'non')
role=$(CreoleGet dbClusterPosition 'Leader')
if [[ ${role} == 'Node' ]]
then
exit 0
fi
if [[ ${todo} != 'non' ]] if [[ ${todo} != 'non' ]]
then then
@ -13,6 +19,9 @@ then
tempFile=$(mktemp -p /root) tempFile=$(mktemp -p /root)
sqlFile=$(mktemp -p /root) sqlFile=$(mktemp -p /root)
password=$(pwgen -1 10)
/usr/share/eole/sbin/mariaPwd ${password}
accounts=($(CreoleGet accName)) accounts=($(CreoleGet accName))
limits="$(CreoleGet accLimitTarget '')" limits="$(CreoleGet accLimitTarget '')"
accLimits=(${limits// /}) accLimits=(${limits// /})
@ -55,7 +64,7 @@ then
index=$((index+1)) index=$((index+1))
done done
mysql < ${sqlFile} mysql -u root --password=${password} < ${sqlFile}
mv ${tempFile} ${readerfile} mv ${tempFile} ${readerfile}
chmod 600 ${readerfile} chmod 600 ${readerfile}
@ -64,7 +73,10 @@ fi
if [[ ${autoRepair} == "oui" ]] if [[ ${autoRepair} == "oui" ]]
then then
mysqlcheck -u root --auto-repair --check --optimize --all-databases
mysqlcheck -u root -p ${password} --auto-repair --check --all-databases
mysqlcheck -u root -p ${password} --optimize --check --all-databases
fi fi
exit 0 exit 0