Scott Marlowe scott.marlowe at gmail.com
Fri Oct 9 23:51:26 PDT 2015
On Fri, Oct 9, 2015 at 11:09 PM, Sung Hsin Lei <sungh.lei at gmail.com> wrote:
>
>
> On Sat, Oct 10, 2015 at 12:50 AM, Scott Marlowe <scott.marlowe at gmail.com>
> wrote:
>>
>> On Fri, Oct 9, 2015 at 9:34 PM, Sung Hsin Lei <sungh.lei at gmail.com> wrote:
>> > Hello,
>> >
>> > I have a 10gig database on the Master which I backed up and restored on
>> > the
>> > Slave. Database activity is low. When I setup Slony replication from the
>> > Master to the Slave, it would take hours before new information from the
>> > Master would be updated into the Slave. Postgres would be also VERY slow
>> > for
>> > the first few hours. However, after the initial wait period, the Slave
>> > would
>> > update within a second or so and Postgres speed would return to normal.
>> > I'm
>> > assuming that Slony is taking time to verify the initial database
>> > integrity
>> > between the Master and the Slave. Am i right? I would like to know if
>> > there's a way to have the updates start within the first few minutes of
>> > the
>> > original setup.
>>
>> In a normal slony sub, all you need on the slave is the schema. If
>> there's data there it'll get truncated / deleted, so there's no reason
>> to spend time copying it over.
>>
>> IF and only IF you are willing to take your master offline from your
>> application (i.e. stop writes going to it) you can copy over the data
>> and then subscribe with no copy. If the master is not taken "offline"
>> from an application perspective then a subscribe with no copy will
>> result in your master and slave not having the same data (which is
>> bad).
>
>
> Thanks for the response.
>
> How about when you change the db schema such as adding/removing/renaming
> tables, columns and dependencies? We usually stop the replication, delete
> the cluster from both Master and Slave, make the changes on both Master and
> Slave and run the setup from scratch. This would also freeze postgres and
> take several hours for replication to start. Isn't there a way to make it
> faster considering that all data is already in the Slave?

Yes, what you are looking for is the EXECUTE SCRIPT command. See this page:
http://slony.info/adminguide/2.2/doc/adminguide/stmtddlscript.html

>
> Also, how do you subscribe with no copy?
>

There's an argument for the slonik subscribe command called "omit copy". See:
http://slony.info/adminguide/2.2/doc/adminguide/stmtsubscribeset.html

Note that all of this assumes you're running slony 2.2.latest. If
you're running on slony 1.2 etc PLEASE consider upgrading.


More information about the Slony1-general mailing list