Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
titleRDS/MySQL logging facilities
# enable general log (assumes "loadtest-edx-mysql56-1.11-with-query-log" is the name of the parameter group)
rds-modify-db-parameter-group loadtest-edx-mysql56-1.11-with-query-log --parameters "name=general_log,value=ON,method=immediate"

# retrieve general log
echossh 'select * from mysql.general_log' | ssh pwnage101@tools-t tools-gp.edx.org "mysql -u -user=read_only -h "-host=<hostname_of_db>" >output -p --execute='select * from mysql.general_log;'" >query_log.csv

# retrieve binlog (must be root user)
first_binlog=$(ssh -t tools-gp.edx.org "mysql -u -user=root --h "host=<hostname_of_db>" -ep --execute='show binary logs;' --skip-column-names" | head -n 1)
ssh tools-gp.edx.org "mysqlbinlog --raw --result-file=/tmp/binlogs/ --read-from-remote-server --to-last-log -u -user=root -h -host="<hostname_of_db>" -p "$first_binlog"

# view binlog locally
scp -r tools-gp.edx.org:/tmp/binlogs .
mysqlbinlog binlogs/*


Code Block
languagebash
titletest the migration with logging to assert the expected SQL statements will execute
# capture the current state of django migrations
ssh -t tools-gp.edx.org "mysql --user=read_only --host=<hostname_of_db> -p --execute='use wwc; select * from django_migrations;' --batch" >django_migrations_before_cms_migration.csv

# do something in mysql to mark the point in time before migrations begin:
select "before cms migration";

# on an instance containing all the migrations for the django 1.11 upgrade:
DB_MIGRATION_USER=<migration user name> DB_MIGRATION_PASS=<migration user password> /edx/bin/edxapp-migrate-cms
DB_MIGRATION_USER=<migration user name> DB_MIGRATION_PASS=<migration user password> /edx/bin/edxapp-migrate-lms