{"action":"created","comment":{"url":"https://api.github.com/repos/openshift/postgresql/pulls/comments/33351834","id":33351834,"diff_hunk":"@@ -0,0 +1,51 @@\n+# PostgreSQL Replication Example\n+\n+**WARNING:**\n+\n+**This is only a Proof-Of-Concept example and it is not meant to be used in any\n+production. Use at your own risk.**\n+\n+## What is PostgreSQL replication?\n+\n+Replication enables data from one PostgreSQL database server (the master) to be replicated to one or more PostgreSQL database servers (the slaves). Replication is asynchronous - slaves do not need not be connected permanently to receive updates from the master. This means that updates can occur over long-distance connections and even over temporary or intermittent connections such as a dial-up service.  Depending on the configuration, you can replicate all databases, selected databases, or even selected tables within a database.\n+\n+\n+## How does this example work?\n+\n+The provided JSON file (`postgres_replica.json`) contains a `Config` resource that groups the Kubernetes and OpenShift resources which are meant to be created.  \n+\n+### Service 'pg-master'\n+\n+This resource provides Service for the PostgreSQL server which acts as the 'master'. \n+\n+### Service 'pg-slave'\n+\n+This provides a Service for the PostgreSQL servers that the master uses as 'slaves' which are used to replicate the data from the PostgreSQL master.\n+\n+In this case, you can query the DNS (eg. `dig pg-standby A +search +short`) to\n+obtain the list of the Service endpoints (the PostgreSQL servers that subscribe to this service).\n+\n+### ReplicationController 'pg-master'\n+\n+This resource defines the `PodTemplate` of the PostgreSQL server that acts as the 'master'. The Pod uses the `openshift/postgresql-92-centos7` image.  Once the PostgreSQL master server is started, it has no slaves preconfigured as the slaves registers automatically.  To check that the master PostgreSQL server is working, you can issue the following command on the master container:\n+\n+```\n+psql -h pg-master.foo.local -U user -W db \n+psql> select * from pg_stat_replication;\n+```\n+\n+### ReplicationController 'pg-slave'\n+\n+This resource defines the `PodTemplate` of the PostgreSQL servers that act as the `slaves` to the `master` server. In the provided JSON example, this Replication Controller starts with 2 slaves. Each `slave` server first waits for the `master` server to become available (getting the `master` server IP using the DNS lookup). Once the `master` is available, the PostgreSQL 'slave' server is started and connected to the `master`. \n+\n+To check the 'slave' status, you can issue the following command on the slave container:\n+\n+```\n+psql -h pg-standby.default.local -U user -W db \n+```\n+\n+You can add more slaves if you want, using the following `osc` command.","path":"examples/replica/README.md","position":47,"original_position":47,"commit_id":"9afa0c0d7f64e45e9f2eed5ede4dc5b1b5229edd","original_commit_id":"9afa0c0d7f64e45e9f2eed5ede4dc5b1b5229edd","user":{"login":"jhadvig","id":1668218,"avatar_url":"https://avatars.githubusercontent.com/u/1668218?v=3","gravatar_id":"","url":"https://api.github.com/users/jhadvig","html_url":"https://github.com/jhadvig","followers_url":"https://api.github.com/users/jhadvig/followers","following_url":"https://api.github.com/users/jhadvig/following{/other_user}","gists_url":"https://api.github.com/users/jhadvig/gists{/gist_id}","starred_url":"https://api.github.com/users/jhadvig/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jhadvig/subscriptions","organizations_url":"https://api.github.com/users/jhadvig/orgs","repos_url":"https://api.github.com/users/jhadvig/repos","events_url":"https://api.github.com/users/jhadvig/events{/privacy}","received_events_url":"https://api.github.com/users/jhadvig/received_events","type":"User","site_admin":false},"body":"osc -> oc","created_at":"2015-06-26T12:41:33Z","updated_at":"2015-06-26T12:41:33Z","html_url":"https://github.com/openshift/postgresql/pull/35#discussion_r33351834","pull_request_url":"https://api.github.com/repos/openshift/postgresql/pulls/35","_links":{"self":{"href":"https://api.github.com/repos/openshift/postgresql/pulls/comments/33351834"},"html":{"href":"https://github.com/openshift/postgresql/pull/35#discussion_r33351834"},"pull_request":{"href":"https://api.github.com/repos/openshift/postgresql/pulls/35"}}},"pull_request":{"url":"https://api.github.com/repos/openshift/postgresql/pulls/35","id":38551109,"html_url":"https://github.com/openshift/postgresql/pull/35","diff_url":"https://github.com/openshift/postgresql/pull/35.diff","patch_url":"https://github.com/openshift/postgresql/pull/35.patch","issue_url":"https://api.github.com/repos/openshift/postgresql/issues/35","number":35,"state":"open","locked":false,"title":"WIP: Add streaming replication","user":{"login":"mnagy","id":72469,"avatar_url":"https://avatars.githubusercontent.com/u/72469?v=3","gravatar_id":"","url":"https://api.github.com/users/mnagy","html_url":"https://github.com/mnagy","followers_url":"https://api.github.com/users/mnagy/followers","following_url":"https://api.github.com/users/mnagy/following{/other_user}","gists_url":"https://api.github.com/users/mnagy/gists{/gist_id}","starred_url":"https://api.github.com/users/mnagy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnagy/subscriptions","organizations_url":"https://api.github.com/users/mnagy/orgs","repos_url":"https://api.github.com/users/mnagy/repos","events_url":"https://api.github.com/users/mnagy/events{/privacy}","received_events_url":"https://api.github.com/users/mnagy/received_events","type":"User","site_admin":false},"body":"This is based on #13 by @jmccormick2001.\r\n\r\nWe needed to restructure a lot of stuff to fit in with what we have in MySQL and MongoDB. Opening another PR to make it easier.\r\n\r\n@jhadvig did the template and initial restructuring.\r\n\r\nRight now it is still a WIP. The problem I have right now is that only the initial replication works, but updates to master will not propagate to slave.","created_at":"2015-06-25T14:08:48Z","updated_at":"2015-06-26T12:41:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d6866a402e045f0bea88ad78c34dd2990a7ad492","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openshift/postgresql/pulls/35/commits","review_comments_url":"https://api.github.com/repos/openshift/postgresql/pulls/35/comments","review_comment_url":"https://api.github.com/repos/openshift/postgresql/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openshift/postgresql/issues/35/comments","statuses_url":"https://api.github.com/repos/openshift/postgresql/statuses/9afa0c0d7f64e45e9f2eed5ede4dc5b1b5229edd","head":{"label":"mnagy:replication","ref":"replication","sha":"9afa0c0d7f64e45e9f2eed5ede4dc5b1b5229edd","user":{"login":"mnagy","id":72469,"avatar_url":"https://avatars.githubusercontent.com/u/72469?v=3","gravatar_id":"","url":"https://api.github.com/users/mnagy","html_url":"https://github.com/mnagy","followers_url":"https://api.github.com/users/mnagy/followers","following_url":"https://api.github.com/users/mnagy/following{/other_user}","gists_url":"https://api.github.com/users/mnagy/gists{/gist_id}","starred_url":"https://api.github.com/users/mnagy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnagy/subscriptions","organizations_url":"https://api.github.com/users/mnagy/orgs","repos_url":"https://api.github.com/users/mnagy/repos","events_url":"https://api.github.com/users/mnagy/events{/privacy}","received_events_url":"https://api.github.com/users/mnagy/received_events","type":"User","site_admin":false},"repo":{"id":32481340,"name":"postgresql","full_name":"mnagy/postgresql","owner":{"login":"mnagy","id":72469,"avatar_url":"https://avatars.githubusercontent.com/u/72469?v=3","gravatar_id":"","url":"https://api.github.com/users/mnagy","html_url":"https://github.com/mnagy","followers_url":"https://api.github.com/users/mnagy/followers","following_url":"https://api.github.com/users/mnagy/following{/other_user}","gists_url":"https://api.github.com/users/mnagy/gists{/gist_id}","starred_url":"https://api.github.com/users/mnagy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mnagy/subscriptions","organizations_url":"https://api.github.com/users/mnagy/orgs","repos_url":"https://api.github.com/users/mnagy/repos","events_url":"https://api.github.com/users/mnagy/events{/privacy}","received_events_url":"https://api.github.com/users/mnagy/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mnagy/postgresql","description":"","fork":true,"url":"https://api.github.com/repos/mnagy/postgresql","forks_url":"https://api.github.com/repos/mnagy/postgresql/forks","keys_url":"https://api.github.com/repos/mnagy/postgresql/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mnagy/postgresql/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mnagy/postgresql/teams","hooks_url":"https://api.github.com/repos/mnagy/postgresql/hooks","issue_events_url":"https://api.github.com/repos/mnagy/postgresql/issues/events{/number}","events_url":"https://api.github.com/repos/mnagy/postgresql/events","assignees_url":"https://api.github.com/repos/mnagy/postgresql/assignees{/user}","branches_url":"https://api.github.com/repos/mnagy/postgresql/branches{/branch}","tags_url":"https://api.github.com/repos/mnagy/postgresql/tags","blobs_url":"https://api.github.com/repos/mnagy/postgresql/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mnagy/postgresql/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mnagy/postgresql/git/refs{/sha}","trees_url":"https://api.github.com/repos/mnagy/postgresql/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mnagy/postgresql/statuses/{sha}","languages_url":"https://api.github.com/repos/mnagy/postgresql/languages","stargazers_url":"https://api.github.com/repos/mnagy/postgresql/stargazers","contributors_url":"https://api.github.com/repos/mnagy/postgresql/contributors","subscribers_url":"https://api.github.com/repos/mnagy/postgresql/subscribers","subscription_url":"https://api.github.com/repos/mnagy/postgresql/subscription","commits_url":"https://api.github.com/repos/mnagy/postgresql/commits{/sha}","git_commits_url":"https://api.github.com/repos/mnagy/postgresql/git/commits{/sha}","comments_url":"https://api.github.com/repos/mnagy/postgresql/comments{/number}","issue_comment_url":"https://api.github.com/repos/mnagy/postgresql/issues/comments{/number}","contents_url":"https://api.github.com/repos/mnagy/postgresql/contents/{+path}","compare_url":"https://api.github.com/repos/mnagy/postgresql/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mnagy/postgresql/merges","archive_url":"https://api.github.com/repos/mnagy/postgresql/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mnagy/postgresql/downloads","issues_url":"https://api.github.com/repos/mnagy/postgresql/issues{/number}","pulls_url":"https://api.github.com/repos/mnagy/postgresql/pulls{/number}","milestones_url":"https://api.github.com/repos/mnagy/postgresql/milestones{/number}","notifications_url":"https://api.github.com/repos/mnagy/postgresql/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mnagy/postgresql/labels{/name}","releases_url":"https://api.github.com/repos/mnagy/postgresql/releases{/id}","created_at":"2015-03-18T20:04:26Z","updated_at":"2015-03-18T15:15:47Z","pushed_at":"2015-06-25T17:30:15Z","git_url":"git://github.com/mnagy/postgresql.git","ssh_url":"git@github.com:mnagy/postgresql.git","clone_url":"https://github.com/mnagy/postgresql.git","svn_url":"https://github.com/mnagy/postgresql","homepage":null,"size":213,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"openshift:master","ref":"master","sha":"6d76659c92b46d9172782e82b80768824db9e869","user":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"repo":{"id":32466378,"name":"postgresql","full_name":"openshift/postgresql","owner":{"login":"openshift","id":792337,"avatar_url":"https://avatars.githubusercontent.com/u/792337?v=3","gravatar_id":"","url":"https://api.github.com/users/openshift","html_url":"https://github.com/openshift","followers_url":"https://api.github.com/users/openshift/followers","following_url":"https://api.github.com/users/openshift/following{/other_user}","gists_url":"https://api.github.com/users/openshift/gists{/gist_id}","starred_url":"https://api.github.com/users/openshift/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openshift/subscriptions","organizations_url":"https://api.github.com/users/openshift/orgs","repos_url":"https://api.github.com/users/openshift/repos","events_url":"https://api.github.com/users/openshift/events{/privacy}","received_events_url":"https://api.github.com/users/openshift/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openshift/postgresql","description":"","fork":false,"url":"https://api.github.com/repos/openshift/postgresql","forks_url":"https://api.github.com/repos/openshift/postgresql/forks","keys_url":"https://api.github.com/repos/openshift/postgresql/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openshift/postgresql/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openshift/postgresql/teams","hooks_url":"https://api.github.com/repos/openshift/postgresql/hooks","issue_events_url":"https://api.github.com/repos/openshift/postgresql/issues/events{/number}","events_url":"https://api.github.com/repos/openshift/postgresql/events","assignees_url":"https://api.github.com/repos/openshift/postgresql/assignees{/user}","branches_url":"https://api.github.com/repos/openshift/postgresql/branches{/branch}","tags_url":"https://api.github.com/repos/openshift/postgresql/tags","blobs_url":"https://api.github.com/repos/openshift/postgresql/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openshift/postgresql/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openshift/postgresql/git/refs{/sha}","trees_url":"https://api.github.com/repos/openshift/postgresql/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openshift/postgresql/statuses/{sha}","languages_url":"https://api.github.com/repos/openshift/postgresql/languages","stargazers_url":"https://api.github.com/repos/openshift/postgresql/stargazers","contributors_url":"https://api.github.com/repos/openshift/postgresql/contributors","subscribers_url":"https://api.github.com/repos/openshift/postgresql/subscribers","subscription_url":"https://api.github.com/repos/openshift/postgresql/subscription","commits_url":"https://api.github.com/repos/openshift/postgresql/commits{/sha}","git_commits_url":"https://api.github.com/repos/openshift/postgresql/git/commits{/sha}","comments_url":"https://api.github.com/repos/openshift/postgresql/comments{/number}","issue_comment_url":"https://api.github.com/repos/openshift/postgresql/issues/comments{/number}","contents_url":"https://api.github.com/repos/openshift/postgresql/contents/{+path}","compare_url":"https://api.github.com/repos/openshift/postgresql/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openshift/postgresql/merges","archive_url":"https://api.github.com/repos/openshift/postgresql/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openshift/postgresql/downloads","issues_url":"https://api.github.com/repos/openshift/postgresql/issues{/number}","pulls_url":"https://api.github.com/repos/openshift/postgresql/pulls{/number}","milestones_url":"https://api.github.com/repos/openshift/postgresql/milestones{/number}","notifications_url":"https://api.github.com/repos/openshift/postgresql/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openshift/postgresql/labels{/name}","releases_url":"https://api.github.com/repos/openshift/postgresql/releases{/id}","created_at":"2015-03-18T15:15:33Z","updated_at":"2015-06-01T05:58:18Z","pushed_at":"2015-06-25T17:30:16Z","git_url":"git://github.com/openshift/postgresql.git","ssh_url":"git@github.com:openshift/postgresql.git","clone_url":"https://github.com/openshift/postgresql.git","svn_url":"https://github.com/openshift/postgresql","homepage":null,"size":481,"stargazers_count":3,"watchers_count":3,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":12,"mirror_url":null,"open_issues_count":4,"forks":12,"open_issues":4,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openshift/postgresql/pulls/35"},"html":{"href":"https://github.com/openshift/postgresql/pull/35"},"issue":{"href":"https://api.github.com/repos/openshift/postgresql/issues/35"},"comments":{"href":"https://api.github.com/repos/openshift/postgresql/issues/35/comments"},"review_comments":{"href":"https://api.github.com/repos/openshift/postgresql/pulls/35/comments"},"review_comment":{"href":"https://api.github.com/repos/openshift/postgresql/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openshift/postgresql/pulls/35/commits"},"statuses":{"href":"https://api.github.com/repos/openshift/postgresql/statuses/9afa0c0d7f64e45e9f2eed5ede4dc5b1b5229edd"}}}}