Brad Fitzpatrick (bradfitz) wrote in lj_dev,
Brad Fitzpatrick

Cluster Update

Update from CVS and you'll notice a new tool in bin: This is the script to move users between clusters. Currently only moving from cluster 0 (the old non-cluster schema) is supported.

To play with this, though, you'll need the rest of the code. Apply this patch:

Realize some people may not know patch:

$ cd ~lj
$ patch -p3 < cluster.20010112.diff
(if your lj root is /home/lj, -p0 will also work, in which case your current directory won't matter)

Then, in your, you need to define a slave (not the master, even if it has the same DSN) with a role of "cluster1" and "cluster1slave", as well as define @CLUSTERS with valid clusterids for your site.

So basically you're running cluster 0 and cluster 1 on the same machine. (which is exactly what LJ will do...) And we'll have another cluster 2 rooted off cartman (robust hardware, lots of disk). Then it's time to start buying more database servers.

Anyway, to run this afterwards:

$ test 1
Easy, eh? No way to move a user back to cluster 0, though (that'd be dumb), so keep a snapshot of your database around to reset to.

Example: (

       @CLUSTERS = qw(1);
        %DBINFO = (
                   'master' => {
                       'host' => '',
                       'user' => 'lj',
                       'pass' => 'whatever',

                   'slavecount' => 1,
                   'slave1' => {
                       'host' => '',
                       'user' => 'lj',
                       'pass' => 'whatever',
                       'role' => {
                           'cluster1' => 1,
                           'cluster1slave' => 1,

  • Post a new comment


    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded