Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Pglogical2.0 logical backup

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Note:

1, 9.5 and above are supported.

2. Refer to https://www.2ndquadrant.com/en/resources/pglogical/pglogical-installation-instructions/ for compilation and installation.

3. How to use reference https://www.2ndquadrant.com/en/resources/pglogical/pglogical-docs/,

Chinese reference https://my.oschina.net/innovation/blog/748227

4. This tutorial supports pg's own stream replication active and standby mode. Pglogical is the advanced stream replication mode of hotstanby.

5. The subscriber version should be the same as the provider version, and pglogical should be installed.

First, install pglogical

Since our pg is installed with source code, then pglogical is also installed with source code.

Go to the official website https://www.2ndquadrant.com to download the source code package, it is more difficult to find, take your time to find

Installation requires pg_config, because after our pg installation, the environment variable is configured in the root directory of the postgres user. Bash_profile. Under the root user, you need source / home/postgres/.bash_profile to load the environment variable.

Execute after decompression

Make USE_PGXS=1

Make USE_PGXS=1 install

2. Configure pglogical

1. PG configuration

If it is the active / standby mode, both have to be modified. Remember to restart the service.

Wal_level = 'logical'max_worker_processes = 10 # one per database needed on provider node # one per node needed on subscriber nodemax_replication_slots = 10 # one per node needed on provider nodemax_wal_senders = 10 # one per node needed on provider nodeshared_preload_libraries =' pglogical'track_commit_timestamp = on # needed for last/first update wins conflict resolution # property available in PostgreSQL 9.5 +

2. Configure logical replication

The provider executes the following command, of course, first to confirm the database and the user, command\ c dbname user

CREATE EXTENSION pglogical;SELECT pglogical.create_node ('provider1','host=192.168.180.222 port=5433 dbname=elink'); SELECT pglogical.replication_set_add_table (' default','company','true',NULL,NULL); # default is all operations that replicate the table, and company is the table name

Subscribers execute the following command

Select pglogical.create_node ('sub_node_1','host=192.168.180.222 port=5433 dbname=elink'); select pglogical.create_subscription (' sub1','host=192.168.180.222 port=5433 dbname=elink user=elink password=elink')

III. Evaluation results

Just changed from bdr, there are a lot of BUG and error reports, and there are fewer people who use them.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report