#分布式部署
本文以典型规格(3台服务器,1个MN组、2个CN、1个DN组,DN组和MN组均为1主2备)为例,介绍分布式部署形态的安装步骤。
执行安装部署前,请以安装用户(yashan)登录192.168.1.2服务器,并进入/home/yashan/install安装目录。
$ cd /home/yashan/install
# DN节点1主1备部署
以使用三台服务器部署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
参数 | 说明 |
---|---|
--cluster | 指定数据库集群名称,该名称也将作为初始数据库的名称(database name) |
--port | 指定SSH服务端口 |
--install-path | 指定数据库安装路径 |
--data-path | 指定数据存放目录 |
--begin-port | 指定第一个CN节点上数据库监听端口 |
--mn/cn/dn | 分别指定MN节点/CN节点/DN组-节点数量 |
用于提高数据库性能的参数:
参数 | 说明 |
---|---|
--create-cgroup | 可选参数,指定创建cgroup目录 仅需开启CPU等资源管理时需配置该参数,具体请查阅配置资源管理 |
--recommend-param | 可选参数,开启并使用推荐的配置参数 |
--memory-limit | 可选参数,服务器的可使用内存百分比上限,须配合--recommend-param使用 |
--table-type | 可选参数,主要的业务的表类型,该参数会使数据库配置参数更适合此表类型,须配合--recommend-param使用 |
执行完毕后,当前目录下将生成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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.1.100-linux-x86_64.tar.gz
场景二:如需使用DBLINK功能和更丰富的内置函数(例如LSFA_LISTAGG),需先下载plugin插件包并在安装命令中指定--plugin参数。安装完成后,无法单独安装该插件包。
$ ./bin/yasboot package install -t hosts.toml -i yashandb-23.2.1.100-linux-x86_64.tar.gz --plugin yashandb-plugins-all-23.2.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.2.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
参数 | 说明 |
---|---|
--cluster | 指定数据库集群名称,该名称也将作为初始数据库的名称(database name) |
--port | 指定SSH服务端口 |
--install-path | 指定数据库安装路径 |
--data-path | 指定数据存放目录 |
--begin-port | 指定第一个CN节点上数据库监听端口 |
--mn/cn/dn | 分别指定MN节点/CN节点/DN组-节点数量 |
用于提高数据库性能的参数:
参数 | 说明 |
---|---|
--create-cgroup | 可选参数,指定创建cgroup目录 仅需安装可开启CPU资源管理的单机数据库(非级联备)时需配置该参数,具体请查阅配置资源管理 |
--recommend-param | 可选参数,开启并使用推荐的配置参数 |
--memory-limit | 可选参数,服务器的可使用内存百分比上限,须配合--recommend-param使用 |
--table-type | 可选参数,主要的业务的表类型,该参数会使数据库配置参数更适合此表类型,须配合--recommend-param使用 |
执行完毕后,当前目录下将生成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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.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.2.1.100-linux-x86_64.tar.gz
场景二:如需使用DBLINK功能和更丰富的内置函数(例如LSFA_LISTAGG),需先下载plugin插件包并在安装命令中指定--plugin参数。安装完成后,无法单独安装该插件包。
$ ./bin/yasboot package install -t hosts.toml -i yashandb-23.2.1.100-linux-x86_64.tar.gz --plugin yashandb-plugins-all-23.2.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.2.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功能,可参考守护进程完成相关配置。