OpenBSD上的PostgreSQL:14â15‮
#postgres #database #迁移 #openbsd

-

OpenBSDââ€â†- â€â¾sth(ä¾ -man ページ (英語)â€Å§ - € ¼美PostgreSQLâ«â€§

postgresqlâpkg-Readme(/usr/local/share/doc/pkg-readmes/postgresql-server) â¢â€â€ã¼ -

  1. koude1
  2. koude2

Å和â€âa1.½½é§§§ A

前者についての記事を過去に書きました。そこで PostgreSQLを 12 から 13 にアップグレードしました。今回は後者の番です。

ç°至¢

  • OS: OpenBSD 7.3 (<- 7.2)
  • DB: PostgreSQL 15 (<- 14)

-

- Ž¢Å¼§è?

我们的

§ §§â¾ -

$ pg_dumpall > pg.sqldump 

§ -

pg_upgradeâ®法院

端口:

$ doas pkg_add postgresql-pg_upgrade

ǵæ※¥äst

quirks-6.42 signed on 2023-04-06T19:16:59Z
postgresql-pg_upgrade-14.5:postgresql-previous-13.5p0: ok
postgresql-pg_upgrade-14.5: ok

obsd 7.2-> 7.3ªstry ¼

postgresqlâ§âçâçâ€openbsd‮ °§

sysupgrade / sysmerge / coude8 è©©©‘SS´°是こちらの記事''«Æ¸

§ 以äst

postgresql-server-15.2p0: Updating across a major version - data migration needed, see the pkg-readme.
Do you want to update now ? [y/N/a] y

“ y”‥Åââ€â€postgresqlâ® â€â€ª½美â¾€»¥äst :

postgresql-client+postgresql-contrib+postgresql-pg_upgrade+postgresql-server-14.5->postgresql-client-15.2+postgresql-contrib-15.2+postgresql-pg_upgrade-15.2+postgresql-server-15.2p0: ok
(...)
New and changed readme(s):
    /usr/local/share/doc/pkg-readmes/postgresql-server

ââ¼¢

§

$ doas rcctl stop postgresql

ǵæ※¥äst

postgresql(ok)
Postgresql 15â€â©â€ã

â¾data - £ -
ç¾ètum

$ doas mv /var/postgresql/data /var/postgresql/data-14

ã postgresqlâ®koude11â®

$ # doas su _postgresql -c "mkdir /var/postgresql/data && cd /var/postgresql && \
        initdb -D /var/postgresql/data -U postgres -A scram-sha-256 -E UTF8 -W"
$ doas su _postgresql -c "mkdir /var/postgresql/data && cd /var/postgresql && \
      initdb -D /var/postgresql/data -U postgres -A scram-sha-256 -E UTF8 --locale=ja_JP.UTF-8 -W"

äst迷, --locale=(...) - ª

ǵæ※¥äst

The files belonging to this database system will be owned by user "_postgresql".
This user must also own the server process.

The database cluster will be initialized with locale "ja_JP.UTF-8".
initdb: could not find suitable text search configuration for locale "ja_JP.UTF-8"
The default text search configuration will be set to "simple".

Data page checksums are disabled.

Enter new superuser password: 
Enter it again: 

postgresqlâtum â€â€»¥äst

fixing permissions on existing directory /var/postgresql/data ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 20
selecting default shared_buffers ... 128MB
selecting default time zone ... Asia/Tokyo
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... ok
syncing data to disk ... ok

Success. You can now start the database server using:

    pg_ctl -D /var/postgresql/data -l logfile start

â€â€ -

-

ç¾èt :

$ doas nvim /var/postgresql/data-14/pg_hba.conf

‼¼¶¼ -

  # TYPE  DATABASE        USER            ADDRESS                 METHOD
+ local all postgres trust

s。今天租赁Elers OakEraâ / p>

â€âpg_hba.conf— â€15 - ª â€â¼tour

$ doas cp -p /var/postgresql/data-14/pg_hba.conf /var/postgresql/data/

$ # in addition, in case that tls is used:
$ doas cp -p /var/postgresql/data-14/server.{crt,key} /var/postgresql/data/

pg_upgradeâ®

ok - â§dout €€thout ing -â®

$ doas su _postgresql -c "cd /var/postgresql && \
      pg_upgrade -b /usr/local/bin/postgresql-14/ -B /usr/local/bin \
      -U postgres -d /var/postgresql/data-14/ -D /var/postgresql/data"

ç§â®® â:

Performing Consistency Checks
-----------------------------
Checking cluster versions                                   ok
Checking database user is the install user                  ok
Checking database connection settings                       ok
Checking for prepared transactions                          ok
Checking for system-defined composite types in user tables  ok
Checking for reg* data types in user tables                 ok
Checking for contrib/isn with bigint-passing mismatch       ok
Creating dump of global objects                             ok
Creating dump of database schemas
                                                            ok
Checking for presence of required libraries                 ok
Checking database user is the install user                  ok
Checking for prepared transactions                          ok
Checking for new cluster tablespace directories             ok

If pg_upgrade fails after this point, you must re-initdb the
new cluster before continuing.

Performing Upgrade
------------------
Analyzing all rows in the new cluster                       ok
Freezing all rows in the new cluster                        ok
Deleting files from new pg_xact                             ok
Copying old pg_xact to new server                           ok
Setting oldest XID for new cluster                          ok
Setting next transaction ID and epoch for new cluster       ok
Deleting files from new pg_multixact/offsets                ok
Copying old pg_multixact/offsets to new server              ok
Deleting files from new pg_multixact/members                ok
Copying old pg_multixact/members to new server              ok
Setting next multixact ID and offset for new cluster        ok
Resetting WAL archives                                      ok
Setting frozenxid and minmxid counters in new cluster       ok
Restoring global objects in the new cluster                 ok
Restoring database schemas in the new cluster
                                                            ok
Copying user relation files
                                                            ok
Setting next OID for new cluster                            ok
Sync data directory to disk                                 ok
Creating script to delete old cluster                       ok
Checking for extension updates                              ok

Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade.
Once you start the new server, consider running:
    /usr/local/bin/vacuumdb -U postgres --all --analyze-in-stages

Running this script will delete the old cluster's data files:
    ./delete_old_cluster.sh

æŧã:)

è并®

äst

$ doas nvim /var/postgresql/data/pg_hba.conf

$ # in addition, if you care about restoring the previous one:
$ doas nvim /var/postgresql/data/pg_hba.conf

以äst

  # TYPE  DATABASE        USER            ADDRESS                 METHOD
- local all postgres trust

postgresql 15到èsy(到€€âªÅ)

cold17â®

$ # create the backup (optional):
$ doas cp -p /var/postgresql/data/postgresql.conf /var/postgresql/data/postgresql.conf.org

$ doas nvim /var/postgresql/data/postgresql.conf

以äst

  (...)
+ listen_addresses = '*'
  (...)
+ ssl = on
  (...)

surruple 1ââ€â®

- �çµ

- ¼

§ :

$ doas rcctl start postgresql

‾ââ€â£â£â€â€¾美:)

- Ⱨ

è。 - -

$ doas pkg_delete postgresql-pg_upgrade

ǵæ※¥äst

postgresql-pg_upgrade-15.2: ok

-

äst - post -

ä½è«â§d2220 ±±

olotbsd - plesql- plesql - 今天n venaleouthounâ阿达««d