seabox init
seabox init¶
初始化SeaboxMPP数据库各模块
- 语法
-
``` bash seabox init [OPTIONS]
Options: -a, –prompt execute automatically -v, –verbose debug output -c, –core generate core file -d, –dump-topo just generate seabox-topo.yml, and do not init cluster -k, –skip-hostname-check do not check cluster nodes hostname -E, –encoding TEXT set default encoding for new databases –username TEXT database superuser name -s, –skip-system-check skip to check system configuration. Note: this may cause serious consequences –locale TEXT set default locale for new databases –no-locale equivalent to –locale=C –init-timeout INTEGER fail after waiting timtout(s) for module startup –module-timeout INTEGER fail after waiting timtout(s) for checking startup –enable-strict-safety enable strict safety –cluster-id TEXT cluster id –ignore-error ignore error when checking system and continue to init. Note: this may cause serious consequences –ignore-warning ignore warning when checking system and continue to init. Note: this may affect the use of database –stop-need-password stop need password of sd_dba -h, –help show this help, then exit ```
- 描述
-
初始化SeaboxMPP数据库各模块,支持指定编码,支持指定locale,支持指定宕机时生成core文件,支持设置组件启动的最大超时时间,支持启用多线程模式等
- 注意:seabox init 之前需要编辑SeaboxMPP初始化配置文件,参考SeaboxMPP数据库安装指导中集群安装及初始化章节
- 选项
-
该命令支持选项说明如下:
- Options
-
命令支持的选项
-a, --prompt
- 使用该选项时表示自动执行,不再需要用户确认
-v, --verbose
- 使用该选项时表示程序运行过程中,输出详细的调试信息,便于故障定位
-c, --core
- 使用该选项时表示在集群宕机时生成core文件
-d, --dump-topo
- 使用该选项时表示在不启动集群服务的情况下生成seabox-topo.yml文件
-k, --skip-hostname-check
- 使用该选项时表示忽略对集群安装的服务器中hostname与IP的对应关系的检查
-E, --encoding
- 使用该选项时表示设置数据库默认编码,后面跟指定的编码名称
-s, --skip-system-check
- 使用该选项时表示跳过系统配置检查
--locale
- 使用该选项时表示设置数据库默认语言环境,后面跟指定的locale名称
--no-locale
- 使用该选项时表示禁用语言环境,等同于指定–locale=C
--init-timeout
- 使用该选项时表示设置组件启动的最大超时时间,后面跟指定的最大超时时间
--module-timeout
- 使用该选项时表示设置检查组件是否启动的最大超时时间,后面跟指定的最大超时时间
--enable-strict-safety
- 使用该选项时表示启用严格安全性
--ignore-error
- 使用该选项时表示忽略检查系统配置时warning和error级别的错误并继续初始化。注意:这可能会造成严重后果。
--ignore-warning
- 使用该选项时表示忽略检查系统配置时warning级别的错误并继续初始化。注意:这可能会影响数据库的使用。
-?, --help
- 使用该选项时返回seabox init命令的帮助信息
- 注解
-
如有具体的使用限制及注意事项,在这部分列出。
- 注1: SeaboxMPP数据库的排序规则与语言环境locale有关,21.0版本locale与操作系统locale配置保持一致,21.1版本默认设置为'C',不受操作系统配置影响。以下示例如何在初始化时显式指定与系统配置一致的locale:
以下命令查看系统locale配置:
mpp $ locale LANG=en_US.utf8 LC_CTYPE="en_US.utf8" LC_NUMERIC="en_US.utf8" LC_TIME="en_US.utf8" LC_COLLATE="en_US.utf8" LC_MONETARY="en_US.utf8" LC_MESSAGES="en_US.utf8" LC_PAPER="en_US.utf8" LC_NAME="en_US.utf8" LC_ADDRESS="en_US.utf8" LC_TELEPHONE="en_US.utf8" LC_MEASUREMENT="en_US.utf8" LC_IDENTIFICATION="en_US.utf8" LC_ALL=
得到系统locale为en_US.utf8,以下命令在初始化时指定具体的locale。
seabox init -a --locale=en_US.utf8
登录数据库查询发现排序规则已被locale修改为en_US.utf8。
seaboxsql=# \l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+-------+----------+------------+------------+------------------- seaboxsql | sy | UTF8 | en_US.utf8 | en_US.utf8 | template0 | sy | UTF8 | en_US.utf8 | en_US.utf8 | =c/sy + | | | | | sy=CTc/sy template1 | sy | UTF8 | en_US.utf8 | en_US.utf8 | =c/sy + | | | | | sy=CTc/sy (3 rows)
以下命令在初始化时指定locale为'C'或'POSIX'。
seabox init -a --locale=C Or seabox init -a --no-locale
-
注2: 关于系统检查,seabox init 默认进行以下系统配置检查:系统参数配置检查、系统内核版本检查、系统时间检查、集群主机名配置检查和系统语言环境检查。
-
注3: seabox init命令要求使用SeaboxMPP数据库集群安装用户seabox,或root用户,且需通过以下命令设置正确的环境变量:
source $SDHOME/seaboxmpp_path.sh
其中,$SDHOME为安装SeaboxMPP数据库服务的主目录。
- 示例
-
以下是
seabox init --help
的执行结果:[seabox@mpp-test-1 bin]$ seabox init --help init seabox modules. Usage: seabox init [OPTIONS] Options: -a, --prompt execute automatically -v, --verbose debug output -c, --core generate core file -d, --dump-topo just generate seabox-topo.yml, and do not init cluster -k, --skip-hostname-check do not check cluster nodes hostname -E, --encoding TEXT set default encoding for new databases -s, --skip-system-check skip to check system configuration. Note: this may cause serious consequences --locale TEXT set default locale for new databases --no-locale equivalent to --locale=C --init-timeout INTEGER fail after waiting timtout(s) for module startup --module-timeout INTEGER fail after waiting timtout(s) for checking startup --enable-strict-safety enable strict safety --cluster-id TEXT cluster id --ignore-error ignore error when checking system and continue to init. Note: this may cause serious consequences --ignore-warning ignore warning when checking system and continue to init. Note: this may affect the use of database -h, --help show this help, then exit
以下命令可初始化数据库服务
[seabox@master_regress1 sdsql]$ seabox init -a 2022-10-11 09:28:11 CST [1095353] seabox_init test-1:sy INFO: prepare to do 'seabox init' 2022-10-11 09:28:11 CST [1095353] seabox_init test-1:sy INFO: you can find log in: 2022-10-11 09:28:11 CST [1095353] seabox_init test-1:sy INFO: /home/sy/seaboxAdminLogs/seabox_init_20221011.log 2022-10-11 09:28:11 CST [1095353] seabox_init test-1:sy INFO: SDHOME is set to: 2022-10-11 09:28:11 CST [1095353] seabox_init test-1:sy INFO: /home/sy/pg12/pgsql12 2022-10-11 09:28:11 CST [1095353] seabox_init test-1:sy INFO: Init seabox with args: ['init'] 2022-10-11 09:28:12 CST [1095353] seabox_init test-1:sy INFO: check cluster nodes hostname successful 2022-10-11 09:28:12 CST [1095353] seabox_init test-1:sy INFO: start to check system configiration the following system parameter values do not meet the expectations: host: 'test-1': warning: kernel.sysrq = 16 , expect: 1 warning: net.ipv4.ip_local_port_range = 48000 65535 , expect: 10000 65535 warning: net.ipv4.ip_forward = 1 , expect: 0 you can fix the issues by executing command 'seabox system-check -f' as user 'root' ignore the issues and continue with SEABOX init Yy|Nn (default=N): > y 2022-10-11 09:28:40 CST [1095353] seabox_init test-1:sy INFO: check system kernel version passed between all cluster hosts 2022-10-11 09:28:41 CST [1095353] seabox_init test-1:sy INFO: check system time passed between all cluster hosts 2022-10-11 09:28:46 CST [1095353] seabox_init test-1:sy INFO: check system package loss rate passed on all cluster hosts 2022-10-11 09:28:46 CST [1095353] seabox_init test-1:sy INFO: begin to init cluster 2022-10-11 09:28:46 CST [1095353] seabox_init test-1:sy INFO: SEABOX cluster has 1 scdcs node. For system reliablity, it is recommended to set 3 or more scdcs nodes 2022-10-11 09:28:46 CST [1095353] seabox_init test-1:sy INFO: create scdcs dir successfully 2022-10-11 09:28:46 CST [1095353] seabox_init test-1:sy INFO: create scdcs candidate dir successfully 2022-10-11 09:28:46 CST [1095353] seabox_init test-1:sy INFO: start scdcs on: test-1 2022-10-11 09:28:52 CST [1095353] seabox_init test-1:sy INFO: scdcs start successfully on nodes '['test-1']' 2022-10-11 09:28:52 CST [1095353] seabox_init test-1:sy INFO: wrote seabox executor configuration successfully 2022-10-11 09:28:52 CST [1095353] seabox_init test-1:sy INFO: wrote seabox node configuration successfully 2022-10-11 09:28:52 CST [1095353] seabox_init test-1:sy INFO: success to generate seabox-topo.yml 2022-10-11 09:28:57 CST [1095353] seabox_init test-1:sy INFO: create gtm dir successfully 2022-10-11 09:28:57 CST [1095353] seabox_init test-1:sy INFO: init gtm on node: test-1 . 2022-10-11 09:28:59 CST [1095353] seabox_init test-1:sy INFO: gtm init successfully 2022-10-11 09:29:00 CST [1095353] seabox_init test-1:sy INFO: create executors primary dir successfully 2022-10-11 09:29:00 CST [1095353] seabox_init test-1:sy INFO: init primary executors in list: ['test-1'] ............ 2022-10-11 09:29:12 CST [1095353] seabox_init test-1:sy INFO: 3 of 3 primary executor init successfully 2022-10-11 09:29:12 CST [1095353] seabox_init test-1:sy INFO: total primary executor number is: 3 . 2022-10-11 09:29:13 CST [1095353] seabox_init test-1:sy INFO: executors primary init successfully on nodes '['test-1']' 2022-10-11 09:29:14 CST [1095353] seabox_init test-1:sy INFO: create executor mirror dir successfully 2022-10-11 09:29:15 CST [1095353] seabox_init test-1:sy INFO: init mirror executors in list: ['test-1'] ...... 2022-10-11 09:29:21 CST [1095353] seabox_init test-1:sy INFO: 3 of 3 mirror executor init_mirror successfully 2022-10-11 09:29:21 CST [1095353] seabox_init test-1:sy INFO: total mirror executor number is: 3 2022-10-11 09:29:21 CST [1095353] seabox_init test-1:sy INFO: total mirror executor number is: 3 .. 2022-10-11 09:29:23 CST [1095353] seabox_init test-1:sy INFO: executors mirror init successfully on nodes '['test-1']' 2022-10-11 09:29:23 CST [1095353] seabox_init test-1:sy INFO: create coordinators dir successfully 2022-10-11 09:29:24 CST [1095353] seabox_init test-1:sy INFO: init coordinators in list: ['test-1'] 2022-10-11 09:29:24 CST [1095353] seabox_init test-1:sy INFO: total coordinator number is: 2 .......... 2022-10-11 09:29:34 CST [1095353] seabox_init test-1:sy INFO: 2 of 2 coordinators init successfully . 2022-10-11 09:29:35 CST [1095353] seabox_init test-1:sy INFO: coordinators init successfully on nodes '['test-1']' 2022-10-11 09:29:35 CST [1095353] seabox_init test-1:sy INFO: init seaboxmpp cluster successfully 2022-10-11 09:29:35 CST [1095353] seabox_init test-1:sy INFO: create monitor dir successfully 2022-10-11 09:29:35 CST [1095353] seabox_init test-1:sy INFO: init monitors in list: ['test-1'] 2022-10-11 09:29:35 CST [1095353] seabox_init test-1:sy INFO: total monitor number is: 2 . 2022-10-11 09:29:37 CST [1095353] seabox_init test-1:sy INFO: monitors init successfully on nodes '['test-1']' 2022-10-11 09:29:37 CST [1095353] seabox_init test-1:sy INFO: start detect_scdcs host test-1 2022-10-11 09:29:37 CST [1095353] seabox_init test-1:sy INFO: init seaboxmpp cluster successfully
如上例,当检查系统配置出错时,会询问用户是否继续进行初始化,输入y则忽略问题继续初始化,输入y则停止初始化。也可使用以下命令忽略检查配置产生的warning或error。
seabox init -a --ignore-warning seabox init -a --ignore-error
以下命令跳过检查系统配置
seabox init -as
- 相关命令
- 无