Command Reference

Command Reference

Table 1 and Table 2 list commonly used and uncommonly used parameters required for gs_initdb.

Table 1 Common parameters

Parameter

Description

Value Range

-A, --auth=METHOD

Specifies the authentication method for local users used in pg_hba.conf (host and local rows).

Do not use trust, which is the default value, unless you trust all local users on your system.

Values of METHOD:

  • trust
  • reject
  • md5 (an insecure algorithm, used for compatibility with earlier versions)
  • sha256
  • sm3

Default value: trust

--auth-host=METHOD

Specifies the authentication method for local users via TCP/IP connections used in pg_hba.conf (host rows).

The value specified in the -A parameter is overwritten when this parameter is specified.

Values of METHOD:

  • trust
  • reject
  • md5 (an insecure algorithm, used for compatibility with earlier versions)
  • sha256
  • sm3

Default value: trust

--auth-local=METHOD

Specifies the authentication method for local users via Unix-domain socket connections used in pg_hba.conf (local rows).

The value specified in the -A parameter is overwritten when this parameter is specified.

Values of METHOD:

  • trust
  • reject
  • md5 (an insecure algorithm, used for compatibility with earlier versions)
  • sha256
  • sm3
  • peer (only for the local mode)

Default value: trust

-c, --enable-dcf

Sets the node to be installed to the DCF mode.

NOTE:

In the Lite scenario, this parameter is provided by openGauss, but the DCF function is unavailable. openGauss provides master node selection when DCF is available. You can configure DCF-related parameters.

-

[-D, --pgdata=]DATADIR

Specifies the data directory.

Set DATADIR as needed. The value cannot contain "|", ";", "&", "$", "<", ">", "`", "\\", or "!".

--nodename=NODENAME

Specifies the name of the node to be initialized.

The value cannot contain "|", ";", "&", "$", "<", ">", "`", "\\", or "!".

-E, --encoding=ENCODING

Sets the encoding format for the new database.

  • If this parameter is specified, you also need to add the --locale option to specify the locale that supports this encoding format. If the --locale option is not added, the system default locale is used. If the encoding format in the system default locale is inconsistent with the encoding format specified in this parameter, the database initialization fails.
  • If this parameter is not specified, the encoding format of the default locale is used. You can run the locale command to view the default locale and its encoding format:
    omm@linux:~> locale|grep LC_CTYPE
    LC_CTYPE="en_US.UTF-8"
    

    In the command output, UTF-8 indicates the encoding format of the default locale.

    The value cannot contain "|", ";", "&", "$", "<", ">", "`", "\\", or "!".

--locale=LOCALE

Sets the default locale for the new database.

NOTICE:

If you have set the database encoding format, ensure that the locale you select has the same encoding format as the preset one. Otherwise, the database initialization fails.

For example, to set the database encoding format to GBK, perform the following steps:

  1. Run the locale -a |grep gbk command to query the locales that support GBK:
    omm@linux:~>  locale -a|grep gbk
    zh_CN.gbk
    zh_SG.gbk
    
  2. Add the --locale=zh_CN.gbk option when initializing the database.
  3. The value cannot contain "|", ";", "&", "$", "<", ">", "`", "\\", or "!".

--dbcompatibility=DBCOMPATIBILITY

Sets the default compatibility for the new database.

The value cannot contain "|", ";", "&", "$", "<", ">", "`", "\\", or "!".

--lc-collate=LOCALE

--lc-ctype=LOCALE

--lc-messages=LOCALE

--lc-monetary=LOCALE

--lc-numeric=LOCALE

--lc-time=LOCALE

Sets the locale in the specified category for the new database.

The parameter values must be supported by the OS. The value cannot contain "|", ";", "&", "$", "<", ">", "`", "\\", or "!".

NOTE:

If the --lc-collate parameter is not specified when the database is installed, the default value of --lc-collate is C.

--no-locale

