Brad Fitzpatrick (bradfitz) wrote in lj_dev,
Brad Fitzpatrick
bradfitz
lj_dev

Cluster Update

Update from CVS and you'll notice a new tool in bin: moveucluster.pl. 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:

http://goathack.livejournal.org:8001/dev/cluster.20010112.diff

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 ljconfig.pl, 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:

$ moveucluster.pl 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: (ljconfig.pl)

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

                   'slavecount' => 1,
                   'slave1' => {
                       'host' => '10.0.0.80',
                       'user' => 'lj',
                       'pass' => 'whatever',
                       'role' => {
                           'cluster1' => 1,
                           'cluster1slave' => 1,
                       },
                   },
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments