{"id":10218,"date":"2021-01-18T18:34:58","date_gmt":"2021-01-18T17:34:58","guid":{"rendered":"http:\/\/arumel.com\/?p=10218"},"modified":"2021-01-18T18:34:58","modified_gmt":"2021-01-18T17:34:58","slug":"replicacion-bdr-y-postgresql","status":"publish","type":"post","link":"https:\/\/arumel.com\/es\/replicacion-bdr-y-postgresql\/","title":{"rendered":"Replicaci\u00f3n BDR y Postgresql"},"content":{"rendered":"<p>Un cliente con una configuraci\u00f3n bdr defectuosa (cluster dos nodos cuando son necesarios 3) y tras una parada por el uso de secuencias bdr que necesitan un quorum de (n\u00ba nodos \/ 2 + 1) para poder funcionar (y solo funcionaba uno), se le deja con ese \u00fanico nodo para posteriormente ampliar la configuraci\u00f3n bdr a otras 3 m\u00e1quinas (en otro site) para posteriormente borrar el nodo origen y que el cluster con bdr funcione \u00fanicamente en el nuevo site (3 m\u00e1quinas nuevas).<\/p>\n<p>En las 3 m\u00e1quinas nuevas (destino) inicializamos el cluster postgres sobre ellas:<\/p>\n<p style=\"padding-left: 40px\"><code>-bash-4.2$ <strong>\/usr\/pgsql-9.4\/bin\/pg_ctl -D \/postgresql\/autobus\/data initdb<\/strong><\/code><br \/>\n<code>The files belonging to this database system will be owned by user \"postgres\".<\/code><br \/>\n<code>This user must also own the server process.<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>The database cluster will be initialized with locale \"en_US.UTF-8\".<\/code><br \/>\n<code>The default database encoding has accordingly been set to \"UTF8\".<\/code><br \/>\n<code>The default text search configuration will be set to \"english\".<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>Data page checksums are disabled.<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>fixing permissions on existing directory \/postgresql\/autobus\/data ... ok<\/code><br \/>\n<code>creating subdirectories ... ok<\/code><br \/>\n<code>selecting default max_connections ... 100<\/code><br \/>\n<code>selecting default shared_buffers ... 128MB<\/code><br \/>\n<code>selecting dynamic shared memory implementation ... posix<\/code><br \/>\n<code>creating configuration files ... ok<\/code><br \/>\n<code>creating template1 database in \/postgresql\/autobus\/data\/base\/1 ... ok<\/code><br \/>\n<code>initializing pg_authid ... ok<\/code><br \/>\n<code>initializing dependencies ... ok<\/code><br \/>\n<code>creating system views ... ok<\/code><br \/>\n<code>loading system objects' descriptions ... ok<\/code><br \/>\n<code>creating collations ... ok<\/code><br \/>\n<code>creating conversions ... ok<\/code><br \/>\n<code>creating dictionaries ... ok<\/code><br \/>\n<code>setting privileges on built-in objects ... ok<\/code><br \/>\n<code>creating information schema ... ok<\/code><br \/>\n<code>loading PL\/pgSQL server-side language ... ok<\/code><br \/>\n<code>vacuuming database template1 ... ok<\/code><br \/>\n<code>copying template1 to template0 ... ok<\/code><br \/>\n<code>copying template1 to postgres ... ok<\/code><br \/>\n<code>syncing data to disk ... ok<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>WARNING: enabling \"trust\" authentication for local connections<\/code><br \/>\n<code>You can change this by editing pg_hba.conf or using the option -A, or<\/code><br \/>\n<code>--auth-local and --auth-host, the next time you run initdb.<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>Success. You can now start the database server using:<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>\/usr\/pgsql-9.4\/bin\/postgres -D \/postgresql\/autobus\/data<\/code><br \/>\n<code>or<\/code><br \/>\n<code>\/usr\/pgsql-9.4\/bin\/pg_ctl -D \/postgresql\/autobus\/data -l logfile start<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>Se comprueba la configuraci\u00f3n inicial del cluster bdr en el nodo origen:<\/p>\n<p style=\"padding-left: 40px\"><code>[local]:5432; postgres@autobus # <strong>select * from bdr.bdr_nodes;<\/strong><\/code><br \/>\n<code>+---------------------+---------------+------------+-------------+-----------+---------------------------------------------<\/code><br \/>\n<code>+--------------------+----------------+<\/code><br \/>\n<code>| node_sysid | node_timeline | node_dboid | node_status | node_name | node_local_dsn<\/code><br \/>\n<code>| node_init_from_dsn | node_read_only |<\/code><br \/>\n<code>+---------------------+---------------+------------+-------------+-----------+---------------------------------------------<\/code><br \/>\n<code>+--------------------+----------------+<\/code><br \/>\n<code>| 6484326987971901429 | 1 | 16385 | r | <strong>node1<\/strong> | port=5432 dbname=autobus host=192.168.100.10<\/code><br \/>\n<code>| NULL | f |<\/code><br \/>\n<code>+---------------------+---------------+------------+-------------+-----------+---------------------------------------------<\/code><br \/>\n<code>+--------------------+----------------+<\/code><br \/>\n<code>(1 row)<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>Time: 1.779 ms<\/code><br \/>\n<code>[local]:5432; postgres@autobus # select * from pg_replication_slots;<\/code><br \/>\n<code>+-----------+--------+-----------+--------+----------+--------+------+--------------+-------------+<\/code><br \/>\n<code>| slot_name | plugin | slot_type | datoid | database | active | xmin | catalog_xmin | restart_lsn |<\/code><br \/>\n<code>+-----------+--------+-----------+--------+----------+--------+------+--------------+-------------+<\/code><br \/>\n<code>+-----------+--------+-----------+--------+----------+--------+------+--------------+-------------+<\/code><br \/>\n<code>(0 rows)<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>Time: 0.802 ms<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>Sobre las 3 m\u00e1quinas destino creamos la base de datos y cargamos la extensi\u00f3n bdr:<\/p>\n<p style=\"padding-left: 40px\"><code>postgres=# <strong>create database autobus;<\/strong><\/code><br \/>\n<code>CREATE DATABASE<\/code><br \/>\n<code>postgres=# <strong>\\c autobus<\/strong><\/code><br \/>\n<code>You are now connected to database \"autobus\" as user \"postgres\".<\/code><br \/>\n<code>autobus=# <strong>create extension btree_gist;<\/strong><\/code><br \/>\n<code>CREATE EXTENSION<\/code><br \/>\n<code>autobus=# <strong>create extension bdr;<\/strong><\/code><br \/>\n<code>CREATE EXTENSION<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>A\u00f1adimos el nuevo nodo a la configuraci\u00f3n bdr desde todas las m\u00e1quinas destino:<\/p>\n<p style=\"padding-left: 40px\"><code><strong>(nodo1-nuevo)<\/strong><\/code><\/p>\n<p style=\"padding-left: 40px\"><code>autobus=# <strong>select bdr.bdr_group_join(<\/strong><\/code><br \/>\n<strong><code>local_node_name := '192.168.102.20',<\/code><\/strong><br \/>\n<strong><code>node_external_dsn := 'host=192.168.102.20 port=5434 dbname=autobus',<\/code><\/strong><br \/>\n<strong><code>join_using_dsn :='host=192.168.100.10 port=5432 dbname=autobus');<\/code><\/strong><br \/>\n<code>bdr_group_join<\/code><br \/>\n<code>----------------<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>(1 row)<\/code><\/p>\n<p style=\"padding-left: 40px\"><code><strong>autobus=# select bdr.bdr_node_join_wait_for_ready();<\/strong><\/code><br \/>\n<code>bdr_node_join_wait_for_ready<\/code><br \/>\n<code>------------------------------<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>(1 row)<\/code><\/p>\n<p style=\"padding-left: 40px\"><code><\/code><\/p>\n<p style=\"padding-left: 40px\"><code><strong>(nodo2-nuevo)<\/strong><\/code><\/p>\n<p style=\"padding-left: 40px\"><code>autobus=# <strong>select bdr.bdr_group_join(<\/strong><\/code><br \/>\n<strong><code>local_node_name := '192.168.102.21',<\/code><\/strong><br \/>\n<strong><code>node_external_dsn := 'host=192.168.102.21 port=5434 dbname=autobus',<\/code><\/strong><br \/>\n<strong><code>join_using_dsn :='host=192.168.102.20 port=5434 dbname=autobus');<\/code><\/strong><br \/>\n<code> bdr_group_join<\/code><br \/>\n<code>----------------<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>(1 row)<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>autobus=# <strong>select bdr.bdr_node_join_wait_for_ready();<\/strong><\/code><br \/>\n<code> bdr_node_join_wait_for_ready<\/code><br \/>\n<code>------------------------------<\/code><code><\/code><\/p>\n<p style=\"padding-left: 40px\"><code>(1 row)<\/code><\/p>\n<p>&nbsp;<\/p>\n<p style=\"padding-left: 40px\"><code><strong>(nodo3-nuevo)<\/strong><\/code><\/p>\n<p style=\"padding-left: 40px\"><code>autobus=# <strong>select bdr.bdr_group_join(<\/strong><\/code><br \/>\n<strong><code>local_node_name := '192.168.102.22',<\/code><\/strong><br \/>\n<strong><code>node_external_dsn := 'host=192.168.102.22 port=5434 dbname=autobus',<\/code><\/strong><br \/>\n<strong><code>join_using_dsn :='host=192.168.102.20 port=5434 dbname=autobus');<\/code><\/strong><br \/>\n<code>bdr_group_join<\/code><br \/>\n<code>----------------<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>(1 row)<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>autobus=# <strong>select bdr.bdr_node_join_wait_for_ready();<\/strong><\/code><br \/>\n<code>bdr_node_join_wait_for_ready<\/code><br \/>\n<code>------------------------------<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>(1 row)<\/code><\/p>\n<p style=\"padding-left: 80px\"><code><\/code><\/p>\n<p>&nbsp;<\/p>\n<p style=\"padding-left: 40px\">Comprobamos desde el nodo origen la configuraci\u00f3n final:<\/p>\n<p style=\"padding-left: 40px\"><code>[local]:5432; postgres@autobus # select * from bdr.bdr_nodes;<\/code><br \/>\n<code>+---------------------+---------------+------------+-------------+---------------+---------------------------------------------+---------------------------------------------+----------------+<\/code><br \/>\n<code>| node_sysid | node_timeline | node_dboid | node_status | node_name | node_local_dsn | node_init<\/code><br \/>\n<code>_from_dsn | node_read_only |<\/code><br \/>\n<code>+---------------------+---------------+------------+-------------+---------------+---------------------------------------------+---------------------------------------------+----------------+<\/code><br \/>\n<code>| 6484326987971901429 | 1 | 16385 | r | node1 | port=5432 dbname=autobus host=192.168.100.10 | NULL<\/code><br \/>\n<code>| f |<\/code><br \/>\n<code>| 6906900435321228361 | 1 | 16385 | r | 192.168.102.20 | host=192.168.102.20 port=5434 dbname=autobus | host=192.168.100.10 port=5432 dbname=autobus | f |<\/code><br \/>\n<code>| 6906903421302212953 | 1 | 16385 | r | 192.168.102.21 | host=192.168.102.21 port=5434 dbname=autobus | host=192.168.102.20 port=5434 dbname=autobus | f |<\/code><br \/>\n<code>| 6906906327689680484 | 1 | 16385 | r | 192.168.102.22 | host=192.168.102.22 port=5434 dbname=autobus | host=192.168.102.20 port=5434 dbname=autobus | f |<\/code><br \/>\n<code>+---------------------+---------------+------------+-------------+---------------+---------------------------------------------+---------------------------------------------+----------------+<\/code><br \/>\n<code>(4 rows)<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>Time: 0.718 ms<\/code><br \/>\n<code>[local]:5432; postgres@autobus # select * from pg_replication_slots;<\/code><br \/>\n<code>+-----------------------------------------+--------+-----------+--------+----------+--------+------+--------------+-------------+<\/code><br \/>\n<code>| slot_name | plugin | slot_type | datoid | database | active | xmin | catalog_xmin | restart_lsn |<\/code><br \/>\n<code>+-----------------------------------------+--------+-----------+--------+----------+--------+------+--------------+-------------+<\/code><br \/>\n<code>| bdr_16385_6906906327689680484_1_16385__ | bdr | logical | 16385 | autobus | t | NULL | 79287948 | 9B\/4611F910 |<\/code><br \/>\n<code>| bdr_16385_6906900435321228361_1_16385__ | bdr | logical | 16385 | autobus | t | NULL | 79287948 | 9B\/4611F910 |<\/code><br \/>\n<code>| bdr_16385_6906903421302212953_1_16385__ | bdr | logical | 16385 | autobus | t | NULL | 79287948 | 9B\/4611F910 |<\/code><br \/>\n<code>+-----------------------------------------+--------+-----------+--------+----------+--------+------+--------------+-------------+<\/code><br \/>\n<code>(3 rows)<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>Time: 0.855 ms<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>La eliminaci\u00f3n del nodo origen desde el nodo1-nuevo (puede ser cualquier nodo que no sea el que se va a borrar):<\/p>\n<p style=\"padding-left: 40px\"><code>[local]:5434; postgres@autobus # <strong>select * from bdr.bdr_nodes;<\/strong><\/code><br \/>\n<code>+---------------------+---------------+------------+-------------+---------------+---------------------------------------------+---------------------------------------------+----------------+<\/code><br \/>\n<code>| node_sysid | node_timeline | node_dboid | node_status | node_name | node_local_dsn | node_init_from_dsn | node_read_only |<\/code><br \/>\n<code>+---------------------+---------------+------------+-------------+---------------+---------------------------------------------+---------------------------------------------+----------------+<\/code><br \/>\n<code><strong>| 6484326987971901429 | 1 | 16385 | r | node1 | port=5432 dbname=autobus host=192.168.100.10 | NULL | f |<\/strong><\/code><br \/>\n<code>| 6906900435321228361 | 1 | 16385 | r | 192.168.102.20 | host=192.168.102.20 port=5434 dbname=autobus | host=192.168.100.10 port=5432 dbname=autobus | f |<\/code><br \/>\n<code>| 6906903421302212953 | 1 | 16385 | r | 192.168.102.21 | host=192.168.102.21 port=5434 dbname=autobus | host=192.168.102.20 port=5434 dbname=autobus | f |<\/code><br \/>\n<code>| 6906906327689680484 | 1 | 16385 | r | 192.168.102.22 | host=192.168.102.22 port=5434 dbname=autobus | host=192.168.102.20 port=5434 dbname=autobus | f |<\/code><br \/>\n<code>+---------------------+---------------+------------+-------------+---------------+---------------------------------------------+---------------------------------------------+----------------+<\/code><br \/>\n<code>(4 rows)<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>Time: 0.312 ms<\/code><br \/>\n<code>[local]:5434; postgres@autobus # select * from pg_replication_slots;<\/code><br \/>\n<code>+-----------------------------------------+--------+-----------+--------+----------+--------+------+--------------+-------------+<\/code><br \/>\n<code>| slot_name | plugin | slot_type | datoid | database | active | xmin | catalog_xmin | restart_lsn |<\/code><br \/>\n<code>+-----------------------------------------+--------+-----------+--------+----------+--------+------+--------------+-------------+<\/code><br \/>\n<code><strong>| bdr_16385_6484326987971901429_1_16385__ | bdr | logical | 16385 | autobus | t | NULL | 723260 | 0\/BC0C0118 |<\/strong><\/code><br \/>\n<code>| bdr_16385_6906906327689680484_1_16385__ | bdr | logical | 16385 | autobus | t | NULL | 723260 | 0\/BC0C0118 |<\/code><br \/>\n<code>| bdr_16385_6906903421302212953_1_16385__ | bdr | logical | 16385 | autobus | t | NULL | 723260 | 0\/BC0C0118 |<\/code><br \/>\n<code>+-----------------------------------------+--------+-----------+--------+----------+--------+------+--------------+-------------+<\/code><br \/>\n<code>(3 rows)<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>Time: 2.467 ms<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>[local]:5434; postgres@autobus # select bdr.bdr_get_local_nodeid();<\/code><br \/>\n<code>+-------------------------------+<\/code><br \/>\n<code>| bdr_get_local_nodeid |<\/code><br \/>\n<code>+-------------------------------+<\/code><br \/>\n<code>| (6906900435321228361,1,16385) |<\/code><br \/>\n<code>+-------------------------------+<\/code><br \/>\n<code>(1 row)<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>Time: 0.217 ms<\/code><br \/>\n<code>[local]:5434; postgres@autobus # select bdr.bdr_get_local_node_name();<\/code><br \/>\n<code>+-------------------------+<\/code><br \/>\n<code>| bdr_get_local_node_name |<\/code><br \/>\n<code>+-------------------------+<\/code><br \/>\n<code>| 192.168.102.20 |<\/code><br \/>\n<code>+-------------------------+<\/code><br \/>\n<code>(1 row)<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>Time: 0.596 ms<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>[local]:5434; postgres@autobus # <strong>select bdr.bdr_part_by_node_names('{node1}');<\/strong><\/code><br \/>\n<code>+------------------------+<\/code><br \/>\n<code>| bdr_part_by_node_names |<\/code><br \/>\n<code>+------------------------+<\/code><br \/>\n<code>| |<\/code><br \/>\n<code>+------------------------+<\/code><br \/>\n<code>(1 row)<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>Time: 2.647 ms<\/code><br \/>\n<code>[local]:5434; postgres@autobus # select * from bdr.bdr_nodes;<\/code><br \/>\n<code>+---------------------+---------------+------------+-------------+---------------+---------------------------------------------+---------------------------------------------+----------------+<\/code><br \/>\n<code>| node_sysid | node_timeline | node_dboid | node_status | node_name | node_local_dsn | node_init_from_dsn | node_read_only |<\/code><br \/>\n<code>+---------------------+---------------+------------+-------------+---------------+---------------------------------------------+---------------------------------------------+----------------+<\/code><br \/>\n<code>| 6906900435321228361 | 1 | 16385 | r | 192.168.102.20 | host=192.168.102.20 port=5434 dbname=autobus | host=192.168.100.10 port=5432 dbname=autobus | f |<\/code><br \/>\n<code>| 6906903421302212953 | 1 | 16385 | r | 192.168.102.21 | host=192.168.102.21 port=5434 dbname=autobus | host=192.168.102.20 port=5434 dbname=autobus | f |<\/code><br \/>\n<code>| 6906906327689680484 | 1 | 16385 | r | 192.168.102.22 | host=192.168.102.22 port=5434 dbname=autobus | host=192.168.102.20 port=5434 dbname=autobus | f |<\/code><br \/>\n<code><strong>| 6484326987971901429 | 1 | 16385 | <span style=\"color: #ff0000\">k<\/span> | node1 | port=5432 dbname=autobus host=192.168.100.10 | NULL | f |<\/strong><\/code><br \/>\n<code>+---------------------+---------------+------------+-------------+---------------+---------------------------------------------+---------------------------------------------+----------------+<\/code><br \/>\n<code>(4 rows)<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>Time: 0.396 ms<\/code><br \/>\n<code>[local]:5434; postgres@autobus # <strong>delete from bdr.bdr_nodes where node_status='<span style=\"color: #ff0000\">k<\/span>';<\/strong><\/code><br \/>\n<code>DELETE 1<\/code><br \/>\n<code>Time: 1.061 ms<\/code><br \/>\n<code>[local]:5434; postgres@autobus # select * from bdr.bdr_nodes;<\/code><br \/>\n<code>+---------------------+---------------+------------+-------------+---------------+---------------------------------------------+---------------------------------------------+----------------+<\/code><br \/>\n<code>| node_sysid | node_timeline | node_dboid | node_status | node_name | node_local_dsn | node_init_from_dsn | node_read_only |<\/code><br \/>\n<code>+---------------------+---------------+------------+-------------+---------------+---------------------------------------------+---------------------------------------------+----------------+<\/code><br \/>\n<code>| 6906900435321228361 | 1 | 16385 | r | 192.168.102.20 | host=192.168.102.20 port=5434 dbname=autobus | host=192.168.100.10 port=5432 dbname=autobus | f |<\/code><br \/>\n<code>| 6906903421302212953 | 1 | 16385 | r | 192.168.102.21 | host=192.168.102.21 port=5434 dbname=autobus | host=192.168.102.20 port=5434 dbname=autobus | f |<\/code><br \/>\n<code>| 6906906327689680484 | 1 | 16385 | r | 192.168.102.22 | host=192.168.102.22 port=5434 dbname=autobus | host=192.168.102.20 port=5434 dbname=autobus | f |<\/code><br \/>\n<code>+---------------------+---------------+------------+-------------+---------------+---------------------------------------------+---------------------------------------------+----------------+<\/code><br \/>\n<code>(3 rows)<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>Time: 0.371 ms<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>[local]:5434; postgres@autobus # select * from pg_replication_slots;<\/code><br \/>\n<code>+-----------------------------------------+--------+-----------+--------+----------+--------+------+--------------+-------------+<\/code><br \/>\n<code>| slot_name | plugin | slot_type | datoid | database | active | xmin | catalog_xmin | restart_lsn |<\/code><br \/>\n<code>+-----------------------------------------+--------+-----------+--------+----------+--------+------+--------------+-------------+<\/code><br \/>\n<code>| bdr_16385_6906906327689680484_1_16385__ | bdr | logical | 16385 | autobus | t | NULL | 723844 | 0\/BC3D3168 |<\/code><br \/>\n<code>| bdr_16385_6906903421302212953_1_16385__ | bdr | logical | 16385 | autobus | t | NULL | 723844 | 0\/BC3D3168 |<\/code><br \/>\n<code>+-----------------------------------------+--------+-----------+--------+----------+--------+------+--------------+-------------+<\/code><br \/>\n<code>(2 rows)<\/code><\/p>\n<p style=\"padding-left: 40px\"><code>Time: 0.677 ms<\/code><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Un cliente con una configuraci\u00f3n bdr defectuosa (cluster dos nodos cuando son necesarios 3) y tras una parada por el uso de secuencias bdr que necesitan un quorum de (n\u00ba nodos \/ 2 + 1) para poder funcionar (y solo funcionaba uno), se le deja con ese \u00fanico nodo para posteriormente ampliar la configuraci\u00f3n bdr [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[65],"tags":[440,439,434,441],"class_list":["post-10218","post","type-post","status-publish","format-standard","hentry","category-postgresql-es","tag-bdr","tag-postgres","tag-postgresql","tag-replication"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Replicaci\u00f3n BDR y Postgresql - Arumel<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/arumel.com\/es\/replicacion-bdr-y-postgresql\/\" \/>\n<meta property=\"og:locale\" content=\"es_ES\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Replicaci\u00f3n BDR y Postgresql - Arumel\" \/>\n<meta property=\"og:description\" content=\"Un cliente con una configuraci\u00f3n bdr defectuosa (cluster dos nodos cuando son necesarios 3) y tras una parada por el uso de secuencias bdr que necesitan un quorum de (n\u00ba nodos \/ 2 + 1) para poder funcionar (y solo funcionaba uno), se le deja con ese \u00fanico nodo para posteriormente ampliar la configuraci\u00f3n bdr [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/arumel.com\/es\/replicacion-bdr-y-postgresql\/\" \/>\n<meta property=\"og:site_name\" content=\"Arumel\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-18T17:34:58+00:00\" \/>\n<meta name=\"author\" content=\"sm\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"sm\" \/>\n\t<meta name=\"twitter:label2\" content=\"Tiempo de lectura\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/arumel.com\\\/es\\\/replicacion-bdr-y-postgresql\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/arumel.com\\\/es\\\/replicacion-bdr-y-postgresql\\\/\"},\"author\":{\"name\":\"sm\",\"@id\":\"http:\\\/\\\/arumel.com\\\/#\\\/schema\\\/person\\\/e270e777d900dcd47f8eb3895c076b64\"},\"headline\":\"Replicaci\u00f3n BDR y Postgresql\",\"datePublished\":\"2021-01-18T17:34:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/arumel.com\\\/es\\\/replicacion-bdr-y-postgresql\\\/\"},\"wordCount\":182,\"commentCount\":0,\"keywords\":[\"bdr\",\"postgres\",\"postgresql\",\"replication\"],\"articleSection\":[\"PostgreSQL\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/arumel.com\\\/es\\\/replicacion-bdr-y-postgresql\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/arumel.com\\\/es\\\/replicacion-bdr-y-postgresql\\\/\",\"url\":\"https:\\\/\\\/arumel.com\\\/es\\\/replicacion-bdr-y-postgresql\\\/\",\"name\":\"Replicaci\u00f3n BDR y Postgresql - Arumel\",\"isPartOf\":{\"@id\":\"http:\\\/\\\/arumel.com\\\/#website\"},\"datePublished\":\"2021-01-18T17:34:58+00:00\",\"author\":{\"@id\":\"http:\\\/\\\/arumel.com\\\/#\\\/schema\\\/person\\\/e270e777d900dcd47f8eb3895c076b64\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/arumel.com\\\/es\\\/replicacion-bdr-y-postgresql\\\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/arumel.com\\\/es\\\/replicacion-bdr-y-postgresql\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/arumel.com\\\/es\\\/replicacion-bdr-y-postgresql\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Portada\",\"item\":\"https:\\\/\\\/arumel.com\\\/es\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Replicaci\u00f3n BDR y Postgresql\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\\\/\\\/arumel.com\\\/#website\",\"url\":\"http:\\\/\\\/arumel.com\\\/\",\"name\":\"Arumel\",\"description\":\"Outro sitio WordPress m\u00e1is\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\\\/\\\/arumel.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"},{\"@type\":\"Person\",\"@id\":\"http:\\\/\\\/arumel.com\\\/#\\\/schema\\\/person\\\/e270e777d900dcd47f8eb3895c076b64\",\"name\":\"sm\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6207cd8b9baaee6c4cff92251bb20e4b48ce165f93e926218da90832d9f334f9?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6207cd8b9baaee6c4cff92251bb20e4b48ce165f93e926218da90832d9f334f9?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/6207cd8b9baaee6c4cff92251bb20e4b48ce165f93e926218da90832d9f334f9?s=96&d=mm&r=g\",\"caption\":\"sm\"},\"url\":\"https:\\\/\\\/arumel.com\\\/es\\\/author\\\/sergio\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Replicaci\u00f3n BDR y Postgresql - Arumel","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/arumel.com\/es\/replicacion-bdr-y-postgresql\/","og_locale":"es_ES","og_type":"article","og_title":"Replicaci\u00f3n BDR y Postgresql - Arumel","og_description":"Un cliente con una configuraci\u00f3n bdr defectuosa (cluster dos nodos cuando son necesarios 3) y tras una parada por el uso de secuencias bdr que necesitan un quorum de (n\u00ba nodos \/ 2 + 1) para poder funcionar (y solo funcionaba uno), se le deja con ese \u00fanico nodo para posteriormente ampliar la configuraci\u00f3n bdr [&hellip;]","og_url":"https:\/\/arumel.com\/es\/replicacion-bdr-y-postgresql\/","og_site_name":"Arumel","article_published_time":"2021-01-18T17:34:58+00:00","author":"sm","twitter_card":"summary_large_image","twitter_misc":{"Escrito por":"sm","Tiempo de lectura":"7 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/arumel.com\/es\/replicacion-bdr-y-postgresql\/#article","isPartOf":{"@id":"https:\/\/arumel.com\/es\/replicacion-bdr-y-postgresql\/"},"author":{"name":"sm","@id":"http:\/\/arumel.com\/#\/schema\/person\/e270e777d900dcd47f8eb3895c076b64"},"headline":"Replicaci\u00f3n BDR y Postgresql","datePublished":"2021-01-18T17:34:58+00:00","mainEntityOfPage":{"@id":"https:\/\/arumel.com\/es\/replicacion-bdr-y-postgresql\/"},"wordCount":182,"commentCount":0,"keywords":["bdr","postgres","postgresql","replication"],"articleSection":["PostgreSQL"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/arumel.com\/es\/replicacion-bdr-y-postgresql\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/arumel.com\/es\/replicacion-bdr-y-postgresql\/","url":"https:\/\/arumel.com\/es\/replicacion-bdr-y-postgresql\/","name":"Replicaci\u00f3n BDR y Postgresql - Arumel","isPartOf":{"@id":"http:\/\/arumel.com\/#website"},"datePublished":"2021-01-18T17:34:58+00:00","author":{"@id":"http:\/\/arumel.com\/#\/schema\/person\/e270e777d900dcd47f8eb3895c076b64"},"breadcrumb":{"@id":"https:\/\/arumel.com\/es\/replicacion-bdr-y-postgresql\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/arumel.com\/es\/replicacion-bdr-y-postgresql\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/arumel.com\/es\/replicacion-bdr-y-postgresql\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Portada","item":"https:\/\/arumel.com\/es\/"},{"@type":"ListItem","position":2,"name":"Replicaci\u00f3n BDR y Postgresql"}]},{"@type":"WebSite","@id":"http:\/\/arumel.com\/#website","url":"http:\/\/arumel.com\/","name":"Arumel","description":"Outro sitio WordPress m\u00e1is","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/arumel.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"},{"@type":"Person","@id":"http:\/\/arumel.com\/#\/schema\/person\/e270e777d900dcd47f8eb3895c076b64","name":"sm","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/secure.gravatar.com\/avatar\/6207cd8b9baaee6c4cff92251bb20e4b48ce165f93e926218da90832d9f334f9?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/6207cd8b9baaee6c4cff92251bb20e4b48ce165f93e926218da90832d9f334f9?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6207cd8b9baaee6c4cff92251bb20e4b48ce165f93e926218da90832d9f334f9?s=96&d=mm&r=g","caption":"sm"},"url":"https:\/\/arumel.com\/es\/author\/sergio\/"}]}},"jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p9uvW6-2EO","jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":10097,"url":"https:\/\/arumel.com\/es\/failover-auto-pgbouncer-repmgr-postgresql-13-parte-1\/","url_meta":{"origin":10218,"position":0},"title":"Failover auto &#8211; Pgbouncer + Repmgr + Postgresql 13 (parte 1)","author":"sm","date":"12 de enero de 2021","format":false,"excerpt":"Ver configuraci\u00f3n parte 1 Ver configuraci\u00f3n parte 2 Ver configuraci\u00f3n parte 1 daemon repmgr Instalamos el pgbouncer en el nodo \"testigo\" (postgres4): [root@postgres4 ~]# dnf install pgbouncer \u00a0 Para hacer las pruebas de conexi\u00f3n de clientes, vamos a crear una nueva base de datos en el cluster (appdb) a la\u2026","rel":"","context":"En &quot;portada&quot;","block_context":{"text":"portada","link":"https:\/\/arumel.com\/es\/portada-es\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/arumel.com\/wp-content\/uploads\/2021\/01\/pgbouncer-repmgr-auto-285x300.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":10067,"url":"https:\/\/arumel.com\/es\/auto-failover-repmgr-y-postgresql-13-parte-1\/","url_meta":{"origin":10218,"position":1},"title":"Auto failover &#8211; Repmgr y Postgresql 13 (parte 1)","author":"sm","date":"12 de enero de 2021","format":false,"excerpt":"Si repasamos las entradas anteriores Parte1 y Parte2, vemos que tenemos configurado el repmgr pero no hemos activado el demonio para que haga el chequeo continuo. Para ello necesitamos activar el servicio a nivel de SO y cargar su librer\u00eda en postgresql. En el fichero de postgresql.conf a\u00f1adimos la siguiente\u2026","rel":"","context":"En &quot;portada&quot;","block_context":{"text":"portada","link":"https:\/\/arumel.com\/es\/portada-es\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/arumel.com\/wp-content\/uploads\/2021\/01\/repmgr-auto-284x300.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":10040,"url":"https:\/\/arumel.com\/es\/preparacion-entorno-repmgr-y-postgresql-13-parte-2\/","url_meta":{"origin":10218,"position":2},"title":"Preparaci\u00f3n entorno &#8211; Repmgr y Postgresql 13 (parte 2)","author":"sm","date":"12 de enero de 2021","format":false,"excerpt":"Ver configuraci\u00f3n parte1 Registramos el primer nodo en el cluster: [postgres@postgres1 ~]$ repmgr primary register INFO: connecting to primary database... NOTICE: attempting to install extension \"repmgr\" NOTICE: \"repmgr\" extension successfully installed NOTICE: primary node record (ID: 1) registered \u00a0 Mostramos el estado del cluster: [postgres@postgres1 ~]$ repmgr cluster show ID\u2026","rel":"","context":"En &quot;PostgreSQL&quot;","block_context":{"text":"PostgreSQL","link":"https:\/\/arumel.com\/es\/postgresql-es\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":10119,"url":"https:\/\/arumel.com\/es\/failover-auto-pgbouncer-repmgr-postgresql-13-parte-4\/","url_meta":{"origin":10218,"position":3},"title":"Failover auto &#8211; Pgbouncer + Repmgr + Postgresql 13 (parte 4)","author":"sm","date":"12 de enero de 2021","format":false,"excerpt":"Ver parte 1 Ver parte 2 Ver parte 3 Vamos a hacer una prueba de balanceo autom\u00e1tico tras la p\u00e9rdida del nodo primario (postgres2) y como balancea el failover a un nodo secundario (postgres1), tras la parada de la conexiones en el pgbouncer, posterior reconfiguraci\u00f3n, y conexi\u00f3n posterior al nuevo\u2026","rel":"","context":"En &quot;portada&quot;","block_context":{"text":"portada","link":"https:\/\/arumel.com\/es\/portada-es\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/arumel.com\/wp-content\/uploads\/2021\/01\/pgbouncer-repmgr-auto-285x300.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/arumel.com\/wp-content\/uploads\/2021\/01\/pgbouncer-repmgr-auto-285x300.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/arumel.com\/wp-content\/uploads\/2021\/01\/pgbouncer-repmgr-auto-285x300.png?resize=525%2C300 1.5x"},"classes":[]},{"id":9995,"url":"https:\/\/arumel.com\/es\/preparacion-entorno-repmgr-y-postgresql-13-parte-1\/","url_meta":{"origin":10218,"position":4},"title":"Preparaci\u00f3n entorno &#8211; Repmgr y Postgresql 13 (parte 1)","author":"sm","date":"12 de enero de 2021","format":false,"excerpt":"\u00a0 Nos disponemos a preparar un entorno sobre el que realizar pruebas con repmgr 13 (versi\u00f3n 5.2) y postgresql versi\u00f3n 13. En nuestro caso se tratar\u00e1 de un OEL 8.3 (con kernel de redhat). Una vez creada la primera m\u00e1quina virtual procedemos a la instalaci\u00f3n de los repositorios y desactivar\u2026","rel":"","context":"En &quot;PostgreSQL&quot;","block_context":{"text":"PostgreSQL","link":"https:\/\/arumel.com\/es\/postgresql-es\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/arumel.com\/wp-content\/uploads\/2021\/01\/repmgr-manual.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/arumel.com\/wp-content\/uploads\/2021\/01\/repmgr-manual.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/arumel.com\/wp-content\/uploads\/2021\/01\/repmgr-manual.png?resize=525%2C300 1.5x"},"classes":[]},{"id":10087,"url":"https:\/\/arumel.com\/es\/auto-failover-repmgr-y-postgresql-13-parte-2\/","url_meta":{"origin":10218,"position":5},"title":"Auto failover &#8211; Repmgr y Postgresql 13 (parte 2)","author":"sm","date":"12 de enero de 2021","format":false,"excerpt":"Ver configuraci\u00f3n de la parte 1. El estado previo del cluster es el siguiente: [postgres@postgres1 ~]$ repmgr cluster show ID | Name | Role | Status | Upstream | Location | Priority | Timeline | Connection string ----+-------------------+---------+-----------+-----------+----------+----------+----------+---------------------------------------------- 1 | postgres1 | primary | * running | | default |\u2026","rel":"","context":"En &quot;portada&quot;","block_context":{"text":"portada","link":"https:\/\/arumel.com\/es\/portada-es\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/arumel.com\/wp-content\/uploads\/2021\/01\/repmgr-auto-284x300.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/arumel.com\/es\/wp-json\/wp\/v2\/posts\/10218","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/arumel.com\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/arumel.com\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/arumel.com\/es\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/arumel.com\/es\/wp-json\/wp\/v2\/comments?post=10218"}],"version-history":[{"count":19,"href":"https:\/\/arumel.com\/es\/wp-json\/wp\/v2\/posts\/10218\/revisions"}],"predecessor-version":[{"id":10237,"href":"https:\/\/arumel.com\/es\/wp-json\/wp\/v2\/posts\/10218\/revisions\/10237"}],"wp:attachment":[{"href":"https:\/\/arumel.com\/es\/wp-json\/wp\/v2\/media?parent=10218"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/arumel.com\/es\/wp-json\/wp\/v2\/categories?post=10218"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/arumel.com\/es\/wp-json\/wp\/v2\/tags?post=10218"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}