~yolanda.robla/charms/precise/postgresql/fix_tabs

« back to all changes in this revision

Viewing changes to README.md

  • Committer: Stuart Bishop
  • Date: 2013-08-21 08:08:57 UTC
  • mto: (48.4.4 fix-races)
  • mto: This revision was merged to the branch mainline in revision 62.
  • Revision ID: stuart.bishop@canonical.com-20130821080857-az2etfil2626zdsa
Update documentation

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
   maintains replication for you, using standard PostgreSQL streaming
42
42
   replication.
43
43
 
44
 
 - Multiple services linked using 'master'/'slave' relationships. A
45
 
   single service can be the 'master', and multiple services connected
46
 
   to this master in a 'slave' role. Each service can contain multiple
47
 
   units; the 'master' service will contain a single 'master' unit and
48
 
   remaining units all 'hot standby'. The 'slave' services will only
49
 
   contain 'hot standby' units. 'Cascading replication is not
50
 
   supported', so do not attempt to relate an existing 'slave' service
51
 
   as a 'master' to another service.
52
 
 
53
44
 
54
45
To setup a single 'standalone' service::
55
46
 
61
52
 
62
53
    juju add-unit pg-a
63
54
 
64
 
To deploy a new service containing a 'master' and a 'hot standby'::
65
 
 
66
 
    juju deploy -n 2 postgresql pg-b
67
 
 
68
 
 
69
 
To relate a PostgreSQL service as a 'slave' of another PostgreSQL service.
70
 
**Caution** - this destroys the existing databases in the pg-b service::
71
 
 
72
 
    juju add-relation pg-a:master pg-b:slave
73
 
 
74
 
 
75
 
To setup a client using a PostgreSQL database, in this case OpenERP and
76
 
its web front end. Note that OpenERP requires an administrative level
77
 
connection::
 
55
To deploy a new service containing a 'master' and two 'hot standbys'::
 
56
 
 
57
    juju deploy -n 3 postgresql pg-b
 
58
 
 
59
You can remove units as normal. If the master unit is removed, failover
 
60
occurs and the most up to date 'hot standby' is promoted to 'master'.
 
61
The 'db-relation-changed' and 'db-admin-relation-changed' hooks are
 
62
fired, letting clients adjust::
 
63
 
 
64
    juju remove-unit pg-b/0
 
65
 
 
66
 
 
67
To setup a client using a PostgreSQL database, in this case a vanilla
 
68
Django installation listening on port 8080::
78
69
 
79
70
    juju deploy postgresql
80
 
    juju deploy postgresql pg-standby
81
 
    juju deploy openerp-web
82
 
    juju deploy openerp-server
83
 
 
84
 
    juju add-relation postgresql:master pg-standby:slave
85
 
    juju add-relation openerp-server:db postgresql:db-admin
86
 
    juju add-relation openerp-web openerp-server
87
 
 
88
 
    juju expose openerp-web
89
 
    juju expose openerp-server
 
71
    juju deploy python-django
 
72
    juju deploy gunicorn
 
73
    juju add-relation python-django postgresql:db
 
74
    juju add-relation python-django gunicorn
 
75
    juju expose python-django
90
76
 
91
77
 
92
78
## Restrictions
93
79
 
94
80
- Do not attempt to relate client charms to a PostgreSQL service
95
81
  containing multiple units unless you know the charm supports
96
 
  a replicated service. You can use a 'master'/'slave' relationship
97
 
  to create a redundant copy of your database until the client charms
98
 
  are updated.
 
82
  a replicated service.
99
83
 
100
84
- You cannot host multiple units in a single juju container. This is
101
85
  problematic as some PostgreSQL features, such as tablespaces, use
103
87
 
104
88
# Interacting with the Postgresql Service
105
89
 
106
 
Typically, you just need to join a the `db` relation, and a user and database
107
 
will be created for you.  For more advanced uses, you can join the `db-admin`
108
 
relation, and a super user will be created.  Using this account, you can
109
 
manipulate all other aspects of the database.
 
90
At a minimum, you just need to join a the `db` relation, and a user and
 
91
database will be created for you.  For more complex environments, 
 
92
you can provide the `database` name allowing multiple services to share
 
93
the same database. A client may also wish to defer its setup until the
 
94
unit name is listed in `allowed-units`, to avoid attempting to connect
 
95
to a database before it has been authorized.
 
96
 
 
97
The `db-admin` relation may be used similarly to the `db` relation.
 
98
The automatically generated user for `db-admin` relations is a
 
99
PostgreSQL superuser.
 
100
 
 
101
## During db-relation-joined
 
102
 
 
103
### the client service provides:
 
104
 
 
105
- `database`: Optional. The name of the database to use. The postgresql
 
106
              service will create it if necessary.
110
107
 
111
108
## During db-relation-changed
112
109