PostgreSQL9.6からPostgreSQL11.1へアップグレードしました。
- このフォーラムに新規トピックを投稿できます
- このフォーラムではゲスト投稿が許可されています
投稿ツリー
- PostgreSQL9.6からPostgreSQL11.1へアップグレードしました。 (kondo, 2019/1/23 1:24)
- Re: PostgreSQL11.1からPostgreSQL12.3へアップグレードしました。 (kondo, 2020/6/14 18:35)
mastodonで使用しているPostgreSQLをアップグレードしました。
最初にpostgresql-11をインストール&セットアップする。
postgresqlを停止する。
systemctl stop postgresql-9.6.service
systemctl stop postgresql-11.service
# アップグレードの整合性チェックする。
$ sudo su - postgres bash-4.2 $ /usr/pgsql-11/bin/pg_upgrade -c -b /usr/pgsql-9.6/bin/ -B /usr/pgsql-11/bin/ -d /var/lib/pgsql/9.6/data -D /var/lib/pgsql/11/data
以下のエラーが起こる。
connection to database failed: fe_sendauth: no password supplied
could not connect to source postmaster started with the command:
"/usr/pgsql-9.6/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/var/lib/pgsql/9.6/data" -o "-p 50432 -b -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directories='/var/lib/pgsql'" start
Failure, exiting
アクセスができないため以下のファイルの認証md5をtrustに変更する。
/var/lib/pgsql/9.6/data/pg_hba.conf
/var/lib/pgsql/11/data/pg_hba.conf
$ sudo su - postgres
bash-4.2$ /usr/pgsql-11/bin/pg_upgrade -c -b /usr/pgsql-9.6/bin/ -B /usr/pgsql-11/bin/ -d /var/lib/pgsql/9.6/data -D /var/lib/pgsql/11/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 reg* data types in user tables ok
Checking for contrib/isn with bigint-passing mismatch ok
Checking for invalid "unknown" user columns ok
Checking for hash indexes ok
Checking for presence of required libraries ok
Checking database user is the install user ok
Checking for prepared transactions ok
Clusters are compatible
bash-4.2$ /usr/pgsql-11/bin/pg_upgrade -b /usr/pgsql-9.6/bin/ -B /usr/pgsql-11/bin/ -d /var/lib/pgsql/9.6/data -D /var/lib/pgsql/11/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 reg* data types in user tables ok
Checking for contrib/isn with bigint-passing mismatch ok
Checking for invalid "unknown" user columns 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
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_clog to new server 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 analyze new cluster ok
Creating script to delete old cluster ok
Checking for hash indexes ok
Upgrade Complete
Optimizer statistics are not transferred by pg_upgrade so,
once you start the new server, consider running:
./analyze_new_cluster.sh
Running this script will delete the old cluster's data files:
./delete_old_cluster.sh
PostgreSQL11.1からPostgreSQL12.3へアップグレードしました。
yum install postgresql12-{contrib,devel,server}
postgresql12-devel は llvm-toolset-7-clang パッケージを必要とするようなので、要求エラーが生じます。
以下のパッケージで解消しました。
yum install centos-release-scl centos-release-scl-rh