You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

Difference between revisions of "Switch Datacenter/db read-only"

From Wikitech-static
Jump to navigation Jump to search
imported>Jcrespo
imported>Volans
(Updated list of masters after masters switchover)
Line 1: Line 1:
List of current masters, per datacenter:
List of current masters excluding parsercache ones, per datacenter:
  root@neodymium:~$ cat eqiad-masters.txt
  volans@neodymium:~$ cat eqiad-nopc-masters.txt
  db1052.eqiad.wmnet
  db1057.eqiad.wmnet
  db1018.eqiad.wmnet
  db1018.eqiad.wmnet
  db1038.eqiad.wmnet
  db1075.eqiad.wmnet
  db1040.eqiad.wmnet
  db1042.eqiad.wmnet
  db1058.eqiad.wmnet
  db1049.eqiad.wmnet
  db1023.eqiad.wmnet
  db1050.eqiad.wmnet
  db1033.eqiad.wmnet
  db1041.eqiad.wmnet
  es1015.eqiad.wmnet
  es1015.eqiad.wmnet
  es1019.eqiad.wmnet
  es1019.eqiad.wmnet
  db1029.eqiad.wmnet
  db1031.eqiad.wmnet
  pc1004.eqiad.wmnet
  volans@neodymium:~$
pc1005.eqiad.wmnet
pc1006.eqiad.wmnet


  root@neodymium:~$ cat codfw-masters.txt
  volans@neodymium:~$ cat codfw-nopc-masters.txt
  db2016.codfw.wmnet
  db2016.codfw.wmnet
  db2017.codfw.wmnet
  db2017.codfw.wmnet
Line 26: Line 24:
  es2018.codfw.wmnet
  es2018.codfw.wmnet
  db2009.codfw.wmnet
  db2009.codfw.wmnet
pc2004.codfw.wmnet
pc2005.codfw.wmnet
pc2006.codfw.wmnet


* Check the current state of the masters (e.g. for codfw):
* Check the current state of the masters (e.g. for codfw):
  while read master; do salt $master cmd.run "mysql --defaults-file=/root/.my.cnf -A -BN -e \"SELECT @@global.read_only\""; done < codfw-masters.txt
  while read master; do salt $master cmd.run "mysql --defaults-file=/root/.my.cnf -A -BN -e \"SELECT @@global.read_only\""; done < codfw-nopc-masters.txt


* Set eqiad masters as read-only:
* Set eqiad masters as read-only:
  while read master; do salt $master cmd.run "mysql --defaults-file=/root/.my.cnf -A -BN -e \"SET GLOBAL read_only = 1\""; done < eqiad-masters.txt
  while read master; do salt $master cmd.run "mysql --defaults-file=/root/.my.cnf -A -BN -e \"SET GLOBAL read_only = 1\""; done < eqiad-nopc-masters.txt


* Set codfw masters as read-write:
* Set codfw masters as read-write:
  while read master; do salt $master cmd.run "mysql --defaults-file=/root/.my.cnf -A -BN -e \"SET GLOBAL read_only = 0\""; done < codfw-masters.txt
  while read master; do salt $master cmd.run "mysql --defaults-file=/root/.my.cnf -A -BN -e \"SET GLOBAL read_only = 0\""; done < codfw-nopc-masters.txt


The above commands will be greatly simplified when older servers will be decommissioned (which have a different and heterogeneous puppet class, and different mysql grants), so that we can just use salt or mysql to send the commands. Until then, explicitly indicate the masters.
The above commands will be greatly simplified when older servers will be decommissioned (which have a different and heterogeneous puppet class, and different mysql grants), so that we can just use salt or mysql to send the commands. Until then, explicitly indicate the masters.

Revision as of 13:09, 21 April 2016

List of current masters excluding parsercache ones, per datacenter:

volans@neodymium:~$ cat eqiad-nopc-masters.txt
db1057.eqiad.wmnet
db1018.eqiad.wmnet
db1075.eqiad.wmnet
db1042.eqiad.wmnet
db1049.eqiad.wmnet
db1050.eqiad.wmnet
db1041.eqiad.wmnet
es1015.eqiad.wmnet
es1019.eqiad.wmnet
db1031.eqiad.wmnet
volans@neodymium:~$
volans@neodymium:~$ cat codfw-nopc-masters.txt
db2016.codfw.wmnet
db2017.codfw.wmnet
db2018.codfw.wmnet
db2019.codfw.wmnet
db2023.codfw.wmnet
db2028.codfw.wmnet
db2029.codfw.wmnet
es2015.codfw.wmnet
es2018.codfw.wmnet
db2009.codfw.wmnet
  • Check the current state of the masters (e.g. for codfw):
while read master; do salt $master cmd.run "mysql --defaults-file=/root/.my.cnf -A -BN -e \"SELECT @@global.read_only\""; done < codfw-nopc-masters.txt
  • Set eqiad masters as read-only:
while read master; do salt $master cmd.run "mysql --defaults-file=/root/.my.cnf -A -BN -e \"SET GLOBAL read_only = 1\""; done < eqiad-nopc-masters.txt
  • Set codfw masters as read-write:
while read master; do salt $master cmd.run "mysql --defaults-file=/root/.my.cnf -A -BN -e \"SET GLOBAL read_only = 0\""; done < codfw-nopc-masters.txt

The above commands will be greatly simplified when older servers will be decommissioned (which have a different and heterogeneous puppet class, and different mysql grants), so that we can just use salt or mysql to send the commands. Until then, explicitly indicate the masters.