跳转至

seabox config

seabox config

设置SeaboxMPP数据库配置参数命令

语法

``` bash seabox config [OPTIONS]

Options: -c, –change TEXT change seabox property -r, –remove TEXT remove seabox property -s, –show TEXT show seabox property -l, –list list all seabox properties -v, –value TEXT set seabox property value -q, –quiet quiet mode -C, –coordinator_value TEXT set seabox coordinator property value -E, –executor_value TEXT set seabox executor property value -U, –db_user TEXT connect to the seabox database with this user –dbid TEXT set seabox specified coordinator or executor property value

–skipvalidation skip the system validation checks -h, –help show this help, then exit

```

描述

设置SeaboxMPP数据库配置参数,支持在指定的组件实例或所有组件实例修改或恢复或显示参数值,支持列出所有的参数及其值

  • 注意:如有注意事项,补充
选项

该命令支持选项说明如下:

Options

命令支持的选项

-c, --change
使用该选项时表示修改或者添加参数,后面跟指定的参数名称
-r, --remove
使用该选项时表示恢复参数默认值,后面跟指定的参数名称
-s, --show
使用该选项时表示显示参数及其值,后面跟指定的参数名称
-l, --list
使用该选项时表示列出所有参数及其值
-v, --value
该选项与--change选项组合使用,后面跟指定的参数值
-q, --quiet
使用该选项时表示以静默方式执行,不打印输出信息
-C, --coordinator_value
使用该选项时表示设置coordinator各实例上参数的值
-E, --executor_value
使用该选项时表示设置executor各实例上参数的值
-U, --db_user
使用该选项时表示以指定用户连接数据库
--dbid
使用该选项时表示设置指定实例上参数的值
--skipvalidation
使用该选项时表示跳过参数合法性检查
-h, --help
使用该选项时返回seabox config命令的帮助信息
注解

如有具体的使用限制及注意事项,在这部分列出。

  • 注1:seabox config命令对选项的组合使用有严格限制,若输入的不支持的选项组合,则会报错退出。所有支持的选项组合说明如下:

  • -c选项支持的组合如下:

    seabox config -c <para_name> -v <value> [--skipvalidation] [-q] [-C <coor_value> | --dbid <dbid_value>] [-E <exec_value> | --dbid <dbid_value>] [-U <db_user>]
    

  • -r选项支持的组合如下:

    seabox config -r para_name [-q] [--dbid <dbid_value>]
    

  • -s选项支持的组合如下:

    seabox config -s para_name [-q] [--dbid <dbid_value>]
    

  • -l选项支持的组合如下:

    seabox config -l [-q] [-U <db_user>]
    

  • 注2: 使用 alter system 修改参数后,再使用 seabox config 修改参数不会生效。为避免造成使用上的误会,不允许通过 seabox config 修改 alter system 改过的参数。

seaboxsql.auto.conf 的优先级高于 seaboxsql.conf:使用 alter system 修改的是 seaboxsql.auto.conf 文件,seabox config 修改的是 seaboxsql.conf 文件。如果一个参数同时存在于 seaboxsql.auto.conf 和 seaboxsql.conf 里面,系统会先读 seaboxsql.conf 的参数配置,再读 seaboxsql.auto.conf 的参数配置,因此,该参数的值最终使用 seaboxsql.auto.conf 中的配置。

若想要使用 seabox config 修改参数并生效,需要执行 ALTER SYSTEM RESET configuration_parameter 或者 ALTER SYSTEM SET configuration_parameter = default 删除 seaboxsql.auto.conf 中对应的参数配置。比如执行 alter system set max_wal_size=default 将参数设回 default 时,seaboxsqll.auto.conf 文件里的 max_wal_size 这项配置会被删除,重新用回 seaboxsql.conf 文件的设置。

  • 注3: 使用 alter databse 和 alter user 修改参数的优先级在局部同样高于 seabox config。为避免造成使用上的误会,若 seabox config –show 指定的参数已经被 alter databse 或 alter user 修改过,则会打印该参数在 pg_db_role_setting 中的记录,以作提示。

  • 注4: seabox config命令要求使用SeaboxMPP数据库集群安装用户seabox,或root用户,且需通过以下命令设置正确的环境变量:

