Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #2.8
- SELECT * FROM organizations WHERE or_id=216;
- or_id | or_name | or_type
- -------+-----------------+----------
- 216 | Organization216 | OPERATOR
- Dane zostaly odczytane z wlaczonej repliki
- #2.10
- SELECT * FROM organizations WHERE or_id=216;
- WARNING: terminating connection due to administrator command
- WARNING: terminating connection due to administrator command
- ERROR: could not receive query results
- SELECT * FROM organizations WHERE or_id=216;
- WARNING: connection error: localhost:5433
- DETAIL: no connection to the server
- WARNING: connection error: localhost:5432
- DETAIL: no connection to the server
- ERROR: could not receive query results
- Brak dzialajacej repliki
- #2.12
- postgres@master:5434# SELECT * FROM organizations WHERE or_id=216;
- WARNING: connection error: localhost:5433
- DETAIL: no connection to the server
- or_id | or_name | or_type
- -------+-----------------+----------
- 216 | Organization216 | OPERATOR
- (1 row)
- #2.13
- postgres@master:5434# UPDATE organizations SET or_type='CLIENT' WHERE or_id=216;
- WARNING: connection error: localhost:5433
- DETAIL: no connection to the server
- UPDATE 1
- Zmiana zostala wykonana tylko na rsbd1, rsbd2 jest wylaczone
- #2.15
- postgres@master:5434# SELECT * FROM organizations WHERE or_id=216;
- or_id | or_name | or_type
- -------+-----------------+---------
- 216 | Organization216 | CLIENT
- (1 row)
- #2.17
- postgres@master:5434# SELECT * FROM organizations WHERE or_id=216;
- WARNING: terminating connection due to administrator command
- ERROR: could not receive query results
- #2.18
- postgres@master:5434# SELECT placementid, logicalrelid, shardid, case shardstate when 1 then 'ACTIVE' when 3 then 'INACTIVE' when 4 then 'TO_DELETE' end as status,nodename, nodeport FROM pg_dist_partition JOIN pg_dist_shard_placement ON get_shard_id_for_distribution_column(logicalrelid::varchar,216)=shardid and logicalrelid='organizations'::regclass;
- placementid | logicalrelid | shardid | status | nodename | nodeport
- -------------+---------------+---------+----------+-----------+----------
- 106 | organizations | 102108 | ACTIVE | localhost | 5432
- 107 | organizations | 102108 | INACTIVE | localhost | 5433
- (2 rows)
- #2.20
- SELECT master_copy_shard_placement(102108, 'localhost', 5432, 'localhost', 5433);
- #2.21
- Udalo sie przywrocic spojnosc fragmentow
- postgres@master:5434# SELECT master_copy_shard_placement(102108, 'localhost', 5432, 'localhost', 5433);
- master_copy_shard_placement
- -----------------------------
- (1 row)
- postgres@master:5434# SELECT placementid, logicalrelid, shardid, case shardstate when 1 then 'ACTIVE' when 3 then 'INACTIVE' when 4 then 'TO_DELETE' end as status,nodename, nodeport FROM pg_dist_partition JOIN pg_dist_shard_placement ON get_shard_id_for_distribution_column(logicalrelid::varchar,216)=shardid and logicalrelid='organizations'::regclass;
- placementid | logicalrelid | shardid | status | nodename | nodeport
- -------------+---------------+---------+--------+-----------+----------
- 106 | organizations | 102108 | ACTIVE | localhost | 5432
- 107 | organizations | 102108 | ACTIVE | localhost | 5433
- (2 rows)
- #3.10
- node_id=1
- node_name=Master1
- conninfo='host=localhost port=5434 user=postgres dbname=postgres'
- data_directory='/var/lib/pgsql/master'
- #3.18
- select * from repmgr.nodes;
- node_id | upstream_node_id | active | node_name | type | location | priority
- | conninfo | repluser | slot_name
- | config_file
- ---------+------------------+--------+-----------+---------+----------+---------
- -+--------------------------------------------------------+----------+----------
- -+------------------------------------
- 1 | | t | Master1 | primary | default | 100
- | host=localhost port=5434 user=postgres dbname=postgres | postgres |
- | /var/lib/pgsql/repmgr_master1.conf
- 2 | 1 | t | Master2 | standby | default | 100
- | host=localhost port=5436 user=postgres dbname=postgres | postgres |
- | /var/lib/pgsql/repmgr_master2.conf
- (2 rows)
- #3.28
- postgres=# select * from loggers where lo_or_id=261;
- lo_id | lo_description | lo_or_id | lo_lt_id
- -------+-----------------+----------+----------
- 2513 | Description2513 | 261 | 4
- 2715 | Description2715 | 261 | 4
- (2 rows)
- #3.29
- select * from "repmgr_CitrusMasters".repl_nodes;
- zamieniam na
- select * from repmgr.nodes;
- postgres=# select * from repmgr.nodes;
- node_id | upstream_node_id | active | node_name | type | location | priority
- | conninfo | repluser | slot_name
- | config_file
- ---------+------------------+--------+-----------+---------+----------+---------
- -+--------------------------------------------------------+----------+----------
- -+------------------------------------
- 1 | | f | Master1 | primary | default | 100
- | host=localhost port=5434 user=postgres dbname=postgres | postgres |
- | /var/lib/pgsql/repmgr_master1.conf
- 2 | | t | Master2 | primary | default | 100
- | host=localhost port=5436 user=postgres dbname=postgres | postgres |
- | /var/lib/pgsql/repmgr_master2.conf
- (2 rows)
- zmiany w konfiguracji:
- active Master1 t => f
- type Master2 standby => primary
- Z powodu awarii bazy danych Master1 zmienilismy bazde danych Master2 na primaray
- #3.30
- repmgr -f /var/lib/pgsql/repmgr_master1.conf primary unregister
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement