写点什么

YashanDB 分布式部署

作者:YashanDB
  • 2025-03-05
    广东
  • 本文字数:14270 字

    阅读完需:约 47 分钟

本文内容来自 YashanDB 官网,原文内容请见 https://doc.yashandb.com/yashandb/23.3/zh/%E5%AE%89%E8%A3%85%E5%92%8C%E5%8D%87%E7%BA%A7/%E5%AE%89%E8%A3%85%E9%83%A8%E7%BD%B2/YashanDB%E6%9C%8D%E5%8A%A1%E7%AB%AF%E5%AE%89%E8%A3%85%EF%BC%88%E5%91%BD%E4%BB%A4%E8%A1%8C%EF%BC%89/%E5%88%86%E5%B8%83%E5%BC%8F%E9%83%A8%E7%BD%B2.html


本文以典型规格(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: 生成部署文件

  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
复制代码


  1. 根据实际需要调整 yashandb.toml 配置文件中的安装参数,可在 group 级别设置 YashanDB 的所有建库参数,在 node 级别设置 YashanDB 的所有配置参数

# 以下内容以实际展示结果为准cluster = "yashandb"	# 安装后修改也不会生效,除非重新安装create_simple_schema = false	# 为true部署完会执行示例的SQL,若改为true需要在deploy时指定sys-password参数deploy_mode = "NORMAL"	# 分布式的部署模式recommend_param = truetable_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 语句报错,请根据错误提示信息检查安装步骤,或咨询我们的技术支持。


  1. YashanDB 不提供系统初始口令,需使用yasboot工具设置数据库 sys 用户的密码,以安装用户登录到服务器并执行如下命令设置密码。

$ yasboot cluster password set -n newpasswd -c yashandb
复制代码


  1. 执行如下命令,查看数据库状态。

$ yasboot cluster status -c yashandb -dhostid   | 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 ----------+-----------+--------+-------+-----------------+-----------------+---------------+--------------------+--------------------------------
复制代码


  1. 使用yasql工具连接数据库,查看实例状态。

$ yasql sys/password@192.168.1.3:1688SQL> SELECT STATUS FROM V$INSTANCE;
STATUS ------------- OPEN
SQL> SELECT database_name FROM v$database;
DATABASE_NAME ---------------------------------------------------------------- yashandb
复制代码


  1. (可选)创建数据库用户并赋权,更多操作请查阅用户管理

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: 生成部署文件

  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
复制代码


  1. 根据实际需要调整 yashandb.toml 配置文件中的安装参数,可在 group 级别设置 YashanDB 的所有建库参数,在 node 级别设置 YashanDB 的所有配置参数


请参考数据库配置调优和自身环境配置调整相关参数。若所安装环境为高可用的 Raft 集群(自动选主),还需参考高可用

# 以下内容以实际展示结果为准cluster = "yashandb"	# 安装后修改也不会生效,除非重新安装create_simple_schema = false	# 为true部署完会执行示例的SQL,若改为true需要在deploy时指定sys-password参数deploy_mode = "NORMAL"	# 分布式的部署模式recommend_param = truetable_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 语句报错,请根据错误提示信息检查安装步骤,或咨询我们的技术支持。


  1. YashanDB 不提供系统初始口令,需使用yasboot工具设置数据库 sys 用户的密码,以安装用户登录到服务器并执行如下命令设置密码。

$ yasboot cluster password set -n newpasswd -c yashandb
复制代码


  1. 执行如下命令,查看数据库状态。

$ yasboot cluster status -c yashandb -dhostid   | 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 ----------+-----------+--------+-------+-----------------+-----------------+---------------+--------------------+--------------------------------
复制代码


  1. 使用yasql工具连接数据库,查看实例状态。

$ yasql sys/password@192.168.1.3:1688SQL> SELECT STATUS FROM V$INSTANCE;
STATUS ------------- OPEN
SQL> SELECT database_name FROM v$database;
DATABASE_NAME ---------------------------------------------------------------- yashandb
复制代码


  1. 创建数据库用户并赋权,更多操作请查阅用户管理

SQL> CREATE USER sales IDENTIFIED BY sales;
SQL> GRANT CONNECT TO SALES;
复制代码


Note:

如需开启 monit 功能,可参考守护进程完成相关配置。

发布于: 刚刚阅读数: 3
用户头像

YashanDB

关注

全自研国产新型大数据管理系统 2022-02-15 加入

还未添加个人简介

评论

发布
暂无评论
YashanDB分布式部署_数据库_YashanDB_InfoQ写作社区