Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.65 KB | None | 0 0
  1. #2.8
  2.  
  3. SELECT * FROM organizations WHERE or_id=216;
  4. or_id | or_name | or_type
  5. -------+-----------------+----------
  6. 216 | Organization216 | OPERATOR
  7.  
  8. Dane zostaly odczytane z wlaczonej repliki
  9.  
  10. #2.10
  11.  
  12. SELECT * FROM organizations WHERE or_id=216;
  13. WARNING: terminating connection due to administrator command
  14. WARNING: terminating connection due to administrator command
  15. ERROR: could not receive query results
  16.  
  17. SELECT * FROM organizations WHERE or_id=216;
  18. WARNING: connection error: localhost:5433
  19. DETAIL: no connection to the server
  20.  
  21. WARNING: connection error: localhost:5432
  22. DETAIL: no connection to the server
  23.  
  24. ERROR: could not receive query results
  25.  
  26. Brak dzialajacej repliki
  27.  
  28. #2.12
  29.  
  30. postgres@master:5434# SELECT * FROM organizations WHERE or_id=216;
  31. WARNING: connection error: localhost:5433
  32. DETAIL: no connection to the server
  33.  
  34. or_id | or_name | or_type
  35. -------+-----------------+----------
  36. 216 | Organization216 | OPERATOR
  37. (1 row)
  38.  
  39.  
  40.  
  41. #2.13
  42.  
  43. postgres@master:5434# UPDATE organizations SET or_type='CLIENT' WHERE or_id=216;
  44. WARNING: connection error: localhost:5433
  45. DETAIL: no connection to the server
  46.  
  47. UPDATE 1
  48.  
  49. Zmiana zostala wykonana tylko na rsbd1, rsbd2 jest wylaczone
  50.  
  51. #2.15
  52.  
  53. postgres@master:5434# SELECT * FROM organizations WHERE or_id=216;
  54. or_id | or_name | or_type
  55. -------+-----------------+---------
  56. 216 | Organization216 | CLIENT
  57. (1 row)
  58.  
  59. #2.17
  60.  
  61. postgres@master:5434# SELECT * FROM organizations WHERE or_id=216;
  62. WARNING: terminating connection due to administrator command
  63. ERROR: could not receive query results
  64.  
  65. #2.18
  66.  
  67. 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;
  68. placementid | logicalrelid | shardid | status | nodename | nodeport
  69. -------------+---------------+---------+----------+-----------+----------
  70. 106 | organizations | 102108 | ACTIVE | localhost | 5432
  71. 107 | organizations | 102108 | INACTIVE | localhost | 5433
  72. (2 rows)
  73.  
  74. #2.20
  75.  
  76. SELECT master_copy_shard_placement(102108, 'localhost', 5432, 'localhost', 5433);
  77.  
  78. #2.21
  79. Udalo sie przywrocic spojnosc fragmentow
  80.  
  81. postgres@master:5434# SELECT master_copy_shard_placement(102108, 'localhost', 5432, 'localhost', 5433);
  82. master_copy_shard_placement
  83. -----------------------------
  84.  
  85. (1 row)
  86.  
  87. 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;
  88. placementid | logicalrelid | shardid | status | nodename | nodeport
  89. -------------+---------------+---------+--------+-----------+----------
  90. 106 | organizations | 102108 | ACTIVE | localhost | 5432
  91. 107 | organizations | 102108 | ACTIVE | localhost | 5433
  92. (2 rows)
  93.  
  94. #3.10
  95.  
  96. node_id=1
  97. node_name=Master1
  98. conninfo='host=localhost port=5434 user=postgres dbname=postgres'
  99. data_directory='/var/lib/pgsql/master'
  100.  
  101. #3.18
  102.  
  103. select * from repmgr.nodes;
  104. node_id | upstream_node_id | active | node_name | type | location | priority
  105. | conninfo | repluser | slot_name
  106. | config_file
  107. ---------+------------------+--------+-----------+---------+----------+---------
  108. -+--------------------------------------------------------+----------+----------
  109. -+------------------------------------
  110. 1 | | t | Master1 | primary | default | 100
  111. | host=localhost port=5434 user=postgres dbname=postgres | postgres |
  112. | /var/lib/pgsql/repmgr_master1.conf
  113. 2 | 1 | t | Master2 | standby | default | 100
  114. | host=localhost port=5436 user=postgres dbname=postgres | postgres |
  115. | /var/lib/pgsql/repmgr_master2.conf
  116. (2 rows)
  117.  
  118. #3.28
  119. postgres=# select * from loggers where lo_or_id=261;
  120. lo_id | lo_description | lo_or_id | lo_lt_id
  121. -------+-----------------+----------+----------
  122. 2513 | Description2513 | 261 | 4
  123. 2715 | Description2715 | 261 | 4
  124. (2 rows)
  125.  
  126. #3.29
  127. select * from "repmgr_CitrusMasters".repl_nodes;
  128. zamieniam na
  129. select * from repmgr.nodes;
  130.  
  131. postgres=# select * from repmgr.nodes;
  132. node_id | upstream_node_id | active | node_name | type | location | priority
  133. | conninfo | repluser | slot_name
  134. | config_file
  135. ---------+------------------+--------+-----------+---------+----------+---------
  136. -+--------------------------------------------------------+----------+----------
  137. -+------------------------------------
  138. 1 | | f | Master1 | primary | default | 100
  139. | host=localhost port=5434 user=postgres dbname=postgres | postgres |
  140. | /var/lib/pgsql/repmgr_master1.conf
  141. 2 | | t | Master2 | primary | default | 100
  142. | host=localhost port=5436 user=postgres dbname=postgres | postgres |
  143. | /var/lib/pgsql/repmgr_master2.conf
  144. (2 rows)
  145.  
  146. zmiany w konfiguracji:
  147. active Master1 t => f
  148. type Master2 standby => primary
  149.  
  150. Z powodu awarii bazy danych Master1 zmienilismy bazde danych Master2 na primaray
  151.  
  152. #3.30
  153. repmgr -f /var/lib/pgsql/repmgr_master1.conf primary unregister
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement