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'>dbSlowQueryLogFile</target>
</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>
<help/>
</creole>

View File

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