2014-12-22 15:53:17 +01:00
|
|
|
SET @start_global_value = @@global.innodb_encryption_threads;
|
|
|
|
SHOW VARIABLES LIKE 'innodb_encrypt%';
|
|
|
|
Variable_name Value
|
2015-04-09 20:44:56 +02:00
|
|
|
innodb_encrypt_log ON
|
2014-12-22 15:53:17 +01:00
|
|
|
innodb_encrypt_tables ON
|
|
|
|
innodb_encryption_rotate_key_age 15
|
|
|
|
innodb_encryption_rotation_iops 100
|
|
|
|
innodb_encryption_threads 4
|
2017-08-29 13:23:34 +02:00
|
|
|
SET GLOBAL innodb_encrypt_tables = ON;
|
|
|
|
# Wait max 10 min for key encryption threads to encrypt all spaces
|
2018-03-22 10:26:38 +01:00
|
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
|
|
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats';
|
2017-08-29 13:23:34 +02:00
|
|
|
NAME
|
2018-03-22 10:26:38 +01:00
|
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0
|
|
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats';
|
2017-08-29 13:23:34 +02:00
|
|
|
NAME
|
|
|
|
innodb_system
|
2014-12-22 15:53:17 +01:00
|
|
|
# Success!
|
|
|
|
# Now turn off encryption and wait for threads to decrypt everything
|
|
|
|
SET GLOBAL innodb_encrypt_tables = off;
|
2017-08-29 13:23:34 +02:00
|
|
|
# Wait max 10 min for key encryption threads to encrypt all spaces
|
2018-03-22 10:26:38 +01:00
|
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
|
|
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats';
|
2017-08-29 13:23:34 +02:00
|
|
|
NAME
|
|
|
|
innodb_system
|
2018-03-22 10:26:38 +01:00
|
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0
|
|
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats';
|
2017-08-29 13:23:34 +02:00
|
|
|
NAME
|
2014-12-22 15:53:17 +01:00
|
|
|
# Success!
|
|
|
|
# Shutdown innodb_encryption_threads
|
|
|
|
SET GLOBAL innodb_encryption_threads=0;
|
|
|
|
# Turn on encryption
|
|
|
|
# since threads are off tables should remain unencrypted
|
|
|
|
SET GLOBAL innodb_encrypt_tables = on;
|
|
|
|
# Wait 15s to check that nothing gets encrypted
|
2018-03-22 10:26:38 +01:00
|
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
|
|
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats';
|
2017-08-29 13:23:34 +02:00
|
|
|
NAME
|
|
|
|
innodb_system
|
2018-03-22 10:26:38 +01:00
|
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0
|
|
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats';
|
2017-08-29 13:23:34 +02:00
|
|
|
NAME
|
2014-12-22 15:53:17 +01:00
|
|
|
# Success!
|
|
|
|
# Startup innodb_encryption_threads
|
|
|
|
SET GLOBAL innodb_encryption_threads=@start_global_value;
|
2017-08-29 13:23:34 +02:00
|
|
|
# Wait max 10 min for key encryption threads to encrypt all spaces
|
2018-03-22 10:26:38 +01:00
|
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
|
|
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats';
|
2017-08-29 13:23:34 +02:00
|
|
|
NAME
|
2018-03-22 10:26:38 +01:00
|
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0
|
|
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats';
|
2017-08-29 13:23:34 +02:00
|
|
|
NAME
|
|
|
|
innodb_system
|
2014-12-22 15:53:17 +01:00
|
|
|
# Success!
|
|
|
|
# Restart mysqld --innodb_encrypt_tables=0 --innodb_encryption_threads=0
|
|
|
|
SHOW VARIABLES LIKE 'innodb_encrypt%';
|
|
|
|
Variable_name Value
|
2015-04-09 20:44:56 +02:00
|
|
|
innodb_encrypt_log ON
|
2014-12-22 15:53:17 +01:00
|
|
|
innodb_encrypt_tables OFF
|
|
|
|
innodb_encryption_rotate_key_age 15
|
|
|
|
innodb_encryption_rotation_iops 100
|
|
|
|
innodb_encryption_threads 0
|
2018-03-22 10:26:38 +01:00
|
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0
|
|
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats';
|
2017-08-29 13:23:34 +02:00
|
|
|
NAME
|
|
|
|
innodb_system
|
2018-03-22 10:26:38 +01:00
|
|
|
SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION = 0
|
|
|
|
AND NAME NOT LIKE 'innodb_undo%' AND NAME NOT LIKE 'mysql/innodb_%_stats';
|
2017-08-29 13:23:34 +02:00
|
|
|
NAME
|