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