In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Pg10 sets up master / slave switching for stream replication.
Configuration
Main library 10.10.10.13 pghost4
Reserve 10.10.10.14 pghost5
When there is a problem with the test master library, the standby library will be automatically switched to the new master library after it is stopped. The old master library should now be a standby library, start it to verify the status. It was found that the repository could not be started. The repository is started in the following ways.
The new slave database is started through pg_ctl start, and the alarm log appears.
[root@pghost4 ~] # su-pg10
Pg10@pghost4- > pg_ctl start
Waiting for server to start....2019-12-20 21 LOG 4410 CST [23416] LOG: listening on IPv4 address "0.0.0.0", port 1921
2019-12-20 21 listening on IPv6 address 4415 CST [23416] LOG: listening on IPv6 address ":", port 1921
2019-12-20 21 listening on Unix socket 4415 CST [23416] LOG: listening on Unix socket "/ tmp/.s.PGSQL.1921"
2019-12-20 21 database system was shut down in recovery at 4414 CST [23417] LOG: database system was shut down in recovery at 2019-12-20 21:33:31 CST
2019-12-20 21 4414 CST [23417] LOG: entering standby mode
2019-12-20 21 requested timeline 44 is not a child of this server's history 10.014 CST [23417] FATAL: requested timeline 2
2019-12-20 21 on timeline 44 on timeline 10.014 CST [23417] DETAIL: Latest checkpoint is at 000028 on timeline 1, but in the history of the requested timeline, the server forked off from that timeline at 0/C000098.
2019-12-20 21 PID 4415 CST [23416] LOG: startup process (PID 23417) exited with exit code 1
2019-12-20 21 4415 CST [23416] LOG: aborting startup due to startup process failure
2019-12-20 21 4415 CST [23416] LOG: database system is shut down
Stopped waiting
Pg_ctl: could not start server
Examine the log output.
As you can see from the above, the 00000002.history in the pg_wal directory of the new library is not consistent with the new main library.
Pg10@pghost4- > ll
Total 273M
-rw- 1 pg10 pg10 16m Dec 18 22:40 0000000100000000000001
-rw- 1 pg10 pg10 16m Dec 18 23:01 00000001000000000002
-rw- 1 pg10 pg10 16m Dec 18 23:02 00000001000000000003
-rw- 1 pg10 pg10 16m Dec 18 23:06 00000001000000000004
-rw- 1 pg10 pg10 16m Dec 18 23:39 00000001000000000005
-rw- 1 pg10 pg10 16m Dec 18 23:51 00000001000000000006
-rw- 1 pg10 pg10 16m Dec 18 23:55 00000001000000000007
-rw- 1 pg10 pg10 16m Dec 18 23:58 00000001000000000008
-rw- 1 pg10 pg10 16m Dec 19 00:15 0000000100000000000009
-rw- 1 pg10 pg10 16m Dec 19 00:15 0000000100000000000A
-rw- 1 pg10 pg10 16m Dec 19 00:27 0000000100000000000B
-rw- 1 pg10 pg10 16m Dec 19 00:29 0000000100000000000C
-rw- 1 pg10 pg10 16m Dec 19 00:34 0000000100000000000D
-rw- 1 pg10 pg10 16m Dec 19 00:36 0000000100000000000E
-rw- 1 pg10 pg10 16m Dec 19 00:36 0000000100000000000F
-rw- 1 pg10 pg10 302 Dec 19 00:36 00000001000000000000000F.00000028.backup
-rw- 1 pg10 pg10 16m Dec 19 00:38 0000000100000000000010
-rw- 1 pg10 pg10 16m Dec 20 21:33 0000000100000000000011
-rw- 1 pg10 pg10 41 Dec 19 00:30 00000002.history
Drwx- 2 pg10 pg10 4.0K Dec 20 21:31 archive_status
Pg10@pghost4- > more 00000002.history
1 0/C000098 no recovery target specified
Pg10@pghost4- >
Then look at the directory under the path of the new main library
Pg10@pghost4- > ll
Total 132K
-rw- 1 pg10 pg10 206 Dec 19 00:36 backup_label.old
Drwx- 5 pg10 pg10 4.0K Dec 19 00:36 base
Drwx- 2 pg10 pg10 4.0K Dec 20 21:27 global
Drwx- 2 pg10 pg10 4.0K Dec 19 00:36 pg_commit_ts
Drwx- 2 pg10 pg10 4.0K Dec 19 00:36 pg_dynshmem
-rw- 1 pg10 pg10 4.6K Dec 19 00:36 pg_hba.conf
-rw- 1 pg10 pg10 1.6K Dec 19 00:36 pg_ident.conf
Drwx- 4 pg10 pg10 4.0K Dec 19 00:38 pg_logical
Drwx- 4 pg10 pg10 4.0K Dec 19 00:36 pg_multixact
Drwx- 2 pg10 pg10 4.0K Dec 19 00:37 pg_notify
Drwx- 2 pg10 pg10 4.0K Dec 19 00:36 pg_replslot
Drwx- 2 pg10 pg10 4.0K Dec 19 00:36 pg_serial
Drwx- 2 pg10 pg10 4.0K Dec 19 00:36 pg_snapshots
Drwx- 2 pg10 pg10 4.0K Dec 19 00:36 pg_stat
Drwx- 2 pg10 pg10 4.0K Dec 20 21:48 pg_stat_tmp
Drwx- 2 pg10 pg10 4.0K Dec 19 00:38 pg_subtrans
Drwx- 2 pg10 pg10 4.0K Dec 19 00:36 pg_tblspc
Drwx- 2 pg10 pg10 4.0K Dec 19 00:36 pg_twophase
-rw- 1 pg10 pg10 3 Dec 19 00:36 PG_VERSION
Drwx- 3 pg10 pg10 4.0K Dec 19 00:38 pg_wal
Drwx- 2 pg10 pg10 4.0K Dec 19 00:36 pg_xact
-rw- 1 pg10 pg10 88 Dec 19 00:36 postgresql.auto.conf
-rw- 1 pg10 pg10 23K Dec 19 00:36 postgresql.conf
-rw- 1 pg10 pg10 31 Dec 19 00:37 postmaster.opts
-rw- 1 pg10 pg10 74 Dec 19 00:38 postmaster.pid
-rw-r--r-- 1 pg10 pg10 5.8K Dec 19 00:37 recovery.done
Pg10@pghost4- > cd pg_wal/pg10@pghost4- > llbr/ > pg10@pghost4- > ll
-rw- 1 pg10 pg10 16m Dec 19 00:36 0000000100000000000F
-rw- 1 pg10 pg10 16m Dec 19 00:38 0000000100000000000010
-rw- 1 pg10 pg10 16M Dec 19 00:38 000000010000000000000011.partial
-rw- 1 pg10 pg10 16m Dec 19 00:38 00000002000000000011
-rw- 1 pg10 pg10 42 Dec 19 00:38 00000002.history
Drwx- 2 pg10 pg10 4.0K Dec 19 00:38 archive_statuspg10@pghost4- > pwdbr/ > pg10@pghost4- > pwd
Pg10@pghost4- > more 00000002.history
10 / 11000098 no recovery target specified
Back up the 00000002.history of the new repository and delete it.
Transfer the new master library to the new standby library.
And then activate.
Pg10@pghost4- > scp 00000002.history 10.10.10.13:/data/pg10/data/pg_wal/
Pg10@10.10.10.13's password:
00000002.history 100% 42 0.0KB/s 00:00
Pg10@pghost4- >
Pg10@pghost4- > pg_ctl start
Waiting for server to start....2019-12-20 21 LOG 51V 25.142 CST [23486] LOG: listening on IPv4 address "0.0.0.0", port 1921
2019-12-20 21 listening on IPv6 address 51V 25.142 CST [23486] LOG: listening on IPv6 address ":", port 1921
2019-12-20 21 listening on Unix socket 51V 25.144 CST [23486] LOG: listening on Unix socket "/ tmp/.s.PGSQL.1921"
2019-12-20 21 database system was shut down in recovery at 51 1V 25.155 CST [23487] LOG: database system was shut down in recovery at 2019-12-20 21:33:31 CST
2019-12-20 21 entering standby mode 51 51 15 15 CST [23487] LOG: entering standby mode
2019-12-20 21 consistent recovery state reached at 51 1V 25.171 CST [23487] LOG: consistent recovery state reached at 0amp 11000098
2019-12-20 21 invalid record length at 51V 25.171 CST [23487] LOG: invalid record length at 0amp 11000098: wanted 24, got 0
2019-12-20 21 database system is ready to accept read only connections 51V 25.171 CST [23486] database system is ready to accept read only connections
2019-12-20 21 started streaming WAL from primary at 51 1V 25 179 CST [23491] LOG: started streaming WAL from primary at 0 Universe 11000000 on timeline 2
2019-12-20 21 redo starts at 51V 25.225 CST [23487] LOG: redo starts at 0 Unix 11000098
Done
Server started
Pg10@pghost4- >
Found that it has been activated.
Pg10@pghost4- > pg_controldata | grep cluster
Database cluster state: in archive recovery
Pg10@pghost4- >
You can see that the new repository is in standby mode.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.