YashanDB 分布式部署
- 2025-03-05 广东
本文字数:14270 字
阅读完需:约 47 分钟
本文以典型规格(3 台服务器,1 个 MN 组、2 个 CN、1 个 DN 组,DN 组和 MN 组均为 1 主 2 备)为例,介绍分布式部署形态的安装步骤。
执行安装部署前,请以安装用户(yashan)登录 192.168.1.2 服务器,并进入/home/yashan/install 安装目录。
$ cd /home/yashan/install
以使用三台服务器部署 1 个 MN 组(MN 节点 1 主 2 备)、2 个 CN、1 个 DN 组(DN 节点 1 主 1 备)的规格为例,介绍分布式部署形态的安装步骤。
步骤 1: 生成部署文件
执行 yasboot package 命令生成配置文件,命令详细参数可查阅yasboot。
$ ./bin/yasboot package de gen --cluster yashandb --recommend-param \
-u yashan -p password --ip 192.168.1.2,192.168.1.3,192.168.1.4 --port 22 \
--install-path /data/yashan/yasdb_home --data-path /data/yashan/yasdb_data \
--begin-port 1688 --mn 3 --cn 2 --dn 1-2

用于提高数据库性能的参数:

执行完毕后,当前目录下将生成 yashandb.toml 和 hosts.toml 两个配置文件,可手动修改,但不建议删除文件中任何行,否则可能导致后续安装过程报错,或所搭建的环境后续无法进行扩展配置。
yashandb.toml:数据库集群的配置文件。
hosts.toml:服务器的配置文件。
-rw-------. 1 yashan yashan 444 Aug 31 16:27 hosts.toml
-rw-------. 1 yashan yashan 708 Aug 31 16:27 yashandb.toml
# 以下内容以实际展示结果为准
cluster = "yashandb" # 安装后修改也不会生效,除非重新安装
create_simple_schema = false # 为true部署完会执行示例的SQL,若改为true需要在deploy时指定sys-password参数
deploy_mode = "NORMAL" # 分布式的部署模式
recommend_param = true
table_type = "LSC"
uuid = "64f1568f4f6b033e58a015a833f0ad9e" # 系统自动生成,不建议修改
yas_type = "DE" # 部署模式,安装后修改也不会生效,除非重新安装
[[group]]
group_type = "mn" # 节点组类型,安装后修改也不会生效,除非重新安装
name = "mng1" # 节点组名称,安装后修改也不会生效,除非重新安装
[group.config] # 可配置所有建库参数,不配置时采用默认值
CHARACTER_SET = "utf8"
ISARCHIVELOG = true
REDO_FILE_NUM = 4
REDO_FILE_SIZE = "128M"
[[group.node]] # 节点配置
data_path = "/data/yashan/yasdb_data" # 为DATA目录,安装后修改也不会生效,除非重新安装
hostid = "host0001" # 节点所在服务器标识,安装后修改也不会生效,除非重新安装
memory_limit = "1536M" # 节点可使用内存上限,跟使用的主机内存有关
role = 1 # 数据库主备角色,安装后修改也不会生效,除非重新安装
[group.node.config] # 可配置所有数据库参数,不配置时采用默认值,安装后修改也不会生效,除非重新安装
DATA_BUFFER_SIZE = "256M"
DB_BLOCK_SIZE = "8K"
DDL_LOCK_TIMEOUT = 60
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = 20
DIN_ADDR = "192.168.1.2:1679"
DSTB_POOL_SIZE = 10
LARGE_POOL_SIZE = "32M"
LISTEN_ADDR = "192.168.1.2:1678"
MAX_SESSIONS = 1024
OPEN_CURSORS = 310
REDO_BUFFER_SIZE = "8M"
REPLICATION_ADDR = "192.168.1.2:1680"
RUN_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/mn-1-1/run"
RUN_LOG_LEVEL = "DEBUG"
SHARE_POOL_SIZE = "256M"
SLOW_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/mn-1-1/slow"
SQL_POOL_SIZE = 45
TRANSACTION_LOCK_TIMEOUT = 300
UNDO_RETENTION = 300
[[group.node]]
data_path = "/data/yashan/yasdb_data"
hostid = "host0002"
memory_limit = "1536M"
role = 2
[group.node.config]
DATA_BUFFER_SIZE = "256M"
DB_BLOCK_SIZE = "8K"
DDL_LOCK_TIMEOUT = 60
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = 20
DIN_ADDR = "192.168.1.3:1679"
DSTB_POOL_SIZE = 10
LARGE_POOL_SIZE = "32M"
LISTEN_ADDR = "192.168.1.3:1678"
MAX_SESSIONS = 1024
OPEN_CURSORS = 310
REDO_BUFFER_SIZE = "8M"
REPLICATION_ADDR = "192.168.1.3:1680"
RUN_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/mn-1-2/run"
RUN_LOG_LEVEL = "DEBUG"
SHARE_POOL_SIZE = "256M"
SLOW_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/mn-1-2/slow"
SQL_POOL_SIZE = 45
TRANSACTION_LOCK_TIMEOUT = 300
UNDO_RETENTION = 300
[[group.node]]
data_path = "/data/yashan/yasdb_data"
hostid = "host0003"
memory_limit = "1536M"
role = 2
[group.node.config]
DATA_BUFFER_SIZE = "256M"
DB_BLOCK_SIZE = "8K"
DDL_LOCK_TIMEOUT = 60
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = 20
DIN_ADDR = "192.168.1.4:1679"
DSTB_POOL_SIZE = 10
LARGE_POOL_SIZE = "32M"
LISTEN_ADDR = "192.168.1.4:1678"
MAX_SESSIONS = 1024
OPEN_CURSORS = 310
REDO_BUFFER_SIZE = "8M"
REPLICATION_ADDR = "192.168.1.4:1680"
RUN_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/mn-1-3/run"
RUN_LOG_LEVEL = "DEBUG"
SHARE_POOL_SIZE = "256M"
SLOW_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/mn-1-3/slow"
SQL_POOL_SIZE = 45
TRANSACTION_LOCK_TIMEOUT = 300
UNDO_RETENTION = 300
[[group]]
group_type = "cn"
name = "cng1"
[group.config]
CHARACTER_SET = "utf8"
ISARCHIVELOG = true
REDO_FILE_NUM = 4
REDO_FILE_SIZE = "128M"
[[group.node]]
data_path = "/data/yashan/yasdb_data"
hostid = "host0002"
memory_limit = "3500M"
role = 1
[group.node.config]
DATA_BUFFER_SIZE = "256M"
DB_BLOCK_SIZE = "8K"
DDL_LOCK_TIMEOUT = 60
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = 20
DIN_ADDR = "192.168.1.3:1689"
DSTB_POOL_SIZE = 10
LARGE_POOL_SIZE = "32M"
LISTEN_ADDR = "192.168.1.3:1688"
MAX_PARALLEL_WORKERS = 128
MAX_REACTOR_CHANNELS = 1
MAX_SESSIONS = 1024
OPEN_CURSORS = 310
REDO_BUFFER_SIZE = "8M"
REPLICATION_ADDR = "192.168.1.3:1690"
RUN_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/cn-2-1/run"
RUN_LOG_LEVEL = "DEBUG"
SHARE_POOL_SIZE = "256M"
SLOW_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/cn-2-1/slow"
SQL_POOL_SIZE = 45
TRANSACTION_LOCK_TIMEOUT = 300
UNDO_RETENTION = 300
WORK_AREA_HEAP_SIZE = "2M"
WORK_AREA_POOL_SIZE = "128M"
[[group.node]]
data_path = "/data/yashan/yasdb_data"
hostid = "host0003"
memory_limit = "3500M"
role = 1
[group.node.config]
DATA_BUFFER_SIZE = "256M"
DB_BLOCK_SIZE = "8K"
DDL_LOCK_TIMEOUT = 60
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = 20
DIN_ADDR = "192.168.1.4:1689"
DSTB_POOL_SIZE = 10
LARGE_POOL_SIZE = "32M"
LISTEN_ADDR = "192.168.1.4:1688"
MAX_PARALLEL_WORKERS = 128
MAX_REACTOR_CHANNELS = 1
MAX_SESSIONS = 1024
OPEN_CURSORS = 310
REDO_BUFFER_SIZE = "8M"
REPLICATION_ADDR = "192.168.1.4:1690"
RUN_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/cn-2-2/run"
RUN_LOG_LEVEL = "DEBUG"
SHARE_POOL_SIZE = "256M"
SLOW_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/cn-2-2/slow"
SQL_POOL_SIZE = 45
TRANSACTION_LOCK_TIMEOUT = 300
UNDO_RETENTION = 300
WORK_AREA_HEAP_SIZE = "2M"
WORK_AREA_POOL_SIZE = "128M"
[[group]]
group_type = "dn"
name = "dng1"
[group.config]
CHARACTER_SET = "utf8"
ISARCHIVELOG = true
REDO_FILE_NUM = 4
REDO_FILE_SIZE = "128M"
[[group.node]]
data_path = "/data/yashan/yasdb_data"
hostid = "host0003"
memory_limit = "7000M"
role = 1
[group.node.config]
DATA_BUFFER_SIZE = "256M"
DB_BLOCK_SIZE = "8K"
DDL_LOCK_TIMEOUT = 60
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = 20
DIN_ADDR = "192.168.1.4:1699"
DSTB_POOL_SIZE = 10
LARGE_POOL_SIZE = "32M"
LISTEN_ADDR = "192.168.1.4:1698"
MAX_PARALLEL_WORKERS = 512
MAX_SESSIONS = 1024
OPEN_CURSORS = 310
REDO_BUFFER_SIZE = "8M"
REPLICATION_ADDR = "192.168.1.4:1700"
RUN_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/dn-3-1/run"
RUN_LOG_LEVEL = "DEBUG"
SHARE_POOL_SIZE = "256M"
SLOW_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/dn-3-1/slow"
SQL_POOL_SIZE = 45
TRANSACTION_LOCK_TIMEOUT = 300
UNDO_RETENTION = 300
WORK_AREA_HEAP_SIZE = "2M"
WORK_AREA_POOL_SIZE = "128M"
[[group.node]]
data_path = "/data/yashan/yasdb_data"
hostid = "host0001"
memory_limit = "7000M"
role = 2
[group.node.config]
DATA_BUFFER_SIZE = "256M"
DB_BLOCK_SIZE = "8K"
DDL_LOCK_TIMEOUT = 60
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = 20
DIN_ADDR = "192.168.1.2:1699"
DSTB_POOL_SIZE = 10
LARGE_POOL_SIZE = "32M"
LISTEN_ADDR = "192.168.1.2:1698"
MAX_PARALLEL_WORKERS = 512
MAX_SESSIONS = 1024
OPEN_CURSORS = 310
REDO_BUFFER_SIZE = "8M"
REPLICATION_ADDR = "192.168.1.2:1700"
RUN_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/dn-3-2/run"
RUN_LOG_LEVEL = "DEBUG"
SHARE_POOL_SIZE = "256M"
SLOW_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/dn-3-2/slow"
SQL_POOL_SIZE = 45
TRANSACTION_LOCK_TIMEOUT = 300
UNDO_RETENTION = 300
WORK_AREA_HEAP_SIZE = "2M"
WORK_AREA_POOL_SIZE = "128M"
步骤 2: 执行安装
场景一:直接安装。
$ ./bin/yasboot package install -t hosts.toml -i yashandb-23.3.1.100-linux-x86_64.tar.gz
场景二:如需使用 DBLINK 功能以及更丰富的内置函数(例如 LSFA_LISTAGG),需先下载plugin插件包并在安装命令中指定--plugin 参数。安装完成后,无法单独安装该插件包。
$ ./bin/yasboot package install -t hosts.toml -i yashandb-23.3.1.100-linux-x86_64.tar.gz --plugin yashandb-plugins-all-23.3.1.100-linux-x86_64.tar.gz
步骤 3: 数据库部署
$ ./bin/yasboot cluster deploy -t yashandb.toml
Note:
可通过指定
-d, --child
参数展示任务以及子任务信息,从而了解部署进度。
返回如下信息表示已成功部署。
task completed, status: SUCCESS
步骤 4:配置环境变量
以安装用户登录到每个服务器上,执行如下命令生效环境变量。
# 部署命令成功执行后将会在$YASDB_HOME目录下的conf文件夹中生成<<集群名称>>.bashrc环境变量文件
$ cd /data/yashan/yasdb_home/yashandb/23.3.1.100/conf
# 如~/.bashrc中已存在YashanDB相关的环境变量,将其清除
$ cat yashandb.bashrc >> ~/.bashrc
$ source ~/.bashrc
步骤 5:检查安装结果
若连接报错或执行 SQL 语句报错,请根据错误提示信息检查安装步骤,或咨询我们的技术支持。
YashanDB 不提供系统初始口令,需使用yasboot工具设置数据库 sys 用户的密码,以安装用户登录到服务器并执行如下命令设置密码。
$ yasboot cluster password set -n newpasswd -c yashandb
执行如下命令,查看数据库状态。
$ yasboot cluster status -c yashandb -d
hostid | node_type | nodeid | pid | instance_status | database_status | database_role | listen_address | data_path
-------------------------------------------------------------------------------------------------------------------------------------------------
host0001 | mn | 1-1:1 | 56961 | open | normal | primary | 192.168.1.2:1678 | /data/yashan/yasdb_data/mn-1-1
+-----------+--------+-------+-----------------+-----------------+---------------+--------------------+--------------------------------
| dn | 3-2:7 | 57029 | open | normal | standby | 192.168.1.2:1698 | /data/yashan/yasdb_data/dn-3-2
----------+-----------+--------+-------+-----------------+-----------------+---------------+--------------------+--------------------------------
host0002 | mn | 1-2:2 | 57024 | open | normal | standby | 192.168.1.3:1678 | /data/yashan/yasdb_data/mn-1-2
+-----------+--------+-------+-----------------+-----------------+---------------+--------------------+--------------------------------
| cn | 2-1:4 | 57024 | open | normal | primary | 192.168.1.3:1688 | /data/yashan/yasdb_data/cn-2-1
+-----------+--------+-------+-----------------+-----------------+---------------+--------------------+--------------------------------
host0003 | mn | 1-3:3 | 57021 | open | normal | standby | 192.168.1.4:1678 | /data/yashan/yasdb_data/mn-1-3
+-----------+--------+-------+-----------------+-----------------+---------------+--------------------+--------------------------------
| cn | 2-2:5 | 57021 | open | normal | primary | 192.168.1.4:1688 | /data/yashan/yasdb_data/cn-2-2
+-----------+--------+-------+-----------------+-----------------+---------------+--------------------+--------------------------------
| dn | 3-1:6 | 57021 | open | normal | primary | 192.168.1.4:1698 | /data/yashan/yasdb_data/dn-3-1
----------+-----------+--------+-------+-----------------+-----------------+---------------+--------------------+--------------------------------
使用yasql工具连接数据库,查看实例状态。
$ yasql sys/password@192.168.1.3:1688
SQL> SELECT STATUS FROM V$INSTANCE;
STATUS
-------------
OPEN
SQL> SELECT database_name FROM v$database;
DATABASE_NAME
----------------------------------------------------------------
yashandb
(可选)创建数据库用户并赋权,更多操作请查阅用户管理。
SQL> CREATE USER sales IDENTIFIED BY sales;
SQL> GRANT CONNECT TO SALES;
步骤 6(可选):开启仲裁选主
如需实现 DN 组内节点的主备自动切换,需开启基于 yasom 的仲裁选主。
Note:
如需开启 monit 功能,可参考守护进程完成相关配置。
DN 节点 1 主 2 备部署
以使用三台服务器部署 1 个 MN 组(MN 节点 1 主 2 备)、2 个 CN、1 个 DN 组(DN 节点 1 主 2 备)的规格为例,介绍分布式部署形态的安装步骤。
# 步骤 1: 生成部署文件
执行 yasboot package 命令生成配置文件,命令详细参数可查阅yasboot。
$ ./bin/yasboot package de gen --cluster yashandb --recommend-param \
-u yashan -p password --ip 192.168.1.2,192.168.1.3,192.168.1.4 --port 22 \
--install-path /data/yashan/yasdb_home --data-path /data/yashan/yasdb_data \
--begin-port 1688 --mn 3 --cn 2 --dn 1-3

