[转帖]initdb 简介

initdb,简介 · 浏览次数 : 0

小编点评

## Generate content with specific format specifiers Sure, here's the generated content with the specified format specifiers: ```sql -- Version SELECT version(); -- Collations SELECT collname, collnamespace, collowner, collprovider, collencoding, collcollate, collctype, collversion FROM pg_collation; -- System error message locale SELECT default_text_search_config FROM pg_catalog.simple; ``` **Explanation:** * The first query retrieves the current version of the PostgreSQL server. * The second query shows all currently defined collations, including their names, namespaces, owners, providers, codening, collating, colltype, and version. * The third query retrieves the default text search configuration for system error messages. **Note:** * The number of rows shown for the `system error message locale` may vary depending on your system configuration. * The content is formatted with simple and clear formatting for easier reading.

正文

https://www.cnblogs.com/ctypyb2002/p/9793041.html

写总结前 要看完整呢 不能太随意. 

 

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>.
VHDL 复制 全屏

初始化
添加了 –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)

与[转帖]initdb 简介相似的内容:

[转帖]initdb 简介

https://www.cnblogs.com/ctypyb2002/p/9793041.html 写总结前 要看完整呢 不能太随意. os:centos 6.8postgresql:10.3 查看initdb的参数 $ /usr/pgsql-10/bin/initdb --help initdb

[转帖]gs_initdb

https://www.bookstack.cn/read/opengauss-2.0-zh/f83d4f7623b4119d.md 简介 背景信息 gs_initdb初始化数据库时,会创建数据库目录、生成系统表、创建默认数据库和模板数据库。 系统表 初始化数据库时会生成大量的系统表和视图,其中绝大

[转帖]initdb命令 – 初始化PostgreSQL数据库

https://www.xtuos.com/2202.html 使用initdb命令可以在安装完PostgreSQL服务器所需软件包之后,初始化一个PostgreSQL数据库簇。 语法格式: initdb [参数] [目录] 常用参数: -U 指定数据库超级用户名 -W 对于新的超级用户提示输入口令

[转帖]Kingbase重新数据初始化,设置大小写

KingbaseV8数据库安装完成后,删除/opt/Kingbase/ES/V8/data下所有内容,重新在其他目录初始化数据库,设置为忽略大小写 [kingbase@dbserver bin]$ ./initdb -E UTF-8 -U SYSTEM -W kingbase2021 --case-

[转帖]瀚高数据库 SM3和MD5密码验证配置

我们都知道,瀚高数据库安全版v4.5和企业版v6都支持国密sm3。一般我们在initdb的时候,会通过选项“-A sm3”来指定,这样的效果是创建用户或修改密码时,默认就会使用sm3取密码的散列值。我们也可以在后期添将密码动态改为md5。 例如,我们当前默认是md5,现在要添加一个用户,使用sm3,

[转帖]

Linux ubuntu20.04 网络配置(图文教程) 因为我是刚装好的最小系统,所以很多东西都没有,在开始配置之前需要做下准备 环境准备 系统:ubuntu20.04网卡:双网卡 网卡一:供连接互联网使用网卡二:供连接内网使用(看情况,如果一张网卡足够,没必要做第二张网卡) 工具: net-to

[转帖]

https://cloud.tencent.com/developer/article/2168105?areaSource=104001.13&traceId=zcVNsKTUApF9rNJSkcCbB 前言 Redis作为高性能的内存数据库,在大数据量的情况下也会遇到性能瓶颈,日常开发中只有时刻

[转帖]ISV 、OSV、 SIG 概念

ISV 、OSV、 SIG 概念 2022-10-14 12:29530原创大杂烩 本文链接:https://www.cndba.cn/dave/article/108699 1. ISV: Independent Software Vendors “独立软件开发商”,特指专门从事软件的开发、生产、

[转帖]Redis 7 参数 修改 说明

2022-06-16 14:491800原创Redis 本文链接:https://www.cndba.cn/dave/article/108066 在之前的博客我们介绍了Redis 7 的安装和配置,如下: Linux 7.8 平台 Redis 7 安装并配置开机自启动 操作手册https://ww

[转帖]HTTPS中间人攻击原理

https://www.zhihu.com/people/bei-ji-85/posts 背景 前一段时间,公司北京地区上线了一个HTTPS防火墙,用来监听HTTPS流量。防火墙上线之前,邮件通知给管理层,我从我老大那里听说这个事情的时候,说这个有风险,然后意外地发现,很多人原来都不知道HTTPS防