initdb -A trust -D /data/pg140 -E utf8 -k -U postgres -W --wal-segsize=10
24
user:postgres@db:postgres[[local]:5432]#select * from pg_stat_replication ;
+-[ RECORD 1 ]-----+-------------------------------+
| pid | 15236 |
| usesysid | 16384 |
| usename | replic |
| application_name | walreceiver |
| client_addr | 192.168.229.121 |
| client_hostname | NULL |
| client_port | 46028 |
| backend_start | 2021-08-11 10:30:16.978079+08 |
| backend_xmin | 499 |
| state | streaming |
| sent_lsn | 3/800000D8 |
| write_lsn | 3/800000D8 |
| flush_lsn | 3/800000D8 |
| replay_lsn | 3/800000D8 |
| write_lag | NULL |
| flush_lag | NULL |
| replay_lag | NULL |
| sync_priority | 0 |
| sync_state | async |
| reply_time | 2021-08-11 10:31:47.648992+08 |
+------------------+-------------------------------+
pg_ctl stop -D $PGDATA
[postgres@PG-1 pg133]$ /opt/pgsql/pg140/bin/pg_upgrade -b /opt/pgsql/pg133/bin/ -B /opt/pgsql/pg140/bin/ -d /data/pg133 -D /data/pg140 -j 8 -p 5432 -P 5433 -c
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
Checking for user-defined encoding conversions ok
Checking for user-defined postfix operators 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
*Clusters are compatible*
[postgres@PG-1 pg133]$ /opt/pgsql/pg140/bin/pg_upgrade -b /opt/pgsql/pg133/bin/ -B /opt/pgsql/pg140/bin/ -d /data/pg133 -D /data/pg140 -j 8 -p 5432 -P 5433
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
Checking for user-defined encoding conversions ok
Checking for user-defined postfix operators 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 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
Upgrade Complete
----------------
Optimizer statistics are not transferred by pg_upgrade.
Once you start the new server, consider running:
/opt/pgsql/pg140/bin/vacuumdb --all --analyze-in-stages
Running this script will delete the old clusters data files:
./delete_old_cluster.sh
/opt/pgsql/pg140/bin/pg_ctl start -D /data/pg140
/opt/pgsql/pg140/bin/vacuumdb --all --analyze-in-stages
rsync -avz postgres@192.168.229.129:/data/pg140 /data
6. 啟動standby數據庫。
user:postgres@db:postgres[[local]:5432]#select * from pg_stat_replication;
+-[ RECORD 1 ]-----+-------------------------------+
| pid | 15980 |
| usesysid | 16384 |
| usename | replic |
| application_name | walreceiver |
| client_addr | 192.168.229.121 |
| client_hostname | NULL |
| client_port | 46122 |
| backend_start | 2021-08-11 11:23:38.478461+08 |
| backend_xmin | NULL |
| state | streaming |
| sent_lsn | 5/2ABF20 |
| write_lsn | 5/2ABF20 |
| flush_lsn | 5/2ABF20 |
| replay_lsn | 5/2ABF20 |
| write_lag | 00:00:00.000595 |
| flush_lag | 00:00:00.000982 |
| replay_lag | 00:00:00.001227 |
| sync_priority | 0 |
| sync_state | async |
| reply_time | 2021-08-11 11:23:51.450434+08 |
+------------------+-------------------------------+
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/129294.html
摘要:經過對比選型,用戶同時選用三種數據庫來針對性的滿足不同目標。基于能夠帶來的這些特性優勢,用戶選擇了。相比自建,其可靠性更高,方便運維維護。整個過程中用戶不需要任何人工干預和配置修改,真正做到自動容災。 據DB-Engines 最新發布的2019年8月份數據庫流行度排行榜(如下圖)顯示,名列前茅的MySQL和PostgreSQL數據庫的流行趨勢與去年同期相比依然穩增不減。 showImg...
摘要:相比自建,其可靠性更高,方便運維維護。宋體經過審慎考慮,用戶同時選用三種數據庫,針對性的滿足不同目標。宋體宋體其中,相比于在上的快速高效是其優勢,也是用戶選型的重要砝碼。PostgreSQL UDB用在大數據分析上,查詢效率更高。相比自建,其可靠性更高,方便運維維護。 — 31會議運維經理 湯雷 如何用好PostgreSQL? PostgreSQL是業內一款十分流行的開源數...
閱讀 1346·2023-01-11 13:20
閱讀 1684·2023-01-11 13:20
閱讀 1132·2023-01-11 13:20
閱讀 1860·2023-01-11 13:20
閱讀 4100·2023-01-11 13:20
閱讀 2704·2023-01-11 13:20
閱讀 1385·2023-01-11 13:20
閱讀 3597·2023-01-11 13:20