本文内容来自 YashanDB 官网,原文内容请见 https:///newsinfo/7080871.html?templateId=1718516
场景:YAC 数据库已经创建完毕,需要修改 DG0 的 AU_SIZE,提高创建数据文件性能。
DG0 的 AU_SIZE 只能通过重建数据库来修改。本文说明修改方法。
源库版本:YashanDB 企业版 23.2.1.100
基本信息查询:
默认 AU_SIZE 是 1M。
[yac@localhost ~]$ yasql / as sysdbaYashanDB SQL Enterprise Edition Release 23.2.1.100 aarch64SQL> select * from V$YFS_DISKGROUP 2 ; ID NAME AU_SIZE BLOCK_SIZE REDUNDANCY STATE TOTAL_MB FREE_MB USABLE_FILE_MB------------ ---------------------------------------------------------------- ------------ ------------ ---------------------------------------------------------------- ---------------------------------------------------------------- --------------------- --------------------- --------------------- 0 DG0 1048576 4096 EXTERNAL MOUNTED 307200 289752 289752 1 row fetched. SQL> exit
复制代码
备份
[yac@localhost backup]$ yasrman / -c 'create catalog' -D /home/yac/backup/catalog create catalog successfully [yac@localhost backup]$ yasrman / -c 'show all'+---------------------------+-----------+----------------+| NAME | DEFAULT | VALUE | +---------------------------+-----------+----------------+| PARALLELISM | 2 | 2 | | SECTION SIZE | 134217728 | 134217728 | | COMPRESSION ALGORITHM | NONE | NONE | | COMPRESSION LEVEL | LOW | LOW | | DEST | SERVER | SERVER | +---------------------------+-----------+----------------+[yac@localhost backup]$ yasrman / -c 'configure PARALLELISM 8' -D /home/yac/backup/catalog configure successfully [yac@localhost backup]$ yasrman / -c 'configure COMPRESSION ALGORITHM zstd' -D /home/yac/backup/catalog configure successfully [yac@localhost backup]$ yasrman / -c 'show all' -D /home/yac/backup/catalog+---------------------------+-----------+----------------+| NAME | DEFAULT | VALUE | +---------------------------+-----------+----------------+| PARALLELISM | 2 | 8 | | SECTION SIZE | 134217728 | 134217728 | | COMPRESSION ALGORITHM | NONE | ZSTD | | COMPRESSION LEVEL | LOW | LOW | | DEST | SERVER | SERVER | +---------------------------+-----------+----------------+[yac@localhost backup]$ yasrman sys/Cod-2022 -c "backup database tag 'full_1' format '/home/yac/backup/full_bak_1'" -D /home/yac/backup/catalog backup successfully [yac@localhost full_bak_1]$ pwd /home/yac/backup/full_bak_1 [yac@localhost full_bak_1]$ ll total 19632-rw-r----- 1 yac yac 5632 Apr 9 18:43 backup_filelist-rw-r----- 1 yac yac 16777216 Apr 9 18:43 backup_profile-rw-r----- 1 yac yac 5120 Apr 9 18:43 ctrl_0_0_0.bak-rw-r----- 1 yac yac 1318400 Apr 9 18:43 data_0_0_0.bak-rw-r----- 1 yac yac 208384 Apr 9 18:43 data_1_0_0.bak-rw-r----- 1 yac yac 512 Apr 9 18:43 data_2_0_0.bak-rw-r----- 1 yac yac 512 Apr 9 18:43 data_3_0_0.bak-rw-r----- 1 yac yac 167424 Apr 9 18:43 data_4_0_0.bak-rw-r----- 1 yac yac 1158144 Apr 9 18:43 data_5_0_0.bak-rw-r----- 1 yac yac 230400 Apr 9 18:43 data_6_0_0.bak-rw-r----- 1 yac yac 93696 Apr 9 18:43 redo0_0_2_0.bak-rw-r----- 1 yac yac 117760 Apr 9 18:43 redo1_0_1_0.bak[yac@localhost full_bak_1]$
复制代码
[yac@localhost full_bak_1]$ yasboot cluster clean --purge -c yashandb -d Are you sure you want to CLEAN cluster: [yashandb], AND ALL DATA WILL BE DELETED (-p/--purge is given)? [yes/no]: yes type | uuid | name | hostid | index | status | return_code | progress | cost ----------------------------------------------------------------------------------------------------------------------- task | 794bab4eb2b31232 | CleanYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | 1-------+------------------+-------------------+----------+-------------------+---------+-------------+----------+------ child | 49fb78339719543e | CleanYasdbNode | host0001 | yashandb.host0001 | SUCCESS | 0 | 100 | 1 +------------------+-------------------+----------+-------------------+---------+-------------+----------+------ | 18e112cf6e61c0c7 | CleanYasdbNode | host0002 | yashandb.host0002 | SUCCESS | 0 | 100 | 1-------+------------------+-------------------+----------+-------------------+---------+-------------+----------+------ task completed, status: SUCCESS [yac@localhost full_bak_1]$
复制代码
获取默认的 diskgroup 创建语句
[yac@localhost log]$ grep -i 'create diskgroup' yasagent.log2024-04-09 18:33:19 DEBUG [yashandb-1-1] exec.go:63 exec: bash -c /home/yac/yashandb/23.2.1.100/bin/yfscmd -D /home/yac/data/ycs/ce-1-1 exec "create diskgroup DG0 external redundancy disk '/dev/yas/data' force attribute 'au_size'='1M'" starting [yac@localhost log]$ 修改yashandb.toml
复制代码
修改 yashandb.toml
在 [group.config 之前] 添加,注意 au_size 已经修改为 32M。
[group.create_sql] create_diskgroup = "create diskgroup DG0 external redundancy disk '/dev/yas/data' force attribute 'au_size'='32M';"
复制代码
完整 yashandb.toml 如下
[yac@localhost install]$ cat yashandb.toml cluster = "yashandb"create_simple_schema = falseuuid = "661518c0de3db7d39125706474b55a89"yas_type = "CE" [CEDisk] data = "/dev/yas/data" vote = "/dev/yas/vote" ycr = "/dev/yas/ycr" [YFSConfig] RECY_INTERVAL = "86400" SHM_POOL_SIZE = "2G" SYS_AREA_SIZE = "1G" YFS_PACKET_SIZE = "1M" [[group]] group_type = "ce" name = "ceg1" [group.create_sql] create_diskgroup"create diskgroup DG0 external redundancy disk '/dev/yas/data' force attribute 'au_size'='32M';" [group.config] CHARACTER_SET = "gbk" ISARCHIVELOG = true REDO_FILE_NUM = 8 REDO_FILE_SIZE = "1G" YFS_FORCE_CREATE = true [[group.node]] data_path = "/home/yac/data" hostid = "host0001" role = 1 [group.node.config] CLUSTER_DATABASE = "TRUE" CLUSTER_INTERCONNECT = "192.168.27.28:1989" DATA_BUFFER_SIZE = "1G" HA_ELECTION_TIMEOUT = 18 HA_HEARTBEAT_INTERVAL = 6 INTER_URL = "192.168.27.28:2088" LISTEN_ADDR = "192.168.27.28:1988" REDO_BUFFER_PARTS = 8 REDO_BUFFER_SIZE = "64M" RUN_LOG_FILE_PATH = "/home/yac/yashandb/23.2.1.100/log/yashandb/ce-1-1/run" SHARE_POOL_SIZE = "1G" SLOW_LOG_FILE_PATH = "/home/yac/yashandb/23.2.1.100/log/yashandb/ce-1-1/slow" SQL_POOL_PARTS = 8 [[group.node]] data_path = "/home/yac/data" hostid = "host0002" role = 2 [group.node.config] CLUSTER_DATABASE = "TRUE" CLUSTER_INTERCONNECT = "192.168.27.29:1989" DATA_BUFFER_SIZE = "1G" HA_ELECTION_TIMEOUT = 18 HA_HEARTBEAT_INTERVAL = 6 INTER_URL = "192.168.27.29:2088" LISTEN_ADDR = "192.168.27.29:1988" REDO_BUFFER_PARTS = 8 REDO_BUFFER_SIZE = "64M" RUN_LOG_FILE_PATH = "/home/yac/yashandb/23.2.1.100/log/yashandb/ce-1-2/run" SHARE_POOL_SIZE = "1G" SLOW_LOG_FILE_PATH = "/home/yac/yashandb/23.2.1.100/log/yashandb/ce-1-2/slow" SQL_POOL_PARTS = 8[yac@localhost install]$
复制代码
[yac@localhost install]$ ./bin/yasboot cluster deploy -t yashandb.toml -d type | uuid | name | hostid | index | status | return_code | progress | cost ------------------------------------------------------------------------------------------------------------------------ task | febed9e9d11051f6 | DeployYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | 154-------+------------------+--------------------+----------+-------------------+---------+-------------+----------+------ child | fd7f36bebd8c6690 | DeployCePrimary | host0001 | yashandb.1-1 | SUCCESS | 0 | 100 | 138 +------------------+--------------------+----------+-------------------+---------+-------------+----------+------ | 6b8097c29ae76eb5 | DeployCeStandby | host0002 | yashandb.1-2 | SUCCESS | 0 | 100 | 13 +------------------+--------------------+----------+-------------------+---------+-------------+----------+------ | ac33cca0038effe3 | SyncNodeConfig | - | yashandb | SUCCESS | 0 | 100 | 1 +------------------+--------------------+----------+-------------------+---------+-------------+----------+------ | ae8d99b094cdf85f | MonitReload | host0001 | yashandb-host0001 | SUCCESS | 0 | 100 | 1 +------------------+--------------------+----------+-------------------+---------+-------------+----------+------ | 1c0e0f77c6268465 | MonitReload | host0002 | yashandb-host0002 | SUCCESS | 0 | 100 | 1-------+------------------+--------------------+----------+-------------------+---------+-------------+----------+------ task completed, status: SUCCESS
复制代码
[yac@localhost install]$ yasql / as sysdbaYashanDB SQL Enterprise Edition Release 23.2.1.100 aarch64SQL> select name,au_size/1024/1024 from v$yfs_diskgroup; NAME AU_SIZE/1024/1024---------------------------------------------------------------- -----------------DG0 32 1 row fetched. SQL>
复制代码
[yac@localhost install]$ yasboot cluster clean -c yashandb --restore -dAre you sure you want to CLEAN cluster: [yashandb], NODES DATA WILL BE DELETED AND RESTART WITH 'NOMOUNT' STATUS (-r/--restore is given)?[yes/no]: yes type | uuid | name | hostid | index | status | return_code | progress | cost---------------------------------------------------------------------------------------------------------------------------- task | 93b8e4c5d11e4cc6 | CleanYasdbCluster | - | yashandb | SUCCESS | 0 | 100 | 44-------+------------------+-------------------+----------+------------------------+---------+-------------+----------+------ child | 2dea5296ca43b64b | StopYasdbYasce | host0001 | yashandb.1-1.ForceStop | SUCCESS | 0 | 100 | 1 +------------------+-------------------+----------+------------------------+---------+-------------+----------+------ | 4395ef7a8f1acb88 | StopYasdbYasce | host0002 | yashandb.1-2.ForceStop | SUCCESS | 0 | 100 | 1 +------------------+-------------------+----------+------------------------+---------+-------------+----------+------ | 3398f9d85a07c56a | RestoreCleanYasce | host0001 | yashandb.1-1 | SUCCESS | 0 | 100 | 39 +------------------+-------------------+----------+------------------------+---------+-------------+----------+------ | 8727a602b3b696fd | StartYasdbYasce | host0002 | yashandb.1-2 | SUCCESS | 0 | 100 | 4-------+------------------+-------------------+----------+------------------------+---------+-------------+----------+------task completed, status: SUCCESS[yac@localhost install]$ [yac@localhost backup]$ yasrman / -c "list backup" -D /home/yac/backup/catalogGroup: type DB, tag: full_1, format: /home/yac/backup/full_bak_1, connect url: , nodeCount: 1, distribution: FALSE, isClient: FALSE, offset: 0 backup path: /home/yac/backup/full_bak_1 instance: 1, archive range sequence: 2-2 scn: 552231634862604288-552233372626141184 instance: 2, archive range sequence: 1-1 scn: 552231634862604288-552233372626141184 [yac@localhost backup]$ [yac@localhost backup]$ yasrman sys/Cod-2022 -c "restore database from tag 'full_1'" -D /home/yac/backup/catalogyashanrestore successfully
复制代码
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/70028812/viewspace-3067650/ ,如需转载,请注明出处,否则将追究法律责任。