source $SDHOME/seaboxmpp_path.sh

其中,$SDHOME为安装SeaboxMPP数据库服务的主目录。

示例

以下是seabox config --help的执行结果:

[seabox@mpp-test-1 bin]$ seabox config --help
set seabox properties.

Usage: 
  seabox config [OPTIONS]

Options:
  -c, --change TEXT             change seabox property
  -r, --remove TEXT             remove seabox property
  -s, --show TEXT               show seabox property
  -l, --list                    list all seabox properties
  -v, --value TEXT              set seabox property value
  -q, --quiet                   quiet mode
  -C, --coordinator_value TEXT  set seabox coordinator property value
  -E, --executor_value TEXT     set seabox executor property value
  -U, --db_user TEXT            connect to the seabox database with this user
  --dbid TEXT                   set seabox specified coordinator or executor
                                property value

  --skipvalidation              skip the system validation checks
  -h, --help                    show this help, then exit

以下命令可修改配置参数random_page_cost,并为coordinator和executor的实例分别设置不同的参数值5和10(默认的参数值为1,但是此处同时指定-C和-E,因此默认值1被5和10覆盖)

[seabox@master_regress1 sdsql]$ seabox config -c random_page_cost -v 1 -C 5 -E 10
2022-07-06 17:34:36 CST [50571] seabox_config master_regress1:seabox INFO: change random_page_cost parameter on host 172.25.0.3 for module /home/seabox/seabox-data-directory/coordinatordd/0
2022-07-06 17:34:37 CST [50571] seabox_config master_regress1:seabox INFO: change random_page_cost parameter on host 172.25.0.2 for module /home/seabox/seabox-data-directory/coordinatordd/1
2022-07-06 17:34:37 CST [50571] seabox_config master_regress1:seabox INFO: change random_page_cost parameter on host node1_regress1 for module /home/seabox/seabox-data-directory/executordd/primary/7
2022-07-06 17:34:38 CST [50571] seabox_config master_regress1:seabox INFO: change random_page_cost parameter on host node1_regress1 for module /home/seabox/seabox-data-directory/executordd/primary/8

......

2022-07-06 17:34:44 CST [50571] seabox_config master_regress1:seabox INFO: change random_page_cost parameter on host node2_regress1 for module /home/seabox/seabox-data-directory/executordd/primary/4
2022-07-06 17:34:45 CST [50571] seabox_config master_regress1:seabox INFO: change random_page_cost parameter on host node2_regress1 for module /home/seabox/seabox-data-directory/executordd/primary/5
2022-07-06 17:34:45 CST [50571] seabox_config master_regress1:seabox INFO: change random_page_cost parameter on host node1_regress1 for module /home/seabox/seabox-data-directory/executordd/primary/6

指定-q选项可静默执行,不打印输出信息

[seabox@master_regress1 sdsql]$ seabox config -c random_page_cost -v 1 -C 5 -E 10 -q
[seabox@master_regress1 sdsql]$ 

修改参数后可执行以下命令以重载数据库,更新参数值

[seabox@master_regress1 sdsql]$ seabox notify reload
2022-07-06 17:36:30 CST [51316] seabox_stop master_regress1:seabox INFO: gathering information and validating the environment...
2022-07-06 17:36:30 CST [51316] seabox_stop master_regress1:seabox INFO: seabox version: 'seaboxsql (SeaboxSQL) 21.1.0.1678'
2022-07-06 17:36:33 CST [51316] seabox_stop master_regress1:seabox INFO: signalling all seabox processes to reload

以下命令可查看参数random_page_cost的值

[seabox@master_regress1 sdsql]$ seabox config -s random_page_cost
GUC                 : random_page_cost
Dbid:        1 Value: 5
Dbid:       10 Value: 10
Dbid:       11 Value: 10
Dbid:       12 Value: 10
Dbid:       13 Value: 10
Dbid:       14 Value: 10
Dbid:       15 Value: 10
Dbid:       16 Value: 10
Dbid:       17 Value: 10
Dbid:       18 Value: 10
Dbid:       19 Value: 10
Dbid:        2 Value: 5
Dbid:       20 Value: 10
Dbid:        3 Value: 10
Dbid:        4 Value: 10
Dbid:        5 Value: 10
Dbid:        6 Value: 10
Dbid:        7 Value: 10
Dbid:        8 Value: 10
Dbid:        9 Value: 10