Equivalent to --locale=C.

-

--pwfile=FILE

Reads the password of the database sysadmin from FILE during the running of gs_initdb. The first line of the file is taken as the password.

The format of FILE can be "a relative path+file" or "an absolute path+file". The relative path is relative to the current path. The value cannot contain "|", ";", "&", "$", "<", ">", "`", "\\", or "!".

-T, --text-search-config=CFG

Sets the default text search mode.

Values of text-search-config:

  • pg_catalog.english: full-context search
  • pg_catalog.simple: common text search

Default value: pg_catalog.simple

-U, --username=NAME

Selects the username of the database sysadmin.

Value range: normal database users The value cannot contain "|", ";", "&", "<", ">", "`", "\\", or "!".

Default value: OS user who runs gs_initdb

-W, --pwprompt

Prompts users to enter the password of the database administrator during the running of gs_initdb.

-

-w, --pwpasswd=PASSWD

Specifies the password of the database administrator by running commands during the running of gs_initdb instead of interactive input.

The password must meet the following complexity requirement:

  • The password must contain at least eight characters.
  • Cannot be the same as the username, the current password (ALTER), or the current password in an inverted sequence.
  • Contains at least three types of the following characters:
    • Uppercase letters (A-Z)
    • Lowercase letters (a-z)
    • Digits: 0–9
    • Special characters: ~!@#$%^&*()-_=+\|[{}];:,<.>/?

-C, --enpwdfiledir=DIR

Specifies the directory where the password encrypted is located, using the AES128 encryption algorithm during the running of gs_initdb. gs_initdb decrypts the password file in this directory and performs the password complexity check on the decrypted password. The password is used as the user's password if the verification result is passed.

NOTE:
  • Run the gs_guc encrypt -K password -D Dir command to generate the encrypted password file.
  • If multiple -w and -C parameters are specified, gs_initdb regards the last -w or -C parameter as the user's requirement (entering a plaintext password or a password encrypted using AES128).

The value cannot contain "|", ";", "&", "$", "<", ">", "`", "\\", or "!".

-X, --xlogdir=XLOGDIR

Specifies the directory where the transaction logs are stored.

The directory must be a directory for which openGauss users have the read and write permissions.

The value can be an absolute path or a relative path. The relative path is relative to the data directory. The value cannot contain "|", ";", "&", "$", "<", ">", "`", "\\", or "!".

-S, --security

This database is initialized in the security mode.

After the database is initialized using -S, the created database user permissions are restricted, and the public schema permission cannot be used any more by default.

Table 2 Uncommon parameters

Parameter

Description

Value Range

-d, --debug

Prints debugging output from the bootstrap backend. The bootstrap backend is the program for gs_initdb to create the system catalogs.

-

-L DIRECTORY

Specifies the input file path where the database is initialized using gs_initdb. Usually, it is unnecessary. You will be prompted if you need to specify their location explicitly.

Path of input files required by the initialized database The value cannot contain "|", ";", "&", "$", "<", ">", "`", "\\", or "!".

-n, --noclean

If this parameter is not specified and gs_initdb determines that an error prevents it from creating a database, it removes any files it might have created before discovering that it cannot finish the job. This option inhibits tidying-up and is therefore useful for debugging.

-

-s, --show

Displays internal settings.

-

-H, --host-ip

Initializes the openGauss node node_host.

The value cannot contain "|", ";", "&", "$", "<", ">", "`", "\\", or "!".

-V, --version

Prints the gs_initdb version information and exits.

-

-?, --help

Displays help information about gs_initdb command parameters and exits.

-

-g

Specifies the path of the shared Xlog file for initializing the cross-AZ DR database instance that uses the shared storage.

Specified shared log file path. The value cannot contain "|", ";", "&", "$", "<", ">", "`", "\\", or "!".

Feedback
编组 3备份
    openGauss 2024-04-23 00:46:19
    cancel