Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F32436341
T266483 run
No One
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Authored By
•
Kormat
Nov 5 2020, 9:49 AM
2020-11-05 09:49:39 (UTC+0)
Size
1 KB
Referenced Files
None
Subscribers
None
T266483 run
View Options
#!/bin/bash
set
-euo pipefail
IGNORE_REPLICAS
=
${
IGNORE_REPLICAS
:-
}
service_suffix
()
{
if
echo
$inst
|
grep -q :
;
then
echo
@
$section
;
fi
}
section
=
$1
;
shift
dc
=
$1
;
shift
for
fqdn in
$(
nodelist
"(A:db-section-
$section
and A:
$dc
) and not A:db-store"
)
;
do
inst
=
$(
host-to-instance
$fqdn
$section
)
echo
"====>
$inst
"
rep_host
=
$(
sudo -H mysql.py -h
$inst
-BN -e
'select @@report_host'
)
if
[
"
$rep_host
"
==
"
$fqdn
"
]
;
then
echo
"Already done"
continue
fi
if
[
-z
"
$IGNORE_REPLICAS
"
]
;
then
if
[
-n
"
$(
sudo -H mysql.py -h
$inst
-BN -e
'show slave hosts'
)
"
]
;
then
echo
"Not touching, has replicas"
continue
fi
fi
SSH_AUTH_SOCK
=
/run/keyholder/proxy.sock ssh root@
$fqdn
systemctl restart mariadb
$(
service_suffix
)
SSH_AUTH_SOCK
=
/run/keyholder/proxy.sock ssh root@
$fqdn
systemctl restart prometheus-mysqld-exporter
$(
service_suffix
)
if
[
-n
"
$(
sudo -H mysql.py -h
$inst
-BN -e
'show slave status'
)
"
]
;
then
sudo -H mysql.py -h
$inst
-e
'start slave'
fi
done
File Metadata
Details
Attached
Mime Type
text/plain; charset=utf-8
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
8610803
Default Alt Text
T266483 run (1 KB)
Attached To
Mode
P13146 T266483 run
Attached
Detach File
Event Timeline
Log In to Comment