Guest User

Untitled

a guest
Nov 18th, 2017
448
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.48 KB | None | 0 0
  1. support@vrni-platform:~$ patronictl list -c /etc/patroni/patroni.yml postgresql0
  2. +-------------+-------------+-----------+--------+---------+-----------+
  3. | Cluster | Member | Host | Leader | State | Lag in MB |
  4. +-------------+-------------+-----------+--------+---------+-----------+
  5. | postgresql0 | postgresql0 | localhost | | running | 0.0 |
  6. +-------------+-------------+-----------+--------+---------+-----------+
  7.  
  8. ubuntu@vrni-platform:/etc/init$ sudo pip install patroni --upgrade
  9. The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
  10. The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
  11. /usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  12. InsecurePlatformWarning
  13. Collecting patroni
  14. Requirement already up-to-date: requests in /usr/local/lib/python2.7/dist-packages (from patroni)
  15. Collecting cdiff (from patroni)
  16. Requirement already up-to-date: six>=1.7 in /usr/local/lib/python2.7/dist-packages (from patroni)
  17. Collecting python-etcd<0.5,>=0.4.3 (from patroni)
  18. Requirement already up-to-date: prettytable>=0.7 in /usr/local/lib/python2.7/dist-packages (from patroni)
  19. Requirement already up-to-date: tzlocal in /usr/local/lib/python2.7/dist-packages (from patroni)
  20. Requirement already up-to-date: boto in /usr/local/lib/python2.7/dist-packages (from patroni)
  21. Collecting python-consul>=0.7.0 (from patroni)
  22. Downloading python_consul-0.7.2-py2.py3-none-any.whl
  23. Requirement already up-to-date: psycopg2>=2.6.1 in /usr/local/lib/python2.7/dist-packages (from patroni)
  24. Requirement already up-to-date: kazoo==2.2.1 in /usr/local/lib/python2.7/dist-packages (from patroni)
  25. Requirement already up-to-date: urllib3>=1.9 in /usr/local/lib/python2.7/dist-packages (from patroni)
  26. Requirement already up-to-date: click>=4.1 in /usr/local/lib/python2.7/dist-packages (from patroni)
  27. Requirement already up-to-date: python-dateutil in /usr/local/lib/python2.7/dist-packages (from patroni)
  28. Collecting psutil (from patroni)
  29. Requirement already up-to-date: PyYAML in /usr/local/lib/python2.7/dist-packages (from patroni)
  30. Requirement already up-to-date: certifi>=2017.4.17 in /usr/local/lib/python2.7/dist-packages (from requests->patroni)
  31. Requirement already up-to-date: chardet<3.1.0,>=3.0.2 in /usr/local/lib/python2.7/dist-packages (from requests->patroni)
  32. Requirement already up-to-date: idna<2.7,>=2.5 in /usr/local/lib/python2.7/dist-packages (from requests->patroni)
  33. Requirement already up-to-date: dnspython>=1.13.0 in /usr/local/lib/python2.7/dist-packages (from python-etcd<0.5,>=0.4.3->patroni)
  34. Requirement already up-to-date: pytz in /usr/local/lib/python2.7/dist-packages (from tzlocal->patroni)
  35. Installing collected packages: cdiff, python-etcd, python-consul, psutil, patroni
  36. Found existing installation: python-etcd 0.4.3
  37. Uninstalling python-etcd-0.4.3:
  38. Successfully uninstalled python-etcd-0.4.3
  39. Found existing installation: python-consul 0.6.0
  40. Uninstalling python-consul-0.6.0:
  41. Successfully uninstalled python-consul-0.6.0
  42. Found existing installation: patroni 1.0
  43. Uninstalling patroni-1.0:
  44. Successfully uninstalled patroni-1.0
  45. Successfully installed cdiff-1.0 patroni-1.3.6 psutil-5.4.1 python-consul-0.7.2 python-etcd-0.4.5
  46. You are using pip version 7.1.2, however version 9.0.1 is available.
  47. You should consider upgrading via the 'pip install --upgrade pip' command.
  48.  
  49. patronictl -c /etc/patroni/patroni.yml list postgresql0
  50. +---------+--------+------+------+-------+-----------+
  51. | Cluster | Member | Host | Role | State | Lag in MB |
  52. +---------+--------+------+------+-------+-----------+
  53. +---------+--------+------+------+-------+-----------+
  54.  
  55. 2017-11-17 19:11:24,385 INFO: Connecting to localhost:2181
  56. 2017-11-17 19:11:24,389 INFO: Zookeeper connection established, state: CONNECTED
  57. The files belonging to this database system will be owned by user "postgres".
  58. This user must also own the server process.
  59.  
  60. The database cluster will be initialized with locale "C".
  61. The default text search configuration will be set to "english".
  62.  
  63. Data page checksums are enabled.
  64.  
  65. creating directory /var/lib/postgresql/data/postgresql0 ... ok
  66. creating subdirectories ... ok
  67. selecting default max_connections ... 100
  68. selecting default shared_buffers ... 128MB
  69. selecting dynamic shared memory implementation ... posix
  70. creating configuration files ... 2017-11-17 19:11:25,137 INFO: removing initialize key after failed attempt to initialize the cluster
  71. 2017-11-17 19:11:25,139 INFO: renaming data directory to /var/lib/postgresql/data/postgresql0_2017-11-17-19-11-25
  72. 2017-11-17 19:11:25,403 INFO: Closing connection to localhost:2181
  73. 2017-11-17 19:11:25,403 INFO: Zookeeper session lost, state: CLOSED
  74. 2017-11-17 19:11:25,407 INFO: Connecting to localhost:2181
  75. 2017-11-17 19:11:25,412 INFO: Zookeeper connection established, state: CONNECTED
  76. initdb: could not open file "/var/lib/postgresql/data/postgresql0/postgresql.conf" for writing: No such file or directory
  77. initdb: removing data directory "/var/lib/postgresql/data/postgresql0"
  78. could not open directory "/var/lib/postgresql/data/postgresql0": No such file or directory
  79. initdb: failed to remove data directory
  80. 2017-11-17 19:11:25,910 INFO: Connecting to localhost:2181
  81. 2017-11-17 19:11:25,915 INFO: Zookeeper connection established, state: CONNECTED
  82. The files belonging to this database system will be owned by user "postgres".
  83. This user must also own the server process.
  84.  
  85. The database cluster will be initialized with locale "C".
  86. The default text search configuration will be set to "english".
  87.  
  88. Data page checksums are enabled.
  89.  
  90. creating directory /var/lib/postgresql/data/postgresql0 ... ok
  91. creating subdirectories ... ok
  92. selecting default max_connections ... 100
  93. selecting default shared_buffers ... 128MB
  94. selecting dynamic shared memory implementation ... posix
  95. creating configuration files ... ok
  96. creating template1 database in /var/lib/postgresql/data/postgresql0/base/1 ... ok
  97. initializing pg_authid ... ok
  98. setting password ... ok
  99. initializing dependencies ... ok
  100. creating system views ... ok
  101. loading system objects' descriptions ... ok
  102. creating collations ... ok
  103. creating conversions ... ok
  104. creating dictionaries ... ok
  105. setting privileges on built-in objects ... ok
  106. creating information schema ... ok
  107. loading PL/pgSQL server-side language ... ok
  108. vacuuming database template1 ... ok
  109. copying template1 to template0 ... ok
  110. copying template1 to postgres ... ok
  111. syncing data to disk ... ok
  112.  
  113. WARNING: enabling "trust" authentication for local connections
  114. You can change this by editing pg_hba.conf or using the option -A, or
  115. --auth-local and --auth-host, the next time you run initdb.
  116.  
  117. Success. You can now start the database server using:
  118.  
  119. /usr/lib/postgresql/9.5/bin/pg_ctl -D /var/lib/postgresql/data/postgresql0 -l logfile start
  120.  
  121. waiting for server to start....LOG: database system was shut down at 2017-11-17 19:11:27 UTC
  122. LOG: MultiXact member wraparound protections are now enabled
  123. LOG: autovacuum launcher started
  124. LOG: database system is ready to accept connections
  125. done
  126. server started
  127. 2017-11-17 19:11:29,233 INFO: establishing a new patroni connection to the postgres cluster
  128. 2017-11-17 19:11:29,267 INFO: initialized a new cluster
  129. 2017-11-17 19:11:35,923 INFO: Lock owner: postgresql0; I am postgresql0
  130. 2017-11-17 19:11:35,936 INFO: no action. i am the leader with the lock
  131. 2017-11-17 19:11:35,939 INFO: Lock owner: postgresql0; I am postgresql0
  132. 2017-11-17 19:11:35,941 INFO: no action. i am the leader with the lock
  133. 2017-11-17 19:11:45,941 INFO: Lock owner: postgresql0; I am postgresql0
  134. 2017-11-17 19:11:45,943 INFO: no action. i am the leader with the lock
  135.  
  136. ttl: &ttl 30
  137. loop_wait: &loop_wait 10
  138. scope: &scope excape2
  139. #namespace: /service/
  140. name: postgresql0
  141.  
  142. restapi:
  143. listen: 0.0.0.0:8008
  144. connect_address: 127.0.0.1:8008
  145. zookeeper:
  146. scope: *scope
  147. session_timeout: *ttl
  148. reconnect_timeout: *loop_wait
  149. hosts:
  150. - localhost:2181
  151.  
  152. bootstrap:
  153. # this section will be written into Etcd:/<namespace>/<scope>/config after initializing new cluster
  154. # and all other cluster members will use it as a `global configuration`
  155. dcs:
  156. ttl: 30
  157. loop_wait: 10
  158. retry_timeout: 10
  159. maximum_lag_on_failover: 1048576
  160. postgresql:
  161. use_pg_rewind: true
  162. use_slots: true
  163. parameters:
  164. archive_mode: "off"
  165. wal_level: hot_standby
  166. max_wal_senders: 10
  167. wal_keep_segments: 100
  168. archive_timeout: 1800s
  169. max_replication_slots: 10
  170. hot_standby: "on"
  171. wal_log_hints: "on"
  172. unix_socket_directories: '/tmp'
  173. max_connections: ${pg_max_connections}
  174. shared_buffers: ${pg_shared_buffers}
  175. autovacuum_analyze_scale_factor: 0.05
  176. autovacuum_vacuum_scale_factor: 0.10
  177. log_autovacuum_min_duration: 0
  178. autovacuum_naptime: 15s
  179. autovacuum_max_workers: 6
  180. recovery_conf:
  181. restore_command: cp /var/lib/postgresql/wal_archive/%f %p
  182.  
  183. # some desired options for 'initdb'
  184. initdb: # Note: It needs to be a list (some options need values, others are switches)
  185. - encoding: UTF8
  186. - data-checksums
  187.  
  188. pg_hba: # Add following lines to pg_hba.conf after running 'initdb'
  189. - host postgres all 127.0.0.1/32 trust
  190. - host all all 0.0.0.0/0 md5
  191. - host replication all 0.0.0.0/0 trust
  192. # - hostssl all all 0.0.0.0/0 md5
  193.  
  194. # Some additional users users which needs to be created after initializing new cluster
  195. users:
  196. admin:
  197. password: admin
  198. options:
  199. - createrole
  200. - createdb
  201.  
  202. postgresql:
  203. listen: 0.0.0.0:5432
  204. connect_address: localhost:5432
  205. data_dir: /var/lib/postgresql/data/postgresql0
  206. maximum_lag_on_failover: 104857600 # 1 megabyte i
  207. pgpass: /tmp/pgpass211
  208. authentication:
  209. replication:
  210. username: replicator
  211. password: rep-pass
  212. network: 0.0.0.0/0
  213. superuser:
  214. username: postgres
  215. password: abcded
  216. parameters:
  217. unix_socket_directories: '.'
  218. create_replica_method:
  219. - basebackup
  220. tags:
  221. nofailover: false
  222. noloadbalance: false
  223. clonefrom: false
Add Comment
Please, Sign In to add comment