#toml文件
toml文件用于配置搭建YashanDB的环境信息,为简化操作,通过yasboot package config gen命令可以生成YashanDB需要的一套最基本的配置文件,包括主机配置文件(hosts.toml)和集群配置文件(集群名称.toml)。
用户可以手动创建这些toml文件,或者后续对其进行修改。需注意的是,YashanDB的所提供的OM(运维管理)功能均以toml文件为基准,对其的手工维护必须保证准确。
# 主机配置文件
主机配置文件列示YashanDB服务端所有节点的物理信息。
示例:(hosts.toml)
cluster = "yashandb" #数据库集群名称
[om] #yasom信息
hostid = "host0001" #yasom所在主机标识
[om.config]
LISTEN_ADDR = "127.0.0.1:1675" #yasom侦听端口
[[host]] #数据库实例信息
hostid = "host0001" #数据库实例所在主机标识
user = "yashan" #登录主机的SSH用户(数据库安装用户)
password = "abc123"
ip = "127.0.0.1" #数据库服务器
port = 22 #登录主机的SSH端口
path = "/home/yashan" #产品安装路径
[host.yasagent]
[host.yasagent.config]
LISTEN_ADDR = "127.0.0.1:1676" #yasagent侦听端口
# 集群配置文件
集群配置文件列示YashanDB服务端各节点上的数据库相关信息,以及由多节点所组成的逻辑集群架构信息。
其中,与参数相关的配置信息分为如下两部分:
- 建库参数:这些参数用于控制创建数据库实例时的相关信息,在[[group]]节点组级别进行配置,即每个节点组内的多个节点创建一致的数据库实例。
- 配置参数:每个数据库实例的配置参数信息,在[[group.node]]节点级别进行配置。
# 分布式集群配置文件
示例:(yashandb.toml)
uuid = "640aab9ac52bff4efc50f2c704067c19" #数据库唯一标识
cluster = "yashandb" #数据库集群名称
sys_password = "Cod-2022" #安装时的sys口令,安装完成后需修改
deploy_mode = "NORMAL" #分布式的部署模式
[[group]] #MN组配置
name = "mng1" #节点组名称
group_type = "mn" #节点组类型
[group.config] #建库参数
ISARCHIVELOG = "true"
[[group.node]] #MN节点配置
hostid = "host0001" #节点所在主机标识
data_path = "/home/yashan/yasdb/data" #实例的DATA目录
role = 1 #数据库主备角色
[group.node.config] #数据库配置参数
DDL_LOCK_TIMEOUT = "60"
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = "20"
DIN_ADDR = "127.0.0.1:1679"
DSTB_POOL_SIZE = "10"
LISTEN_ADDR = "127.0.0.1:1678"
REPLICATION_ADDR = "127.0.0.1:1680"
RUN_LOG_LEVEL = "DEBUG"
SQL_POOL_SIZE = "45"
[[group]] #CN组配置
name = "cng1" #节点组名称
group_type = "cn" #节点组类型
[group.config] #建库参数
ISARCHIVELOG = "true"
[[group.node]] #CN节点配置
hostid = "host0001" #节点所在主机标识
data_path = "/home/yashan/yasdb/data" #实例的DATA目录
[group.node.config] #数据库配置参数
DDL_LOCK_TIMEOUT = "60"
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = "20"
DIN_ADDR = "127.0.0.1:1689"
DSTB_POOL_SIZE = "10"
LISTEN_ADDR = "127.0.0.1:1688"
MAX_PARALLEL_WORKERS = "128"
REPLICATION_ADDR = "127.0.0.1:1690"
RUN_LOG_LEVEL = "DEBUG"
SQL_POOL_SIZE = "45"
WORK_AREA_HEAP_SIZE = "2M"
WORK_AREA_POOL_SIZE = "128M"
[[group]] #DN组配置
name = "dng1" #节点组名称
group_type = "dn" #节点组类型
[group.config] #建库参数
ISARCHIVELOG = "true"
[[group.node]] #DN节点配置
hostid = "host0001" #节点所在主机标识
data_path = "/home/yashan/yasdb/data" #实例的DATA目录
role = 1 #数据库主备角色
[group.node.config] #数据库配置参数
DDL_LOCK_TIMEOUT = "60"
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = "20"
DIN_ADDR = "127.0.0.1:1699"
DSTB_POOL_SIZE = "10"
LISTEN_ADDR = "127.0.0.1:1698"
MAX_PARALLEL_WORKERS = "512"
REPLICATION_ADDR = "127.0.0.1:1700"
RUN_LOG_LEVEL = "DEBUG"
SQL_POOL_SIZE = "45"
WORK_AREA_HEAP_SIZE = "2M"
WORK_AREA_POOL_SIZE = "128M"
[[group]] #DN组配置
name = "dng2"
group_type = "dn"
[group.config]
ISARCHIVELOG = "true"
[[group.node]]
hostid = "host0001"
data_path = "/home/yashan/yasdb/data"
role = 1
[group.node.config]
DDL_LOCK_TIMEOUT = "60"
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = "20"
DIN_ADDR = "127.0.0.1:1702"
DSTB_POOL_SIZE = "10"
LISTEN_ADDR = "127.0.0.1:1701"
MAX_PARALLEL_WORKERS = "512"
REPLICATION_ADDR = "127.0.0.1:1703"
RUN_LOG_LEVEL = "DEBUG"
SQL_POOL_SIZE = "45"
WORK_AREA_HEAP_SIZE = "2M"
WORK_AREA_POOL_SIZE = "128M"
[[group]] #DN组配置
name = "dng3"
group_type = "dn"
[group.config]
ISARCHIVELOG = "true"
[[group.node]]
hostid = "host0001"
data_path = "/home/yashan/yasdb/data"
role = 1
[group.node.config]
DDL_LOCK_TIMEOUT = "60"
DEFAULT_TABLE_TYPE = "LSC"
DICTIONARY_CACHE_SIZE = "20"
DIN_ADDR = "127.0.0.1:1705"
DSTB_POOL_SIZE = "10"
LISTEN_ADDR = "127.0.0.1:1704"
MAX_PARALLEL_WORKERS = "512"
REPLICATION_ADDR = "127.0.0.1:1706"
RUN_LOG_LEVEL = "DEBUG"
SQL_POOL_SIZE = "45"
WORK_AREA_HEAP_SIZE = "2M"
WORK_AREA_POOL_SIZE = "128M"
# 单机集群配置文件
示例:(yashandb.toml)
uuid = "640ac9e0d65969546a3d2baecd366533" #OM工具使用的唯一标识
cluster = "yashandb" #数据库集群名称
sys_password = "Cod-2022" #安装时的sys口令,安装完成后需修改
[[group]] #节点组配置
name = "dbg1" #节点组名称
group_type = "db" #节点组类型
[group.config] #建库参数
ISARCHIVELOG = "true"
[[group.node]] #主机节点配置
hostid = "host0001" #节点所在主机标识
data_path = "/home/yashan/yasdb/data" #实例的DATA目录
role = 1 #数据库主备角色
[group.node.config]
DIN_ADDR = "127.0.0.1:1689"
LISTEN_ADDR = "127.0.0.1:1688"
REPLICATION_ADDR = "127.0.0.1:1690"
RUN_LOG_LEVEL = "DEBUG"
[[group.node]] #备机节点配置
hostid = "host0001" #节点所在主机标识
data_path = "/home/yashan/yasdb/data" #实例的DATA目录
role = 2 #数据库主备角色
[group.node.config] #数据库配置参数
DIN_ADDR = "127.0.0.1:1692"
LISTEN_ADDR = "127.0.0.1:1691"
REPLICATION_ADDR = "127.0.0.1:1693"
RUN_LOG_LEVEL = "DEBUG"
[[group.node]] #备机节点配置
hostid = "host0001"
data_path = "/home/yashan/yasdb/data"
role = 2
[group.node.config]
DIN_ADDR = "127.0.0.1:1695"
LISTEN_ADDR = "127.0.0.1:1694"
REPLICATION_ADDR = "127.0.0.1:1696"
RUN_LOG_LEVEL = "DEBUG"
# 主机检查配置文件
示例:(yascheck.toml)
[yascheck]
[yascheck.hardware]
[yascheck.hardware.cpu]
ignore = false
physical = "cat /proc/cpuinfo | grep 'physical id' | sort | uniq | wc -l"
logical = "cat /proc/cpuinfo | grep processor | wc -l"
cores_per_cpu = "cat /proc/cpuinfo | grep 'cpu cores' | uniq | awk -F : '{print $2}'"
[yascheck.hardware.memory]
ignore = false
[yascheck.hardware.disk]
ignore = false
[yascheck.hardware.network]
ignore = false
dns = "grep nameserver /etc/resolv.conf| grep -v '#' | awk '{print $2}' | tr '\\n' ';' | sed 's/;$//'"
gateway = "ip route | grep default | awk '{print $3}'"
status = "ping 127.0.0.1 -c 3"
[yascheck.system_params]
[yascheck.system_params.base_info]
ignore = false
selinux = "/usr/sbin/sestatus | grep 'SELinux status: ' | awk '{print $3}'"
io_schedule = "cat /sys/block/sda/queue/scheduler | awk -F [ '{print $2}' | awk -F ] '{print $1}'"
en_lang = "echo $LANG"
[yascheck.system_params.sysctl]
sysctl = "sysctl -a | grep vm | grep 'swappiness\\|dirty_ratio\\|dirty_background_ratio\\|dirty_expire_centisecs\\|vfs_cache_pressure\\|min_free_kbytes\\|overcommit_memory\\|overcommit_ratio\\|max_map_count'"
ignore = false
[yascheck.system_params.users]
ignore = false
user_privilege = "\n for user in $(cat /etc/passwd | awk -F: '{print $1}'); do\n if [ $(id -u $user) -eq 0 ]; then\n echo $user\n fi\n done"
sudo_users = "grep -v \"^#\" /etc/sudoers | grep -v \"^Defaults\" | sed '/^$/d' | awk '{print $1}' | uniq | tr '\\n' ' '"
need_login_users = "\n for shell in $(grep -v \"/sbin/nologin\" /etc/shells); do\n for username in $(grep \"$shell\" /etc/passwd | awk -F: '{print $1}'); do \n cat /etc/passwd | grep -w \"$username\" | grep -w \"$shell\" | awk -F: '{print $1,$3,$4,$6,$7}'\n done\n done"
[yascheck.service]
[yascheck.service.sys_service]
ignore = false
enabled_service = "systemctl list-unit-files --type=service --state=enabled --no-pager | grep \"enabled\" | awk '{print $1}'"
running_service = "systemctl list-units --type=service --state=running --no-pager | grep \".service\" | awk '{print $1}'"
[yascheck.service.ssh_info]
ignore = false
enabled = "systemctl list-unit-files --type=service --state=enabled --no-pager | grep \"enabled\" | awk '{print $1}'| grep sshd"
Status = "systemctl is-active sshd"
config_path = "/etc/ssh/sshd_config"
protocol = "cat /etc/ssh/sshd_config | grep Protocol | awk '{print $2}'"
permit_root_login = "cat /etc/ssh/sshd_config | grep PermitRootLogin | awk 'NR==1'"
[yascheck.service.firewalld]
ignore = false
status = "systemctl is-active firewalld"
enabled = "systemctl list-unit-files --type=service --state=enabled --no-pager | grep \"enabled\" | awk '{print $1}'| grep firewalld"
open_ports = "firewall-cmd --zone=public --list-ports"
[yascheck.service.listening_info]
ignore = false
listening_service = "/usr/sbin/ss -tlun"
[yascheck.process_consumption]
ignore = false
cpu_top10 = "ps aux | awk '{print $2, $1, $3, $4, $5, $6, $10, $11}' | sort -k3rn | head -n 10"
mem_top10 = "ps aux | awk '{print $2, $1, $3, $4, $5, $6, $10, $11}' | sort -k4rn | head -n 10"
[yascheck.network_io]
ignore = true
[yascheck.network_io.server]
kill_server = false
cmd = "iperf=/home/yashan/yashandb/22.2.0.9/ext/bin/iperf;$iperf -s -p 9999 -D"
[yascheck.network_io.client]
cmd = "iperf=/home/yashan/yashandb/22.2.0.9/ext/bin/iperf;$iperf -c 127.0.0.1 -p 9999 -i 1 -d -t 10"
[yascheck.disk_io]
ignore = true
cmd = "fio=/home/yashan/yashandb/22.2.0.9/ext/bin/fio;$fio --randrepeat=1 --ioengine=sync --direct=1 --gtod_reduce=1 --name=test --directory=./ --bs=4k --size=4G --readwrite=randrw --rwmixread=75 --runtime=10s --output-format=json"