[seabox@master_regress1 sdsql]$ seabox config -s random_page_cost --dbid 2
GUC		: random_page_cost
Value		: 5

以下命令可恢复参数random_page_cost的默认值

[seabox@master_regress1 sdsql]$ seabox config -r random_page_cost
2022-07-06 17:41:29 CST [53155] seabox_config master_regress1:seabox INFO: remove random_page_cost parameter on host 172.25.0.3 for module /home/seabox/seabox-data-directory/coordinatordd/0
2022-07-06 17:41:29 CST [53155] seabox_config master_regress1:seabox INFO: remove random_page_cost parameter on host 172.25.0.2 for module /home/seabox/seabox-data-directory/coordinatordd/1
2022-07-06 17:41:29 CST [53155] seabox_config master_regress1:seabox INFO: remove random_page_cost parameter on host node1_regress1 for module /home/seabox/seabox-data-directory/executordd/primary/7
2022-07-06 17:41:30 CST [53155] seabox_config master_regress1:seabox INFO: remove random_page_cost parameter on host node1_regress1 for module /home/seabox/seabox-data-directory/executordd/primary/8

......

2022-07-06 17:41:33 CST [53155] seabox_config master_regress1:seabox INFO: remove random_page_cost parameter on host node2_regress1 for module /home/seabox/seabox-data-directory/executordd/primary/4
2022-07-06 17:41:34 CST [53155] seabox_config master_regress1:seabox INFO: remove random_page_cost parameter on host node2_regress1 for module /home/seabox/seabox-data-directory/executordd/primary/5
2022-07-06 17:41:34 CST [53155] seabox_config master_regress1:seabox INFO: remove random_page_cost parameter on host node1_regress1 for module /home/seabox/seabox-data-directory/executordd/primary/6

以下命令可列出所有的参数及其值

[seabox@master_regress1 sdsql]$ seabox config -l
GUC		: application_name
Value		: 

GUC		: archive_cleanup_command
Value		: 

GUC		: archive_command
Value		: (disabled)

......

SCDCS		: monitor_auto_set_instance_removed
Value		: 1

SCDCS		: monitor_detect_instance_restart_count
Value		: 5

SCDCS		: monitor_detect_instance_restart_duration_time
Value		: 180
相关命令
sd_ctl config

设置SeaboxSQL数据库配置参数命令

语法

``` bash sd_ctl config [–change PROPERTY_NAME] [–value PROPERTY_VALUE] [–remove PROPERTY_NAME] [–show PROPERTY_NAME] [–list] [-q] [-u USER] [–skipvalidation]

Options for config: –change=NAME change seabox property –remove=NAME remove seabox property –show=NAME show seabox property –list list all seabox properties -v, –value=VALUE set seabox property value -q, –quiet quiet mode -u, –db_user=USER connect to seabox database with this user –skipvalidation skip the system validation checks ```

描述

设置SeaboxSQL数据库配置参数,支持在本机修改或恢复或显示参数值,支持列出所有的参数及其值

  • 注意:如有注意事项,补充
选项

该命令支持选项说明如下:

Options

命令支持的选项

--change
使用该选项时表示修改或者添加参数,后面跟指定的参数名称
--remove
使用该选项时表示恢复参数默认值,后面跟指定的参数名称
--show
使用该选项时表示显示参数及其值,后面跟指定的参数名称
--list
使用该选项时表示列出所有参数及其值
--value
该选项与--change选项组合使用,后面跟指定的参数值
-q, --quiet
使用该选项时表示以静默方式执行,不打印输出信息
-u, --db_user
使用该选项时表示以指定用户连接数据库
--skipvalidation
使用该选项时表示跳过参数合法性检查
注解

