• initdb 简介


    os:centos 6.8
    postgresql:10.3

    查看initdb的参数

    $ /usr/pgsql-10/bin/initdb --help
    initdb initializes a PostgreSQL database cluster.
    
    Usage:
      initdb [OPTION]... [DATADIR]
    
    Options:
      -A, --auth=METHOD         default authentication method for local connections
          --auth-host=METHOD    default authentication method for local TCP/IP connections
          --auth-local=METHOD   default authentication method for local-socket connections
     [-D, --pgdata=]DATADIR     location for this database cluster
      -E, --encoding=ENCODING   set default encoding for new databases
          --locale=LOCALE       set default locale for new databases
          --lc-collate=, --lc-ctype=, --lc-messages=LOCALE
          --lc-monetary=, --lc-numeric=, --lc-time=LOCALE
                                set default locale in the respective category for
                                new databases (default taken from environment)
          --no-locale           equivalent to --locale=C
          --pwfile=FILE         read password for the new superuser from file
      -T, --text-search-config=CFG
                                default text search configuration
      -U, --username=NAME       database superuser name
      -W, --pwprompt            prompt for a password for the new superuser
      -X, --waldir=WALDIR       location for the write-ahead log directory
    
    Less commonly used options:
      -d, --debug               generate lots of debugging output
      -k, --data-checksums      use data page checksums
      -L DIRECTORY              where to find the input files
      -n, --no-clean            do not clean up after errors
      -N, --no-sync             do not wait for changes to be written safely to disk
      -s, --show                show internal settings
      -S, --sync-only           only sync data directory
    
    Other options:
      -V, --version             output version information, then exit
      -?, --help                show this help, then exit
    
    If the data directory is not specified, the environment variable PGDATA
    is used.
    
    Report bugs to <pgsql-bugs@postgresql.org>.
    

    初始化
    添加了 –debug –data-checksums

    $ /usr/pgsql-10/bin/initdb -D /var/lib/pgsql/10/data -U postgres -W -E UTF8 --locale=zh_CN.UTF-8 --debug --data-checksums
    
    

    未添加 –debug –data-checksums

    $ /usr/pgsql-10/bin/initdb -D /var/lib/pgsql/10/data -U postgres -W -E UTF8 --locale=zh_CN.UTF-8    
    
    
    The files belonging to this database system will be owned by user "postgres".
    This user must also own the server process.
    
    The database cluster will be initialized with locale "zh_CN.UTF-8".
    initdb: could not find suitable text search configuration for locale "zh_CN.UTF-8"
    The default text search configuration will be set to "simple".
    
    Data page checksums are disabled.
    
    Enter new superuser password: 
    Enter it again: 
    
    fixing permissions on existing directory /var/lib/pgsql/10/data ... ok
    creating subdirectories ... ok
    selecting default max_connections ... 100
    selecting default shared_buffers ... 128MB
    selecting dynamic shared memory implementation ... posix
    creating configuration files ... ok
    running bootstrap script ... ok
    performing post-bootstrap initialization ... ok
    syncing data to disk ... ok
    
    WARNING: enabling "trust" authentication for local connections
    You can change this by editing pg_hba.conf or using the option -A, or
    --auth-local and --auth-host, the next time you run initdb.
    
    Success. You can now start the database server using:
    
        /usr/pgsql-10/bin/pg_ctl -D /var/lib/pgsql/10/data -l logfile start

    默认的一些参数

    $ egrep ^[a-z] ./postgresql.conf 
    max_connections = 100           # (change requires restart)
    shared_buffers = 128MB          # min 128kB
    dynamic_shared_memory_type = posix  # the default is the first option
    log_destination = 'stderr'      # Valid values are combinations of
    logging_collector = on          # Enable capturing of stderr and csvlog
    log_directory = 'log'           # directory where log files are written,
    log_filename = 'postgresql-%a.log'  # log file name pattern,
    log_truncate_on_rotation = on       # If on, an existing log file with the
    log_rotation_age = 1d           # Automatic rotation of logfiles will
    log_rotation_size = 0           # Automatic rotation of logfiles will
    log_line_prefix = '%m [%p] '        # special values:
    log_timezone = 'PRC'
    datestyle = 'iso, ymd'
    timezone = 'PRC'
    lc_messages = 'zh_CN.UTF-8'         # locale for system error message
    lc_monetary = 'zh_CN.UTF-8'         # locale for monetary formatting
    lc_numeric = 'zh_CN.UTF-8'          # locale for number formatting
    lc_time = 'zh_CN.UTF-8'             # locale for time formatting
    default_text_search_config = 'pg_catalog.simple'

    登录postgresql,查看信息

    $ psql
    psql (10.3)
    Type "help" for help.
    
    postgres=# select version();
                                                     version                                                 
    ---------------------------------------------------------------------------------------------------------
     PostgreSQL 10.3 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18), 64-bit
    (1 row)
    
    postgres=# l
                                      List of databases
       Name    |  Owner   | Encoding |   Collate   |    Ctype    |   Access privileges   
    -----------+----------+----------+-------------+-------------+-----------------------
     postgres  | postgres | UTF8     | zh_CN.UTF-8 | zh_CN.UTF-8 | 
     template0 | postgres | UTF8     | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres          +
               |          |          |             |             | postgres=CTc/postgres
     template1 | postgres | UTF8     | zh_CN.UTF-8 | zh_CN.UTF-8 | =c/postgres          +
               |          |          |             |             | postgres=CTc/postgres
    (3 rows)
    
    
    
    postgres=# select * from pg_collation ;
    
           collname        | collnamespace | collowner | collprovider | collencoding |      collcollate      |       collctype       | collversion 
    -----------------------+---------------+-----------+--------------+--------------+-----------------------+-----------------------+-------------
     default               |            11 |        10 | d            |           -1 |                       |                       | 
     C                     |            11 |        10 | c            |           -1 | C                     | C                     | 
     POSIX                 |            11 |        10 | c            |           -1 | POSIX                 | POSIX                 | 
     ucs_basic             |            11 |        10 | c            |            6 | C                     | C                     | 
     aa_DJ                 |            11 |        10 | c            |            8 | aa_DJ                 | aa_DJ                 | 
     aa_DJ.iso88591        |            11 |        10 | c            |            8 | aa_DJ.iso88591        | aa_DJ.iso88591        | 
     aa_DJ.utf8            |            11 |        10 | c            |            6 | aa_DJ.utf8            | aa_DJ.utf8            | 
     aa_ER                 |            11 |        10 | c            |            6 | aa_ER                 | aa_ER                 | 
     aa_ER@saaho           |            11 |        10 | c            |            6 | aa_ER@saaho           | aa_ER@saaho           | 
     aa_ER.utf8            |            11 |        10 | c            |            6 | aa_ER.utf8            | aa_ER.utf8            | 
     aa_ER.utf8@saaho      |            11 |        10 | c            |            6 | aa_ER.utf8@saaho      | aa_ER.utf8@saaho      | 
     aa_ET                 |            11 |        10 | c            |            6 | aa_ET                 | aa_ET                 | 
    
     中间省略若干行
     zh-x-icu              |            11 |        10 | i            |           -1 | zh                    | zh                    | 49.192.0.41
     zh-hans-x-icu         |            11 |        10 | i            |           -1 | zh_Hans               | zh_Hans               | 49.192.0.41
     zh-hans-cn-x-icu      |            11 |        10 | i            |           -1 | zh_Hans_CN            | zh_Hans_CN            | 49.192.0.41
     zh-hans-hk-x-icu      |            11 |        10 | i            |           -1 | zh_Hans_HK            | zh_Hans_HK            | 49.192.0.41
     zh-hans-mo-x-icu      |            11 |        10 | i            |           -1 | zh_Hans_MO            | zh_Hans_MO            | 49.192.0.41
     zh-hans-sg-x-icu      |            11 |        10 | i            |           -1 | zh_Hans_SG            | zh_Hans_SG            | 49.192.0.41
     zh-hant-x-icu         |            11 |        10 | i            |           -1 | zh_Hant               | zh_Hant               | 49.192.0.41
     zh-hant-hk-x-icu      |            11 |        10 | i            |           -1 | zh_Hant_HK            | zh_Hant_HK            | 49.192.0.41
     zh-hant-mo-x-icu      |            11 |        10 | i            |           -1 | zh_Hant_MO            | zh_Hant_MO            | 49.192.0.41
     zh-hant-tw-x-icu      |            11 |        10 | i            |           -1 | zh_Hant_TW            | zh_Hant_TW            | 49.192.0.41
     zu-x-icu              |            11 |        10 | i            |           -1 | zu                    | zu                    | 49.192.0.41
     zu-za-x-icu           |            11 |        10 | i            |           -1 | zu_ZA                 | zu_ZA                 | 49.192.0.41
    (1162 rows)
  • 相关阅读:
    eslint 的 env 配置是干嘛使的?
    cookie httpOnly 打勾
    如何定制 antd 的样式(theme)
    剑指 Offer 66. 构建乘积数组
    剑指 Offer 65. 不用加减乘除做加法
    剑指 Offer 62. 圆圈中最后剩下的数字
    剑指 Offer 61. 扑克牌中的顺子
    剑指 Offer 59
    剑指 Offer 58
    剑指 Offer 58
  • 原文地址:https://www.cnblogs.com/ctypyb2002/p/9793041.html
Copyright © 2020-2023  润新知