]> andersk Git - moira.git/blob - afssync/INSTRUCTIONS
d0735db5e675383d338ecf0b4c8f1d414c5046ee
[moira.git] / afssync / INSTRUCTIONS
1 [This is a still-under-construction rewrite of the afssync
2 instructions, adapted to the Ingres/Maxine -> Oracle/SPARC port, and
3 is also being updated and simplified.]
4
5
6 The executables are in /moira/bin/ on the moira server, with sources
7 in /mit/moiradev/src/afssync/.  Most of the commands are run on the
8 Moira server.
9
10 FULL INSTRUCTIONS
11 ("SUMMARY" is below)
12
13 ####    Set up a workspace                                              ####
14
15 mkdir -p /moira/sync
16 cd /moira/sync
17
18 ####    This is preparation for the resync, to save non-Moira users.    ####
19 First, get a recent copy of the prdb, and extract non-Moira entries:
20
21         /moira/bin/udebug aggy -port 7002
22         rcp root@aggy:/usr/afs/db/prdb.DB0 prdb.old
23         /moira/bin/udebug aggy -port 7002
24 If the two udebugs show that the version changed, lather-rinse-repeat.
25 (udebug can be found in afsuser; "aggy" here and below is some DB server)
26 (Also check for "0 of them for write" at the end.  It might matter.)
27
28         /moira/bin/pt_util -x -m -u -g -d prdb.extra -p prdb.old
29         perl /moira/bin/pt_util.pl < prdb.extra > prdb.extra.sort
30 to extract and prepare the personal groups and special user entries in
31 the old prdb for being reincorporated into the new prdb.
32
33         awk '/^[^ ][^:]*@/ {printf "KERBEROS:%s\n",$1}' prdb.extra > foreign
34         blanche afs-foreign-users -f foreign
35 Get a list of all the @andrew.cmu.edu type (non- athena.mit.edu cell)
36 users, and sync the Moira list afs-foreign-users to this list.
37 Moira then adds those entries to the group system:afs-foreign-users,
38 thus keeping them from being lost in the prdb resync.
39
40         awk '/^[^ ][^:@]*$/ {printf "KERBEROS:%s\n",$1}' prdb.extra > oddities
41         echo "LIST:afs-foreign-users" >> oddities
42         blanche afs-odd-entities -f oddities
43 Do the equivalent of afs-foreign-users for domestic users.  We make
44 the afs-foreign-users list a member of the more general afs-odd-entities.
45 WAIT for the incremental updates from the `blanche` changes to complete.
46
47 ####   Now the actual resync begins.  Incremental updates must stop.   ####
48
49         touch /moira/afs/noafs
50 to disable AFS incremental updates during the synchronization.  The
51 afs.incr (?) will wait 30 minutes on an incremental update before
52 timing out, so the resync should complete in that time, or list
53 changes in Moira might need to be propagated by hand.
54
55         /moira/bin/afssync prdb.moira
56 to dump the prdb data that is in Moira (users, groups, and group
57 memberships).  This step takes about ten minutes, but can be done
58 concurrently with the next few steps.
59
60 REPEAT the first two sets of commands, above, thus regenerating
61 prdb.extra from a now completely-up-to-date prdb.
62
63 *** Make sure the "afssync" command has completed ***
64
65         cp prdb.moira prdb.new
66         /moira/bin/pt_util -w -d prdb.extra.sort -p prdb.new
67 This use of pt_util will presumably log errors about failed user
68 creations and list additions.  (To start over, do both the `cp` and
69 `pt_util` again.)  You can filter out the "User or group doesn't exist"
70 type of lines that were caused by a user deactivation with something
71 like:
72         awk -F\| '$8 == 3 {print $1}' /backup/backup_1/users > /tmp/deactivated
73         perl -e 'for(cat /tmp/deactivated`){ chop; $ex{$_}=1;} \
74                 foreach $L (`cat prdb.extra.err`){ $f=0; \
75                 @w=split(/[ :]/,$L); for(@w){ $f=1 if $ex{$_}; } \
76                 next if $f; print $L; }'
77 Now, back to the resync.
78
79         pts listmax > /var/prdb.listmax
80         foreach i ( <db servers> )
81             bos shutdown $i ptserver
82             bos exec $i "rm /usr/afs/db/prdb.DB*; mv /usr/afs/db/prdb.new /usr/afs/db/prdb.DB0"
83         end
84         foreach i ( <db servers> )
85             bos restart $i ptserver
86         end
87
88         /moira/bin/udebug prill -port 7002
89 to watch the status of the servers to make sure things are going well,
90 where "prill" is preferred db server (the sync site).
91
92 Make sure the beacons are working, and that once quorom is established
93 (~90 seconds) that the servers are resynchronizing their notions of
94 the databases and that the "dbcurrent" and "up" fields all become set
95 and the state goes to "1f".  Also, if "sdi" isn't running, watch out
96 for large rx packet queues on port 7002 using rxdebug, as the
97 fileservers may get excessively backlogged, and restart servers, if
98 necessary, if the congestion remains excessive.
99
100         pts listmax
101         cat /var/prdb.listmax
102 and if the id maxima are lower than the saved ones, reset them
103 appropriately to the saved ones using `pts setmax`.
104
105         pts ex system:administrators
106 as a good spot check, especially since it has special people.
107 (also spot check one of the personal groups and perhaps, something like
108 the membership of rcmd.ronald-ann)
109
110         rm /moira/afs/noafs
111 to remove the lock file and let Moira's afs incrementals continue.
112
113
114 NOTES
115
116 1. Don't do this when you're tired...  There may be no cleanup procedure
117 available, with certain mistakes.
118
119 2. /moira/afs/noafs is only good for 30 minutes.  Keep track of the
120 critical log, and you may have to do some operations by hand when the
121 operation is complete.  Also, if requests depend on other requests, they
122 may be processed out of order, and fail, and may need to be done by hand.
123
124
125 SUMMARY
126
127         # db servers with sync site first:
128 set db=(prill agamemnon chimera)
129 set u="/moira/bin/udebug -port 7002 -server"
130 set prefix="/moira/sync/prdb"
131 cd `dirname $prefix`
132
133 #######    The following DOES NOT WORK currently.  pt_util needs fixing
134 ####    BEFORE Moira and afs.incr are closed off:
135         # repeat as necessary:
136 $u $db[2]; rcp root@$db[2]\:/usr/afs/db/prdb.DB0 $prefix.old; $u $db[2]
137 /moira/bin/pt_util -x -m -u -g -d $prefix.extra -p $prefix.old
138 awk '/^[^ ][^:]*@/ {printf "KERBEROS:%s\n",$1}' $prefix.extra > extra.foreign
139 blanche afs-foreign-users -f extra.foreign
140 awk '/^[^ ][^:@]*$/ {printf "KERBEROS:%s\n",$1}' $prefix.extra > extra.domestic
141 echo "LIST:afs-foreign-users" >> extra.domestic
142 blanche afs-odd-entities -f extra.domestic
143
144 ####    WAIT for the above afs.incr events to take place (see moira.log)
145 touch /moira/afs/noafs
146 /moira/bin/afssync $prefix.moira >& $prefix.afssync.err &
147         # repeat as necessary:
148 $u $db[2]; rcp root@$db[2]\:/usr/afs/db/prdb.DB0 $prefix.old; $u $db[2]
149 /moira/bin/pt_util -x -m -u -g -d $prefix.extra -p $prefix.old
150 perl /moira/bin/pt_util.pl < $prefix.extra > $prefix.extra.sort
151 wait
152 more $prefix.afssync.err
153 cp $prefix.moira $prefix.new
154 /moira/bin/pt_util -w -d $prefix.extra.sort -p $prefix.new >& $prefix.extra.err
155         # and review $prefix.extra.err
156
157 pts listmax > $prefix.listmax
158 set dbdir=/usr/afs/db
159 foreach i ( $db )
160     echo "$i..."
161     rcp -px $prefix.new ${i}:$dbdir
162 end
163 foreach i ( $db )
164     bos shutdown $i ptserver
165     bos exec $i "rm $dbdir/prdb.DB*; mv $dbdir/prdb.new $dbdir/prdb.DB0"
166 end
167 foreach i ( $db )
168     bos restart $i ptserver
169 end
170
171         # checks, etc:
172 $u $db[1]
173
174 ######## more on checks
175
176 rm /moira/afs/noafs
This page took 0.036846 seconds and 3 git commands to generate.