如有具体的使用限制及注意事项,在这部分列出。

  • 注1: 使用 alter system 修改参数后,再使用 sd_ctl config 修改参数不会生效。为避免造成使用上的误会,不允许通过 sd_ctl config 修改 alter system 改过的参数。

  • 注2: sd_ctl config命令要求使用SeaboxSQL数据库集群安装用户seabox,或root用户,且需通过以下命令设置正确的环境变量:

source $SDHOME/seaboxmpp_path.sh

其中,$SDHOME为安装SeaboxSQL数据库服务的主目录。

示例

以下是sd_ctl --help的执行结果:

[seabox@mpp-test-1 bin]$ sd_ctl --help
sd_ctl is a utility to initialize, start, stop, or control a SeaboxSQL server.

Usage:
  sd_ctl init[db]   [-D DATADIR] [-s] [-o OPTIONS]
  sd_ctl start      [-D DATADIR] [-l FILENAME] [-W] [-t SECS] [-s]
                    [-o OPTIONS] [-p PATH] [-c]
                    [-K KEY-CMD]  [-R role] [-I instance-id]
  sd_ctl stop       [-D DATADIR] [-m SHUTDOWN-MODE] [-W] [-t SECS] [-s]
                    [-R role] [-I instance-id]
  sd_ctl restart    [-D DATADIR] [-m SHUTDOWN-MODE] [-W] [-t SECS] [-s]
                    [-o OPTIONS] [-c]
                    [-K KEY-CMD]  [-R role] [-I instance-id]
  sd_ctl reload     [-D DATADIR] [-s]
  sd_ctl status     [-D DATADIR]
  sd_ctl config     [--change PROPERTY_NAME] [--value PROPERTY_VALUE]
                    [--remove PROPERTY_NAME] [--show PROPERTY_NAME] [--list]
                    [-q] [-u USER] [--skipvalidation]
  sd_ctl promote    [-D DATADIR] [-W] [-t SECS] [-s]
  sd_ctl logrotate  [-D DATADIR] [-s]
  sd_ctl kill       SIGNALNAME PID

Common options:
  -D, --sddata=DATADIR   location of the database storage area
  -K, --encryption-key-command
                        command that returns encryption key

  -s, --silent           only print errors, no informational messages
  -t, --timeout=SECS     seconds to wait when using -w option
  -V, --version          output version information, then exit
  -w, --wait             wait until operation completes (default)
  -W, --no-wait          do not wait until operation completes
  -R, --role             role of instance to be operated: primary or secondary
  -?, --help             show this help, then exit
If the -D option is omitted, the environment variable SDDATA is used.

Options for config:
  --change=NAME          change seabox property
  --remove=NAME          remove seabox property
  --show=NAME            show seabox property
  --list                 list all seabox properties
  -v, --value=VALUE      set seabox property value
  -q, --quiet            quiet mode
  -u, --db_user=USER     connect to seabox database with this user
  --skipvalidation       skip the system validation checks

Options for start or restart:
  -c, --core-files       allow seaboxsql to produce core files
  -l, --log=FILENAME     write (or append) server log to FILENAME
  -o, --options=OPTIONS  command line options to pass to seaboxsql
                        (SeaboxSQL server executable) or initdb
  -p PATH-TO-SEABOXSQL   normally not necessary

Options for stop or restart:
  -m, --mode=MODE        MODE can be "smart", "fast", or "immediate"

Shutdown modes are:
  smart       quit after all clients have disconnected
  fast        quit directly, with proper shutdown (default)
  immediate   quit without complete shutdown; will lead to recovery on restart

Allowed signal names for kill:
  ABRT HUP INT KILL QUIT TERM USR1 USR2

以下命令可修改配置参数random_page_cost值为5

sd_ctl config --change random_page_cost --value 5

以下命令可查看参数random_page_cost的值

sd_ctl config --show random_page_cost

以下命令可恢复参数random_page_cost的默认值

sd_ctl config --remove random_page_cost

以下命令可列出所有的参数及其值,并指定数据库用户为lihua

[seabox@master_regress1 sdsql]$ sd_ctl config --list -u lihua
相关命令