用于提高数据库性能的参数:

执行完毕后,当前目录下将生成 yashandb.toml 和 hosts.toml 两个配置文件,可手动修改,但不建议删除文件中任何行,否则可能导致后续安装过程报错,或所搭建的环境后续无法进行扩展配置。
yashandb.toml:数据库集群的配置文件。
hosts.toml:服务器的配置文件。
-rw-------. 1 yashan yashan 444 Aug 31 16:27 hosts.toml
-rw-------. 1 yashan yashan 708 Aug 31 16:27 yashandb.toml
请参考数据库配置调优和自身环境配置调整相关参数。若所安装环境为高可用的 Raft 集群(自动选主),还需参考高可用。
# 以下内容以实际展示结果为准
cluster = "yashandb" # 安装后修改也不会生效,除非重新安装
create_simple_schema = false # 为true部署完会执行示例的SQL,若改为true需要在deploy时指定sys-password参数
deploy_mode = "NORMAL" # 分布式的部署模式
recommend_param = true
table_type = "LSC"
uuid = "64f1568f4f6b033e58a015a833f0ad9e" # 系统自动生成,不建议修改
yas_type = "DE" # 部署模式,安装后修改也不会生效,除非重新安装
[[group]]
group_type = "mn" # 节点组类型,安装后修改也不会生效,除非重新安装
name = "mng1" # 节点组名称,安装后修改也不会生效,除非重新安装
[group.config] # 可配置所有建库参数,不配置时采用默认值
CHARACTER_SET = "utf8"
ISARCHIVELOG = true
REDO_FILE_NUM = 4
REDO_FILE_SIZE = "128M"
[[group.node]] # 节点配置
data_path = "/data/yashan/yasdb_data" # 为DATA目录,安装后修改也不会生效,除非重新安装
hostid = "host0001" # 节点所在服务器标识,安装后修改也不会生效,除非重新安装
memory_limit = "1536M" # 节点可使用内存上限,跟使用的主机内存有关
role = 1 # 数据库主备角色,安装后修改也不会生效,除非重新安装
[group.node.config] # 可配置所有数据库参数,不配置时采用默认值,安装后修改也不会生效,除非重新安装
DATA_BUFFER_SIZE = "256M"
DB_BLOCK_SIZE = "8K"
DDL_LOCK_TIMEOUT = 60
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = 20
DIN_ADDR = "192.168.1.2:1679"
DSTB_POOL_SIZE = 10
LARGE_POOL_SIZE = "32M"
LISTEN_ADDR = "192.168.1.2:1678"
MAX_SESSIONS = 1024
OPEN_CURSORS = 310
REDO_BUFFER_SIZE = "8M"
REPLICATION_ADDR = "192.168.1.2:1680"
RUN_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/mn-1-1/run"
RUN_LOG_LEVEL = "DEBUG"
SHARE_POOL_SIZE = "256M"
SLOW_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/mn-1-1/slow"
SQL_POOL_SIZE = 45
TRANSACTION_LOCK_TIMEOUT = 300
UNDO_RETENTION = 300
[[group.node]]
data_path = "/data/yashan/yasdb_data"
hostid = "host0002"
memory_limit = "1536M"
role = 2
[group.node.config]
DATA_BUFFER_SIZE = "256M"
DB_BLOCK_SIZE = "8K"
DDL_LOCK_TIMEOUT = 60
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = 20
DIN_ADDR = "192.168.1.3:1679"
DSTB_POOL_SIZE = 10
LARGE_POOL_SIZE = "32M"
LISTEN_ADDR = "192.168.1.3:1678"
MAX_SESSIONS = 1024
OPEN_CURSORS = 310
REDO_BUFFER_SIZE = "8M"
REPLICATION_ADDR = "192.168.1.3:1680"
RUN_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/mn-1-2/run"
RUN_LOG_LEVEL = "DEBUG"
SHARE_POOL_SIZE = "256M"
SLOW_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/mn-1-2/slow"
SQL_POOL_SIZE = 45
TRANSACTION_LOCK_TIMEOUT = 300
UNDO_RETENTION = 300
[[group.node]]
data_path = "/data/yashan/yasdb_data"
hostid = "host0003"
memory_limit = "1536M"
role = 2
[group.node.config]
DATA_BUFFER_SIZE = "256M"
DB_BLOCK_SIZE = "8K"
DDL_LOCK_TIMEOUT = 60
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = 20
DIN_ADDR = "192.168.1.4:1679"
DSTB_POOL_SIZE = 10
LARGE_POOL_SIZE = "32M"
LISTEN_ADDR = "192.168.1.4:1678"
MAX_SESSIONS = 1024
OPEN_CURSORS = 310
REDO_BUFFER_SIZE = "8M"
REPLICATION_ADDR = "192.168.1.4:1680"
RUN_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/mn-1-3/run"
RUN_LOG_LEVEL = "DEBUG"
SHARE_POOL_SIZE = "256M"
SLOW_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/mn-1-3/slow"
SQL_POOL_SIZE = 45
TRANSACTION_LOCK_TIMEOUT = 300
UNDO_RETENTION = 300
[[group]]
group_type = "cn"
name = "cng1"
[group.config]
CHARACTER_SET = "utf8"
ISARCHIVELOG = true
REDO_FILE_NUM = 4
REDO_FILE_SIZE = "128M"
[[group.node]]
data_path = "/data/yashan/yasdb_data"
hostid = "host0002"
memory_limit = "2625M"
role = 1
[group.node.config]
DATA_BUFFER_SIZE = "256M"
DB_BLOCK_SIZE = "8K"
DDL_LOCK_TIMEOUT = 60
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = 20
DIN_ADDR = "192.168.1.3:1689"
DSTB_POOL_SIZE = 10
LARGE_POOL_SIZE = "32M"
LISTEN_ADDR = "192.168.1.3:1688"
MAX_PARALLEL_WORKERS = 128
MAX_REACTOR_CHANNELS = 1
MAX_SESSIONS = 1024
OPEN_CURSORS = 310
REDO_BUFFER_SIZE = "8M"
REPLICATION_ADDR = "192.168.1.3:1690"
RUN_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/cn-2-1/run"
RUN_LOG_LEVEL = "DEBUG"
SHARE_POOL_SIZE = "256M"
SLOW_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/cn-2-1/slow"
SQL_POOL_SIZE = 45
TRANSACTION_LOCK_TIMEOUT = 300
UNDO_RETENTION = 300
WORK_AREA_HEAP_SIZE = "2M"
WORK_AREA_POOL_SIZE = "128M"
[[group.node]]
data_path = "/data/yashan/yasdb_data"
hostid = "host0003"
memory_limit = "2625M"
role = 1
[group.node.config]
DATA_BUFFER_SIZE = "256M"
DB_BLOCK_SIZE = "8K"
DDL_LOCK_TIMEOUT = 60
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = 20
DIN_ADDR = "192.168.1.4:1689"
DSTB_POOL_SIZE = 10
LARGE_POOL_SIZE = "32M"
LISTEN_ADDR = "192.168.1.4:1688"
MAX_PARALLEL_WORKERS = 128
MAX_REACTOR_CHANNELS = 1
MAX_SESSIONS = 1024
OPEN_CURSORS = 310
REDO_BUFFER_SIZE = "8M"
REPLICATION_ADDR = "192.168.1.4:1690"
RUN_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/cn-2-2/run"
RUN_LOG_LEVEL = "DEBUG"
SHARE_POOL_SIZE = "256M"
SLOW_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/cn-2-2/slow"
SQL_POOL_SIZE = 45
TRANSACTION_LOCK_TIMEOUT = 300
UNDO_RETENTION = 300
WORK_AREA_HEAP_SIZE = "2M"
WORK_AREA_POOL_SIZE = "128M"
[[group]]
group_type = "dn"
name = "dng1"
[group.config]
CHARACTER_SET = "utf8"
ISARCHIVELOG = true
REDO_FILE_NUM = 4
REDO_FILE_SIZE = "128M"
[[group.node]]
data_path = "/data/yashan/yasdb_data"
hostid = "host0003"
memory_limit = "5250M"
role = 1
[group.node.config]
DATA_BUFFER_SIZE = "256M"
DB_BLOCK_SIZE = "8K"
DDL_LOCK_TIMEOUT = 60
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = 20
DIN_ADDR = "192.168.1.4:1699"
DSTB_POOL_SIZE = 10
LARGE_POOL_SIZE = "32M"
LISTEN_ADDR = "192.168.1.4:1698"
MAX_PARALLEL_WORKERS = 512
MAX_SESSIONS = 1024
OPEN_CURSORS = 310
REDO_BUFFER_SIZE = "8M"
REPLICATION_ADDR = "192.168.1.4:1700"
RUN_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/dn-3-1/run"
RUN_LOG_LEVEL = "DEBUG"
SHARE_POOL_SIZE = "256M"
SLOW_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/dn-3-1/slow"
SQL_POOL_SIZE = 45
TRANSACTION_LOCK_TIMEOUT = 300
UNDO_RETENTION = 300
WORK_AREA_HEAP_SIZE = "2M"
WORK_AREA_POOL_SIZE = "128M"
[[group.node]]
data_path = "/data/yashan/yasdb_data"
hostid = "host0001"
memory_limit = "5250M"
role = 2
[group.node.config]
DATA_BUFFER_SIZE = "256M"
DB_BLOCK_SIZE = "8K"
DDL_LOCK_TIMEOUT = 60
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = 20
DIN_ADDR = "192.168.1.2:1699"
DSTB_POOL_SIZE = 10
LARGE_POOL_SIZE = "32M"
LISTEN_ADDR = "192.168.1.2:1698"
MAX_PARALLEL_WORKERS = 512
MAX_SESSIONS = 1024
OPEN_CURSORS = 310
REDO_BUFFER_SIZE = "8M"
REPLICATION_ADDR = "192.168.1.2:1700"
RUN_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/dn-3-2/run"
RUN_LOG_LEVEL = "DEBUG"
SHARE_POOL_SIZE = "256M"
SLOW_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/dn-3-2/slow"
SQL_POOL_SIZE = 45
TRANSACTION_LOCK_TIMEOUT = 300
UNDO_RETENTION = 300
WORK_AREA_HEAP_SIZE = "2M"
WORK_AREA_POOL_SIZE = "128M"
[[group.node]]
data_path = "/data/yashan/yasdb_data"
hostid = "host0002"
memory_limit = "5250M"
role = 2
[group.node.config]
DATA_BUFFER_SIZE = "256M"
DB_BLOCK_SIZE = "8K"
DDL_LOCK_TIMEOUT = 60
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = 20
DIN_ADDR = "192.168.1.3:1699"
DSTB_POOL_SIZE = 10
LARGE_POOL_SIZE = "32M"
LISTEN_ADDR = "192.168.1.3:1698"
MAX_PARALLEL_WORKERS = 512
MAX_SESSIONS = 1024
OPEN_CURSORS = 310
REDO_BUFFER_SIZE = "8M"
REPLICATION_ADDR = "192.168.1.3:1700"
RUN_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/dn-3-3/run"
RUN_LOG_LEVEL = "DEBUG"
SHARE_POOL_SIZE = "256M"
SLOW_LOG_FILE_PATH = "/data/yashan/yasdb_home/yashandb/23.3.1.100/log/yashandb/dn-3-3/slow"
SQL_POOL_SIZE = 45
TRANSACTION_LOCK_TIMEOUT = 300
UNDO_RETENTION = 300
WORK_AREA_HEAP_SIZE = "2M"
WORK_AREA_POOL_SIZE = "128M"
步骤 2: 执行安装
场景一:直接安装。
$ ./bin/yasboot package install -t hosts.toml -i yashandb-23.3.1.100-linux-x86_64.tar.gz
场景二:如需使用 DBLINK 功能以及更丰富的内置函数(例如 LSFA_LISTAGG),需先下载plugin插件包并在安装命令中指定--plugin 参数。安装完成后,无法单独安装该插件包。
$ ./bin/yasboot package install -t hosts.toml -i yashandb-23.3.1.100-linux-x86_64.tar.gz --plugin yashandb-plugins-all-23.3.1.100-linux-x86_64.tar.gz
步骤 3: 数据库部署
$ ./bin/yasboot cluster deploy -t yashandb.toml
Note:
可通过指定
-d, --child
参数展示任务以及子任务信息,从而了解部署进度。
返回如下信息表示已成功部署。
task completed, status: SUCCESS
步骤 4:配置环境变量
以安装用户登录到每个服务器上,执行如下命令生效环境变量。
# 部署命令成功执行后将会在$YASDB_HOME目录下的conf文件夹中生成<<集群名称>>.bashrc环境变量文件
$ cd /data/yashan/yasdb_home/yashandb/23.3.1.100/conf
# 如~/.bashrc中已存在YashanDB相关的环境变量,将其清除
$ cat yashandb.bashrc >> ~/.bashrc
$ source ~/.bashrc
步骤 5:检查安装结果
若连接报错或执行 SQL 语句报错,请根据错误提示信息检查安装步骤,或咨询我们的技术支持。
YashanDB 不提供系统初始口令,需使用yasboot工具设置数据库 sys 用户的密码,以安装用户登录到服务器并执行如下命令设置密码。
$ yasboot cluster password set -n newpasswd -c yashandb
执行如下命令,查看数据库状态。
$ yasboot cluster status -c yashandb -d
hostid | node_type | nodeid | pid | instance_status | database_status | database_role | listen_address | data_path
-------------------------------------------------------------------------------------------------------------------------------------------------
host0001 | mn | 1-1:1 | 56961 | open | normal | primary | 192.168.1.2:1678 | /data/yashan/yasdb_data/mn-1-1
+-----------+--------+-------+-----------------+-----------------+---------------+--------------------+--------------------------------
| dn | 3-2:7 | 57029 | open | normal | standby | 192.168.1.2:1698 | /data/yashan/yasdb_data/dn-3-2
----------+-----------+--------+-------+-----------------+-----------------+---------------+--------------------+--------------------------------
host0002 | mn | 1-2:2 | 57024 | open | normal | standby | 192.168.1.3:1678 | /data/yashan/yasdb_data/mn-1-2
+-----------+--------+-------+-----------------+-----------------+---------------+--------------------+--------------------------------
| cn | 2-1:4 | 57024 | open | normal | primary | 192.168.1.3:1688 | /data/yashan/yasdb_data/cn-2-1
+-----------+--------+-------+-----------------+-----------------+---------------+--------------------+--------------------------------
| dn | 3-3:8 | 57016 | open | normal | standby | 192.168.1.3:1698 | /data/yashan/yasdb_data/dn-3-3
----------+-----------+--------+-------+-----------------+-----------------+---------------+--------------------+--------------------------------
host0003 | mn | 1-3:3 | 57021 | open | normal | standby | 192.168.1.4:1678 | /data/yashan/yasdb_data/mn-1-3
+-----------+--------+-------+-----------------+-----------------+---------------+--------------------+--------------------------------
| cn | 2-2:5 | 57021 | open | normal | primary | 192.168.1.4:1688 | /data/yashan/yasdb_data/cn-2-2
+-----------+--------+-------+-----------------+-----------------+---------------+--------------------+--------------------------------
| dn | 3-1:6 | 57021 | open | normal | primary | 192.168.1.4:1698 | /data/yashan/yasdb_data/dn-3-1
----------+-----------+--------+-------+-----------------+-----------------+---------------+--------------------+--------------------------------
使用yasql工具连接数据库,查看实例状态。
$ yasql sys/password@192.168.1.3:1688
SQL> SELECT STATUS FROM V$INSTANCE;
STATUS
-------------
OPEN
SQL> SELECT database_name FROM v$database;
DATABASE_NAME
----------------------------------------------------------------
yashandb
创建数据库用户并赋权,更多操作请查阅用户管理。
SQL> CREATE USER sales IDENTIFIED BY sales;
SQL> GRANT CONNECT TO SALES;
Note:
如需开启 monit 功能,可参考守护进程完成相关配置。
版权声明: 本文为 InfoQ 作者【YashanDB】的原创文章。
原文链接:【http://xie.infoq.cn/article/60d2bd65c757b079237157f25】。文章转载请联系作者。

YashanDB
全自研国产新型大数据管理系统 2022-02-15 加入
还未添加个人简介
评论