本文内容来自YashanDB官网,原文内容请见 https://www.yashandb.com/newsinfo/7080871.html?templateId=1718516
基本信息
场景:YAC数据库已经创建完毕,需要修改DG0的AU_SIZE,提高创建数据文件性能。
DG0的AU_SIZE只能通过重建数据库来修改。本文说明修改方法。
源库版本:YashanDB 企业版 23.2.1.100
基本信息查询:
默认AU_SIZE是1M。
[yac@localhost ~]$ yasql / as sysdba
YashanDB SQL Enterprise Edition Release 23.2.1.100 aarch64
SQL> 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
修改AU_SIZE
备份
[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]$
修改建库脚本,修改AU_SIZE
获取默认的diskgroup创建语句
[yac@localhost log]$ grep -i 'create diskgroup' yasagent.log
2024-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 = false
uuid = "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
确认AU_SIZE已经修改
[yac@localhost install]$ yasql / as sysdba
YashanDB SQL Enterprise Edition Release 23.2.1.100 aarch64
SQL> 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 -d
Are 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/catalog
Group: 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/catalog
yashan
restore successfully
标签:yashandb,AU,localhost,YFS,YashanDB,backup,bak,yac,SIZE
From: https://www.cnblogs.com/YashanDB/p/18677260