資料庫儲存線上升級
阿新 • • 發佈:2018-12-25
業務資料庫儲存升級,磁碟使用linux的LVM。業務資料檔案線上遷移,由機械磁碟遷移至固態磁碟。
檢視pv使用情況
[[email protected] ~]# pvs -o+pv_used PV VG Fmt Attr PSize PFree Used /dev/sda2 centos lvm2 a-- <49.00g 4.00m 48.99g /dev/sdb data lvm2 a-- <50.00g 0 <50.00g /dev/sdc data lvm2 a-- <100.00g <100.00g 0
sdb是機械磁碟,sdc是固態磁碟
[[email protected] ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 47G 3.7G 44G 8% / devtmpfs 1.9G 0 1.9G 0% /dev tmpfs 1.9G 0 1.9G 0% /dev/shm tmpfs 1.9G 8.9M 1.9G 1% /run tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup /dev/sda1 1014M 177M 838M 18% /boot /dev/mapper/data-data 50G 27G 20G 58% /opt tmpfs 380M 8.0K 380M 1% /run/user/42 tmpfs 380M 0 380M 0% /run/user/0
lv是/dev/data/data,掛載目錄opt。
線上遷移sdb資料至sdc
[[email protected] ~]# pvcreate /dev/sdc
Physical volume "/dev/sdc" successfully created.
[[email protected] ~]# vgscan
Reading volume groups from cache.
Found volume group "data" using metadata type lvm2
Found volume group "centos" using metadata type lvm2
[ [email protected]lueking ~]# vgdisplay
--- Volume group ---
VG Name data
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 1
Act PV 1
VG Size <50.00 GiB
PE Size 4.00 MiB
Total PE 12799
Alloc PE / Size 12799 / <50.00 GiB
Free PE / Size 0 / 0
VG UUID 9hVVbu-b84c-Uhtt-tJFU-W4Yu-lJ0M-ewr73Q
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size <49.00 GiB
PE Size 4.00 MiB
Total PE 12543
Alloc PE / Size 12542 / 48.99 GiB
Free PE / Size 1 / 4.00 MiB
VG UUID kE2AR5-lbFd-PV9e-N6qa-DlPa-5nRk-NX9rBi
[[email protected] ~]# vgextend data /dev/sdc
Volume group "data" successfully extended
[[email protected] ~]# vgdisplay
--- Volume group ---
VG Name data
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2
Act PV 2
VG Size 149.99 GiB
PE Size 4.00 MiB
Total PE 38398
Alloc PE / Size 12799 / <50.00 GiB
Free PE / Size 25599 / <100.00 GiB
VG UUID 9hVVbu-b84c-Uhtt-tJFU-W4Yu-lJ0M-ewr73Q
--- Volume group ---
VG Name centos
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 3
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 2
Open LV 2
Max PV 0
Cur PV 1
Act PV 1
VG Size <49.00 GiB
PE Size 4.00 MiB
Total PE 12543
Alloc PE / Size 12542 / 48.99 GiB
Free PE / Size 1 / 4.00 MiB
VG UUID kE2AR5-lbFd-PV9e-N6qa-DlPa-5nRk-NX9rBi
遷移資料
[[email protected] ~]# pvmove /dev/sdb
/dev/sdb: Moved: 0.00%
/dev/sdb: Moved: 1.48%
/dev/sdb: Moved: 3.15%
/dev/sdb: Moved: 4.50%
/dev/sdb: Moved: 5.59%
/dev/sdb: Moved: 7.02%
/dev/sdb: Moved: 7.75%
/dev/sdb: Moved: 8.87%
/dev/sdb: Moved: 9.81%
/dev/sdb: Moved: 11.34%
/dev/sdb: Moved: 12.84%
/dev/sdb: Moved: 13.62%
/dev/sdb: Moved: 14.99%
/dev/sdb: Moved: 16.49%
/dev/sdb: Moved: 17.92%
/dev/sdb: Moved: 19.18%
/dev/sdb: Moved: 20.29%
/dev/sdb: Moved: 21.68%
/dev/sdb: Moved: 23.15%
/dev/sdb: Moved: 24.51%
/dev/sdb: Moved: 25.90%
/dev/sdb: Moved: 27.31%
/dev/sdb: Moved: 28.74%
/dev/sdb: Moved: 29.42%
/dev/sdb: Moved: 29.93%
/dev/sdb: Moved: 30.70%
/dev/sdb: Moved: 31.43%
/dev/sdb: Moved: 31.96%
/dev/sdb: Moved: 32.23%
/dev/sdb: Moved: 32.78%
/dev/sdb: Moved: 33.38%
/dev/sdb: Moved: 34.83%
/dev/sdb: Moved: 36.26%
/dev/sdb: Moved: 37.78%
/dev/sdb: Moved: 39.25%
/dev/sdb: Moved: 40.77%
/dev/sdb: Moved: 42.15%
/dev/sdb: Moved: 43.63%
/dev/sdb: Moved: 45.21%
/dev/sdb: Moved: 46.71%
/dev/sdb: Moved: 48.10%
/dev/sdb: Moved: 49.53%
/dev/sdb: Moved: 50.96%
/dev/sdb: Moved: 52.51%
/dev/sdb: Moved: 53.94%
/dev/sdb: Moved: 55.47%
/dev/sdb: Moved: 56.97%
/dev/sdb: Moved: 58.43%
/dev/sdb: Moved: 59.80%
/dev/sdb: Moved: 61.23%
/dev/sdb: Moved: 62.57%
/dev/sdb: Moved: 63.87%
/dev/sdb: Moved: 65.23%
/dev/sdb: Moved: 66.56%
/dev/sdb: Moved: 67.90%
/dev/sdb: Moved: 69.35%
/dev/sdb: Moved: 70.95%
/dev/sdb: Moved: 72.67%
/dev/sdb: Moved: 74.74%
/dev/sdb: Moved: 76.69%
/dev/sdb: Moved: 78.26%
/dev/sdb: Moved: 80.27%
/dev/sdb: Moved: 81.95%
/dev/sdb: Moved: 83.77%
/dev/sdb: Moved: 85.56%
/dev/sdb: Moved: 87.39%
/dev/sdb: Moved: 89.14%
/dev/sdb: Moved: 90.94%
/dev/sdb: Moved: 92.68%
/dev/sdb: Moved: 94.68%
/dev/sdb: Moved: 96.68%
/dev/sdb: Moved: 98.06%
/dev/sdb: Moved: 100.00%
遷移過程中,lv沒有離線,目錄cp資料
[[email protected] opt]# scp -r mysql mongodb [email protected]:/opt
[email protected]'s password:
thr_rwlock.h 100% 6044 505.9KB/s 00:00
sql_common.h 100% 7711 864.1KB/s 00:00
thr_mutex.h 100% 5679 1.9MB/s 00:00
mysql_time.h 100% 2172 811.9KB/s 00:00
my_list.h 100% 1506 576.0KB/s 00:00
plugin_validate_password.h 100% 1583 196.9KB/s 00:00
my_thread.h 100% 4877 849.7KB/s 00:00
plugin_keyring.h 100% 6290 1.4MB/s 00:00
my_alloc.h 100% 2312 1.2MB/s 00:00
sslopt-case.h 100% 2222 1.3MB/s 00:00
plugin.h 100% 26KB 6.2MB/s 00:00
my_sys.h 100% 39KB 7.0MB/s 00:00
service_thd_alloc.h 100% 4331 845.2KB/s 00:00
thread_pool_priv.h 100% 6132 614.2KB/s 00:00
service_mysql_string.h 100% 5355 2.0MB/s 00:00
plugin_group_replication.h 100% 5669 909.0KB/s 00:00
service_rpl_transaction_write_set.h 100% 2520 624.5KB/s 00:00
plugin_ftparser.h 100% 7644 2.6MB/s 00:00
plugin_auth.h 100% 5363 1.4MB/s 00:00
service_ssl_wrapper.h 100% 5149 2.9MB/s 00:00
service_mysql_keyring.h 100% 2454 969.5KB/s 00:00
innodb_priv.h 100% 2167 1.3MB/s 00:00
plugin_auth_common.h 100% 4846 1.9MB/s 00:00
service_srv_session.h 100% 4888 1.6MB/s 00:00
service_mysql_password_policy.h 100% 2436 1.8MB/s 00:00
client_plugin.h.pp 100% 1988 921.4KB/s 00:00
com_data.h 100% 3105 1.1MB/s 00:00
service_rules_table.h 100% 5087 1.6MB/s 00:00
service_security_context.h 100% 4058 1.3MB/s 00:00
service_command.h 100% 13KB 3.4MB/s 00:00
plugin.h 100% 26KB 7.1MB/s 00:00
mysql_file.h 100% 38KB 3.5MB/s 00:00
mysql_table.h 100% 4041 281.0KB/s 00:00
psi_base.h 100% 3485 864.1KB/s 00:00
mysql_thread.h 100% 33KB 5.2MB/s 00:00
mysql_sp.h 100% 2837 297.3KB/s 00:00
mysql_ps.h 100% 3703 588.9KB/s 00:00
mysql_idle.h 100% 2590 402.8KB/s 00:00
psi_memory.h 100% 4076 1.5MB/s 00:00
mysql_transaction.h 100% 6828 1.2MB/s 00:00
mysql_mdl.h 100% 3309 1.3MB/s 00:00
mysql_memory.h 100% 1679 627.6KB/s 00:00
mysql_socket.h 100% 32KB 9.0MB/s 00:00
mysql_statement.h 100% 6618 2.1MB/s 00:00
psi.h 100% 85KB 5.7MB/s 00:00
mysql_stage.h 100% 4791 1.1MB/s 00:00
client_authentication.h 100% 1077 702.7KB/s 00:00
service_parser.h 100% 9402 3.4MB/s 00:00
service_mysql_alloc.h 100% 2760 1.0MB/s 00:00
thread_type.h 100% 1384 475.4KB/s 00:00
client_plugin.h 100% 6460 3.1MB/s 00:00
service_rpl_transaction_ctx.h 100% 2361 748.9KB/s 00:00
plugin_validate_password.h 100% 1583 726.4KB/s 00:00
plugin_keyring.h 100% 6290 1.8MB/s 00:00
service_locking.h 100% 4334 2.3MB/s 00:00
services.h.pp 100% 21KB 6.1MB/s 00:00
service_thd_wait.h 100% 3945 3.5MB/s 00:00
plugin_keyring.h.pp 100% 4458 1.5MB/s 00:00
plugin_ftparser.h.pp 100% 4871 2.3MB/s 00:00
mysql_lex_string.h 100% 1096 523.0KB/s 00:00
service_my_snprintf.h 100% 3409 1.5MB/s 00:00
get_password.h 100% 1198 390.6KB/s 00:00
services.h 100% 1948 655.2KB/s 00:00
service_thd_engine_lock.h 100% 1489 422.8KB/s 00:00
plugin_trace.h 100% 12KB 4.5MB/s 00:00
plugin_auth.h.pp 100% 5147 2.6MB/s 00:00
plugin_audit.h 100% 17KB 5.4MB/s 00:00
plugin_audit.h.pp 100% 14KB 3.8MB/s 00:00
group_replication_priv.h 100% 4727 2.7MB/s 00:00
service_srv_session_info.h 100% 5234 2.5MB/s 00:00
service_my_plugin_log.h 100% 1678 891.8KB/s 00:00
service_thread_scheduler.h 100% 2682 976.2KB/s 00:00
typelib.h 100% 2282 1.1MB/s 00:00
plugin_audit.h 100% 17KB 5.4MB/s 00:00
byte_order_generic_x86.h 100% 2190 801.6KB/s 00:00
big_endian.h 100% 3654 1.5MB/s 00:00
my_compiler.h 100% 5130 1.5MB/s 00:00
mysqld_ername.h 100% 117KB 20.6MB/s 00:00
my_command.h 100% 1667 1.1MB/s 00:00
sslopt-vars.h 100% 2902 1.3MB/s 00:00
my_dbug.h 100% 9391 4.9MB/s 00:00
sql_state.h 100% 15KB 3.6MB/s 00:00
my_byteorder.h 100% 5488 3.0MB/s 00:00
sslopt-longopts.h 100% 2878 1.2MB/s 00:00
my_thread_local.h 100% 2566 911.2KB/s 00:00
errmsg.h 100% 4350 1.3MB/s 00:00
thr_cond.h 100% 5148 1.1MB/s 00:00
mysql_com_server.h 100% 1313 1.1MB/s 00:00
little_endian.h 100% 3233 286.9KB/s 00:00
plugin_group_replication.h 100% 5669 1.0MB/s 00:00
mysql_embed.h 100% 1142 131.7KB/s 00:00
keycache.h 100% 7489 1.6MB/s 00:00
my_xml.h 100% 2821 1.0MB/s 00:00
my_global.h 100% 22KB 3.9MB/s 00:00
plugin_ftparser.h 100% 7644 1.1MB/s 00:00
m_string.h 100% 10KB 3.7MB/s 00:00
my_getopt.h 100% 6456 2.0MB/s 00:00
byte_order_generic.h 100% 2555 1.3MB/s 00:00
mysqld_error.h 100% 43KB 8.4MB/s 00:00
decimal.h 100% 5175 1.6MB/s 00:00
binary_log_types.h 100% 1967 967.4KB/s 00:00
my_config.h 100% 12KB 4.5MB/s 00:00
mysql_version.h 100% 1013 415.4KB/s 00:00
mysql_com.h 100% 24KB 6.4MB/s 00:00
m_ctype.h 100% 33KB 9.2MB/s 00:00
mysql.h 100% 28KB 11.1MB/s 00:00
my_dir.h 100% 3012 2.1MB/s 00:00
mysqld_multi.server 100% 1061 132.7KB/s 00:00
mysql-log-rotate 100% 894 302.7KB/s 00:00
magic 100% 773 116.9KB/s 00:00
mysql.server.bak 100% 10KB 1.1MB/s 00:00
mysql.server 100% 10KB 1.1MB/s 00:00
INFO_SRC 100% 185 147.0KB/s 00:00
INFO_BIN 100% 5867 1.9MB/s 00:00
ChangeLog 100% 163KB 20.1MB/s 00:00
libmysqlservices.a 100% 41KB 6.6MB/s 00:00
libmysqld.a 100% 517MB 62.6MB/s 00:08
libmysqlclient.so.20.3.8 100% 9303KB 75.7MB/s 00:00
libtest_x_sessions_init.so 100% 70KB 4.2MB/s 00:00
mysqlx.so 100% 21MB 50.4MB/s 00:00
libtest_services.so 100% 46KB 5.2MB/s 00:00
ha_example.so 100% 447KB 25.3MB/s 00:00
libtest_sql_all_col_types.so 100% 104KB 8.8MB/s 00:00
rewrite_example.so 100% 41KB 6.7MB/s 00:00
adt_null.so 100% 83KB 15.3MB/s 00:00
libtest_sql_sqlmode.so 100% 130KB 15.7MB/s 00:00
locking_service.so 100% 20KB 6.2MB/s 00:00
rewriter.so 100% 575KB 28.1MB/s 00:00
libtest_sql_cmds_1.so 100% 200KB 8.0MB/s 00:00
group_replication.so 100% 20MB 51.2MB/s 00:00
mypluglib.so 100% 45KB 5.7MB/s 00:00
version_token.so 100% 469KB 33.4MB/s 00:00
libtest_sql_replication.so 100% 126KB 12.2MB/s 00:00
libtest_sql_lock.so 100% 113KB 24.9MB/s 00:00
libtest_session_in_thd.so 100% 59KB 19.5MB/s 00:00
test_udf_services.so 100% 38KB 9.3MB/s 00:00
libtest_sql_shutdown.so 100% 98KB 22.5MB/s 00:00
libmemcached.so 100% 718KB 38.7MB/s 00:00
authentication_ldap_sasl_client.so 100% 298KB 43.7MB/s 00:00
libtest_x_sessions_deinit.so 100% 53KB 8.8MB/s 00:00
innodb_engine.so 100% 887KB 30.8MB/s 00:00
libtest_session_detach.so 100% 84KB 10.3MB/s 00:00
auth_socket.so 100% 35KB 8.6MB/s 00:00
libtest_sql_views_triggers.so 100% 130KB 17.4MB/s 00:00
libtest_services_threaded.so 100% 58KB 9.9MB/s 00:00
libtest_sql_2_sessions.so 100% 102KB 12.8MB/s 00:00
keyring_file.so 100% 915KB 35.9MB/s 00:00
keyring_udf.so 100% 425KB 19.3MB/s 00:00
validate_password.so 100% 197KB 17.0MB/s 00:00
libtest_sql_commit.so 100% 106KB 16.0MB/s 00:00
test_security_context.so 100% 42KB 12.2MB/s 00:00
libpluginmecab.so 100% 8755KB 74.3MB/s 00:00
libtest_framework.so 100% 45KB 5.5MB/s 00:00
test_security_context.so 100% 41KB 3.5MB/s 00:00
auth_socket.so 100% 33KB 10.4MB/s 00:00
innodb_engine.so 100% 512KB 14.7MB/s 00:00
libtest_sql_views_triggers.so 100% 111KB 7.8MB/s 00:00
libtest_x_sessions_init.so 100% 65KB 20.0MB/s 00:00
libtest_session_in_thd.so 100% 50KB 15.2MB/s 00:00
libtest_sql_shutdown.so 100% 88KB 19.2MB/s 00:00
libtest_framework.so 100% 41KB 13.9MB/s 00:00
semisync_slave.so 100% 131KB 19.0MB/s 00:00
connection_control.so 100% 677KB 4.4MB/s 00:00
validate_password.so 100% 153KB 5.4MB/s 00:00
mysql_no_login.so 100% 32KB 6.4MB/s 00:00
semisync_master.so 100% 713KB 22.4MB/s 00:00
libtest_sql_all_col_types.so 100% 91KB 27.5MB/s 00:00
libtest_sql_errors.so 100% 92KB 7.7MB/s 00:00
keyring_udf.so 100% 277KB 31.7MB/s 00:00
libpluginmecab.so 100% 8740KB 51.5MB/s 00:00
libtest_sql_commit.so 100% 91KB 9.2MB/s 00:00
mysqlx.so 100% 13MB 69.2MB/s 00:00
libmemcached.so 100% 425KB 32.5MB/s 00:00
authentication_ldap_sasl_client.so 100% 109KB 28.0MB/s 00:00
libtest_sql_sqlmode.so 100% 112KB 7.5MB/s 00:00
libtest_sql_replication.so 100% 103KB 33.9MB/s 00:00
rewrite_example.so 100% 40KB 18.6MB/s 00:00
adt_null.so 100% 69KB 22.6MB/s 00:00
libtest_sql_stored_procedures_functions.so 100% 111KB 32.2MB/s 00:00
rewriter.so 100% 387KB 39.5MB/s 00:00
libtest_services.so 100% 46KB 11.5MB/s 00:00
locking_service.so 100% 22KB 6.9MB/s 00:00
libtest_session_info.so 100% 103KB 8.2MB/s 00:00
mypluglib.so 100% 43KB 14.9MB/s 00:00
libtest_sql_complex.so 100% 112KB 567.6KB/s 00:00
keyring_file.so 100% 691KB 3.3MB/s 00:00
group_replication.so 100% 12MB 27.2MB/s 00:00
ha_example.so 100% 326KB 2.8MB/s 00:00
libtest_services_threaded.so 100% 51KB 13.6MB/s 00:00
version_token.so 100% 280KB 29.2MB/s 00:00
libtest_session_detach.so 100% 81KB 17.7MB/s 00:00
libtest_sql_processlist.so 100% 88KB 21.6MB/s 00:00
test_udf_services.so 100% 38KB 13.1MB/s 00:00
libtest_sql_2_sessions.so 100% 91KB 22.7MB/s 00:00
libtest_x_sessions_deinit.so 100% 51KB 17.4MB/s 00:00
libtest_sql_lock.so 100% 94KB 22.4MB/s 00:00
libtest_sql_cmds_1.so 100% 109KB 22.6MB/s 00:00
libtest_sql_processlist.so 100% 93KB 20.7MB/s 00:00
libtest_sql_errors.so 100% 104KB 22.7MB/s 00:00
libtest_sql_stored_procedures_functions.so 100% 130KB 22.7MB/s 00:00
libtest_session_info.so 100% 119KB 22.4MB/s 00:00
semisync_slave.so 100% 148KB 25.1MB/s 00:00
libtest_sql_complex.so 100% 134KB 25.4MB/s 00:00
connection_control.so 100% 888KB 31.8MB/s 00:00
mysql_no_login.so 100% 33KB 11.9MB/s 00:00
semisync_master.so 100% 859KB 33.1MB/s 00:00
libmysqlclient.a 100% 20MB 32.7MB/s 00:00
char.bin 100% 256KB 16.3MB/s 00:00
pos-id.def 100% 1477 275.6KB/s 00:00
sys.dic 100% 47MB 45.9MB/s 00:01
right-id.def 100% 55KB 18.4MB/s 00:00
unk.dic 100% 5690 4.4MB/s 00:00
left-id.def 100% 55KB 20.2MB/s 00:00
dicrc 100% 693 696.0KB/s 00:00
matrix.bin 100% 3383KB 50.1MB/s 00:00
rewrite.def 100% 6241 2.9MB/s 00:00
pos-id.def 100% 1477 194.1KB/s 00:00
sys.dic 100% 36MB 61.4MB/s 00:00
rewrite.def 100% 6241 3.6MB/s 00:00
left-id.def 100% 55KB 25.5MB/s 00:00
matrix.bin 100% 3383KB 52.8MB/s 00:00
right-id.def 100% 55KB 14.7MB/s 00:00
unk.dic 100% 5409 2.5MB/s 00:00
dicrc 100% 693 60.8KB/s 00:00
char.bin 100% 256KB 44.7MB/s 00:00
sys.dic 100% 36MB 55.9MB/s 00:00
pos-id.def 100% 1477 144.7KB/s 00:00
right-id.def 100% 55KB 3.4MB/s 00:00
matrix.bin 100% 3383KB 58.5MB/s 00:00
left-id.def 100% 55KB 12.5MB/s 00:00
dicrc 100% 693 785.3KB/s 00:00
unk.dic 100% 5409 1.2MB/s 00:00
rewrite.def 100% 6241 1.5MB/s 00:00
char.bin 100% 256KB 17.2MB/s 00:00
mecabrc 100% 981 809.5KB/s 00:00
libmysqlclient.so 100% 9303KB 59.3MB/s 00:00
libmysqlclient.so.20 100% 9303KB 66.0MB/s 00:00
libmysqld-debug.a 100% 348MB 53.3MB/s 00:06
mysqlclient.pc 100% 993 80.8KB/s 00:00
myisamchk 100% 8012KB 17.5MB/s 00:00
mysql_config_editor 100% 8262KB 43.8MB/s 00:00
mysqlcheck 100% 9587KB 15.4MB/s 00:00
mysql_client_test_embedded 100% 193MB 77.4MB/s 00:02
mysql_plugin 100% 5452KB 78.6MB/s 00:00
mysqld_safe 100% 28KB 16.6MB/s 00:00
mysqld_multi