In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to solve the problem of PostgreSQL high-availability cluster repmgr. The content of the article is of high quality, so the editor will share it with you for reference. I hope you will have some understanding of the relevant knowledge after reading this article.
PostgreSQL's high-availability solutions, basically not native, mostly rely on third-party companies to develop, there are several names of Patroni, PGPOOL-II, Repmgr, and so on. PGPOOL-II has encountered a lot of problems in installation and application. In theory, what a Japanese company does should be reliable, but there are too many problems to be used as a way of HA.
A HA approach should be simple, efficient, and X-resistant. (I didn't mention distribution, just HA.)
Repmgr as several major PG support company 2ndQuadrant, the product is also more reliable. PG11 is currently supported in the version of repmgr 4.4. The PG version in the text is based on the current PG 11 version.
In fact, there is nothing to say about the installation process is to compile the installation, but I encountered something during the installation, if there are peers who can quickly solve the problem.
1 after you compile and install POSTGRESQL, whether you set the system variable or not, you will encounter a lot of problems if you don't set the system variable.
2 do not set the system variable, the files such as PSQL PG_CONFIG in your BIN directory are the files you compiled.
If you encounter problems with version inequivalence when compiling repmgr, you will probably start here.
The following text is based on the
1 on the basis that you have been able to install POSTGRESQL independently without failure
2 you understand and can carry out the settings of stream replication and troubleshooting some problems
There will be two machines down there.
IP is 192.168.198.110 respectively.
192.168.198.111
On this basis, part of the configuration of PG must be configured on the main library.
Max_wal_senders = 10
Max_replication_slots = 10
Wal_level = replica
Hot_standby = on
Archive_mode = on
Archive_command = 'test!-f / pgdata/archive/%f & & cp% p / pgdata/archive/%f'
If you don't know what the above is, here is a general introduction. There are two types of PG replication: streaming replication and logical replication. We use streaming replication.
The first four of the above configurations are all configuration information related to streaming replication, and the last two are the settings of LOG's archive.
What needs to be set up later is the user who operates the database of repmgr and the database in which the related repmgr stores metadata.
Create repmgr users and create repmgr databases
Create user repmgr superuser login
Alter user repmgr with password 'repmgr'
Create database repmgr
Alter database repmgr owner to repmgr
ALTER USER repmgr SET search_path TO repmgr, "$user", public
After setting up these, you also need to set up pg_hba.conf.
Local repmgr repmgr trust
Host repmgr repmgr 127.0.0.1/32 trust
Host repmgr repmgr:: 1/128 trust
Host repmgr repmgr 192.168.198.0/24 trust
To compile the downloaded rpemgr, you need to set the relevant database variables in advance. If you are not clear, you can read the previous article on POSTGRESQL installation, about 2 months ago.
Repmgr-f / etc/repmgr.conf primary register
What must be included in the repmgr.conf
Node_id=1
Node_name='192.168.198.110' conninfo='host=192.168.198.110 user=repmgr dbname=repmgr connect_timeout=2'
Data_directory='/pgdata/data'
Repmgr-f / etc/repmgr.conf cluster show
After registering the master node, you can verify whether the registration is successful by using the above command
Install repmgr in the standy slave library and set repmgr.conf to the / etc/ directory
Relevant content
We need to verify that the clone we are about to carry out can be successful.
If there is a problem between them, an error will be reported in the printed information, and there are no following
1 the network connection problem of your master-slave library
The problem with the 2 account cannot be connected through the account you gave.
3 your PG starts from the library and has data in the data directory
The following is a direct command operation, the whole integrated operation of egg knife data can be completed, the copy of data, the registration of standy and so on.
Start the slave library
We verify that the relevant replication has worked between the master and slave libraries
Main library
Slave library
The registration information is stored in the replication set below
And the master can find the relevant registration information through the command.
After all this, we can practice how to switch manually, master-slave library.
Run the command again to verify that the switch was successful
You can see that the master-slave switch is successful.
We go to the host again to verify. You can see that the switch is successful by the host name.
Of course, you can switch back to the same operation as just now.
Through this round of simple operation, repmgr host master-slave switching is so simple, of course, his function is more than that, automatic switching in the event of failure, he is also very good at switching, I can think of him as a MHA in the POSTGRESQL world.
Let's summarize the advantages of repmgr.
1 easy to install
2 powerful function
3 there are clear documents
4 is backed by well-known companies in the PG industry.
5 support to the latest version of PG 11
How to solve the problem of PostgreSQL high availability cluster repmgr is shared here. I hope the above content can be helpful to you and learn more knowledge. If you think the article is good, you can share it for more people to see.
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.