Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1171589
  • 博文数量: 312
  • 博客积分: 12522
  • 博客等级: 上将
  • 技术积分: 3376
  • 用 户 组: 普通用户
  • 注册时间: 2008-02-27 18:35
文章分类

全部博文(312)

文章存档

2016年(3)

2015年(1)

2013年(1)

2012年(28)

2011年(101)

2010年(72)

2009年(13)

2008年(93)

分类: IT业界

2009-05-11 12:16:44

Exercise 1 Solution
starting
 
Steps
Comments
1.    Look at the file /var/adm/rational/clearcase/config/shipping.conf on lab host. Make sure there is a line specifying the administrator who will receive e-mail notification. Add your login-id if you are not listed as an Administrator.
(you must be root to modify this file)
2.    (Optional) Set up aliases for the following ClearCase and MultiSite commands in your shell startup scripts: (.cshrc/.profile).
 
 
ct
cleartool
cth
cleartool history
m
multitool
mke
multitool mkreplica -export
mki
multitool mkreplica -import
mse
multitool syncreplica -export
msi
multitool syncreplica -import
 

1.    As you proceed through the exercises, fill in the table below to keep track of your replicas and their corresponding VOB-tags and storage locations:
 
replica Name
VOB-tag Directory
VOB Storage Location
GROUP_usa
/tmp/GROUP_usa
~/GROUP_usa.vbs
GROUP_europe
/tmp/GROUP_europe
~/GROUP_europe.vbs
GROUP_asia
/tmp/GROUP_asia
~/GROUP_asia.vbs
 
2.    Make a VOB according to the following specifications:
  • VOB-tag: /tmp/GROUP_usa
·         VOB storage: /GROUP_usa.vbs
cleartool mkvob -tag /tmp/GROUP_usa ~/GROUP_usa.vbs
3.    Create the mount point (==VOB-tag) for this original replica.
mkdir /tmp/GROUP_usa
4.    Mount the GROUP_usa replica and cd to the VOB mount point.
cleartool mount /tmp/GROUP_usa
cd /tmp/GROUP_usa
5.    Use lsreplica to list the current replicas.
ls
6.    Make a replica of GROUP_usa using the following specifications:
  • Working directory: /tmp/GROUP_work_dir
  • Replica hostname: LAB host
  • Replica name: GROUP_Europe
  • Use –fship to send the packet immediately
multitool mkreplica -export -workdir /tmp/GROUP_work_dir -fship
   host2:GROUP_europe
7.    Make a view according to the following specifications:
  • View-tag: GROUP_usa_view
·         View storage: /GROUP_usa_view.vws
cleartool mkview -tag GROUP_usa_view ~/GROUP_usa_view.vws
8.    Set to the new view.
cleartool setview GROUP_usa_view
9.    Do a directory listing to ensure that you are in the VOB. (You should see only a lost+found directory.)
ls
10.Check out the current directory.
cleartool co -nc .
11.Make an element called hello.c and check out the first version of the file. Create some content for the file (type in a few lines).
cleartool mkelem -c "element of type file " hello.c
vi hello.c
12.When you are done, check in hello.c.
cleartool ci -c "initial version of element" hello.c
13.Check in the directory.
cleartool ci -nc .
14.Use lsreplica to see the current replicas.
multitool lsreplica
15.Rename the original replica to: GROUP_usa.
multitool rename replica:original GROUP_usa
16.List the replicas that your current VOB knows about.
multitool lsreplica
17.Open a second shell. Move the window to an area on your desktop so that both displays are easily accessible.
18.In the second shell, use lspacket to list any incoming packets in the storage bays. 
rlogin host2 -l login_id (same login_id you used on host1)
multitool lspacket
19.Import the replication packet you created in Step 6, using mkreplica -import according to the following specifications:
  • Working directory: /tmp/GROUP_work_dir
  • VOB-tag: /tmp/GROUP_europe
  • VOB storage directory: /GROUP_europe.vbs
Create the replica as ownership-preserving
multitool mkreplica -import -workdir /tmp/GROUP_work_dir -tag /tmp/GROUP_europe -vob ~/GROUP_europe.vbs -preserve /opt/rational/clearcase/shipping/ms_ship/incoming/repl_original......
20.Create the VOB mount point and mount the GROUP_europe replica.
mkdir /tmp/GROUP_europe
cleartool mount /tmp/GROUP_europe
21.Make a view called GROUP_Europe_view with storage at /GROUP_europe_view.vws.
cleartool mkview -tag GROUP_europe_view /home/host2/GROUP_europe_view.vws
22.Set into the view in the Europe shell and cd to the VOB mount point. Do a directory listing to make sure you are in the VOB. Why don't you see the hello.c file that you created in the original replica?
cleartool setview GROUP_europe_view
cd /tmp/GROUP_europe
ls 
(hello.c was created at the originating VOB after the initial update packet was sent)
23.Make a branch type called europe_branch.
cleartool mkbrtype -c "branch for europe development" europe_branch
24.Set up your configuration specification to isolate your work to the europe_branch or to make branches of the type europe_branch.
cleartool edcs
element * CHECKEDOUT
element * .../europe_branch/LATEST
element * /main/LATEST -mkbranch europe_branch
25.Do a directory listing using cleartool ls to make sure your new rules are in effect.
cleartool ls
Set to the GROUP_usa_view
26.Create an update packet to send to your second replica (GROUP_europe). Use -fship to ship the packet immediately.
multitool syncreplica -export -fship GROUP_europe
Set to the GROUP_europe_view
27.At the second replica (GROUP_europe) do a directory listing of the incoming storage subdirectory /opt/rational/clearcase/shipping/ms_ship/incoming. Did the update packet arrive successfully? Note the other packet that is listed.
ls /opt/rational/clearcase/shipping/ms_ship/incoming
28.Use syncreplica to import the update packet, specifying -receive (to scan the storage bays immediately).
multitool syncreplica -import -receive
29.Do another directory listing of the storage subdirectory. Note that MultiSite deletes update packets as they are applied. Replica-creation packets are not automatically applied and must be manually deleted once you have created/imported the replica.
ls /opt/rational/clearcase/shipping/ms_ship/incoming
30.Delete the replica-creation packet for the replica you imported in Step 19.
rm /opt/rational/clearcase/shipping/ms_ship/incoming/repl_original
31.Do a directory listing in your VOB (/tmp/GROUP_europe). Is hello.c there?
ls
32.Check out hello.c. What version is checked out?
cleartool co -nc hello.c
(/main/second_branch/0 is checked out)
33.Edit hello.c and check it back in.
vi hello.c
cleartool ci -c "added code from second branch" hello.c
34.Export this change to your GROUP_usa replica using syncreplica and the -fship option.
multitool syncreplica -export -fship GROUP_usa
Set to the GROUP_usa_view
35.Import the updates specifically to GROUP_usa, using the -receive and -invob options.
multitool syncreplica -import –invob /tmp/GROUP_usa -receive
36.Use lsvtree to examine the branch structure for hello.c.
cleartool lsvtree -graphical hello.c
37.Check out hello.c from the main branch.
cleartool co -nc hello.c
38.Merge from hello.c@@/main/europe_branch/LATEST to the hello.c@@/main/LATEST version using cleartool merge -to hello.c -ver main/europe_branch/LATEST. Examine the results.
cleartool merge -to hello.c -ver /main/europe_branch/LATEST
39.Check in hello.c.
cleartool ci -c "merged code from europe branch" hello.c
40.Do a cleartool lsvtree -graphical on hello.c to show the versions added and the merge hyperlinks.
cleartool lsvtree -graphical hello.c
41.Export these changes to your GROUP_europe replica, using -fship.
multitool syncreplica -export -fship GROUP_europe
Set to the GROUP_europe_view
42.Import updates to GROUP_europe, using the -receive option.
multitool syncreplica -import –receive
 
Object Mastership
Set to the GROUP_usa_view
1.    Make a label type called LABEL1
cleartool mklbtype -c "Release 1 Label" LABEL1
2.    Using cleartool or multitool describe, get a long description of the label type. How is it mastered?
cleartool describe -l lbtype:LABEL1
(The label is mastered by replica GROUP_usa.)
3.    Export the updates to your GROUP_europe replica.
multitool syncreplica -export -fship GROUP_europe
Set to the GROUP_europe_view
4.    List the label types declared in the VOB.
cleartool lstype -kind lbtype
5.    Import the update packet, using the -receive option.
multitool syncreplica -import -receive
6.    List the label types now declared in the VOB.
cleartool lstype -kind lbtype
7.    Apply LABEL1 to a version of hello.c. (cleartool mklabel LABEL1 hello.c). What happens?
cleartool mklabel LABEL1 hello.c
(You are unable to add this label because replica GROUP_usa is master of LABEL1.)
Set to the GROUP_usa_view
8.    At the GROUP_usa replica use chmaster to transfer mastership of label type LABEL1 to your GROUP_europe replica.
multitool chmaster GROUP_europe lbtype:LABEL1
9.    Export the updates to your GROUP_europe replica.
multitool syncreplica -export -fship GROUP_europe
10.Get long description of LABEL1.
cleartool describe –long lbtype:LABEL1
(LABEL1 is now mastered by GROUP_Europe)
Set to the GROUP_europe_view
11.Import the update. Use the -receive option.
multitool syncreplica -import -receive
12.Get a long description of the label type LABEL1. Where is it mastered now?
cleartool describe -l lbtype:LABEL1
(Mastership now belongs to the GROUP_europe replica.)
13.Apply LABEL1 to a version of hello.c.
cleartool mklabel LABEL1 hello.c
Set to the GROUP_usa_view
14.At the GROUP_usa replica, make a label type, LABEL2 with the following specifications:
·         Make it shared
·         Allow it to be used once-per-branch
cleartool mklbtype -shared -pbranch -c "Label for Release 2" \ LABEL2
15.Export the update to the GROUP_europe replica.
multitool syncreplica -export -fship GROUP_europe
Set to the GROUP_europe_view
16.At your GROUP_europe replica, import the update packet using the -receive option.
multitool syncreplica -import -receive
17.List the label types in the VOB.
cleartool lstype -kind lbtype
18.Apply LABEL2 to hello.c@@/main/LATEST. What happens? Why?
cleartool mklabel LABEL2 hello.c@@/main/LATEST
(You are unable to add label because replica GROUP_usa is master of the main branch)
19.Apply LABEL2 to hello.c@@/main/europe_branch/LATEST. What happens? Why?
cleartool mklabel LABEL2 hello.c@@/main/europe_branch/LATEST
(This branch is owned by replica GROUP_europe and the label is shared, allowing this replica to use it.)
Set to the GROUP_usa_view
20.At the GROUP_usa replica, apply LABEL2 to hello.c@@/main/LATEST.
cleartool mklabel LABEL2 hello.c@@/main/LATEST
21.Open a graphical version tree browser on hello.c. Why doesn't the LABEL2 show up on "europe_branch"?
cleartool lsvtree -graphical hello.c
(The label doesn't show up on europe_branch because you haven't received the last    update packet from the GROUP_europe replica.)
Set to the GROUP_europe_view
22.You next want to inform GROUP_usa about the changes that you've made in GROUP_europe.  From your GROUP_europe replica, export an update packet to GROUP_usa replica.
multitool syncreplica -export -fship GROUP_usa
Set to the GROUP_usa_view
23.At GROUP_usa replica, import the update packet.
multitool syncreplica -import -receive
24.Open a graphical Version Tree Browser on hello.c again. Does the label show up now?
cleartool lsvtree –graphical hello.c
(Yes. The update packet was successfully received.)
25.Create a label type LABEL3.
cleartool mklbtype -c "Label for Release 3" LABEL3
26.Attach the label LABEL3 to hello.c@@/main/LATEST. Export an update packet to your GROUP_europe replica.
cleartool mklabel LABEL3 hello.c@@/main/LATEST
multitool syncreplica -export -fship GROUP_europe
Set to the GROUP_europe_view
27.At the GROUP_europe replica, create a label type LABEL3
cleartool mklbtype –c "Release 3 for Second" LABEL3
(MultiSite warns about a name conflict.)
28.Attach LABEL3 to some version of hello.c on the europe_branch.
cleartool mklabel LABEL3 hello.c
29.Import your update packet. What happens?
multitool syncreplica -import -receive
30.List all label types that are now defined in this replica.
cleartool lstype -l -kind lbtype
31.Export an update packet back to the GROUP_usa replica.
multitool syncreplica -export -fship GROUP_usa
Set to the GROUP_usa_view
32.At GROUP_usa replica, import the update packet using the -receive option. What happens?
multitool syncreplica -import -receive
(MultiSite warns about a name conflict.)
33.List all label types that are now defined in this replica.
cleartool lstype -kind lbtype
34.Is LABEL3 the same type declaration in both VOBs?
No. Both replicas have definitions of LABEL3, but the definitions are not the same.
35.Now fix it. Rename LABEL3. Call it FIRST_LABEL3.  Export your change to the GROUP_europe replica.
cleartool rename lbtype:LABEL3 FIRST_LABEL3
multitool syncreplica -export -fship GROUP_europe
Set to the GROUP_europe_view
36.Import the update.
multitool syncreplica -import -receive
37.Open a cleartool lsvtree -graphical on hello.c. How does the old LABEL3 on /main/LATEST look?
cleartool lsvtree hello.c
Exercise 2 Solution
Store-and-Forward Facility
 
Set to the GROUP_usa_view
 
1.    At your GROUP_usa replica, create a label type called LABEL4.
cd /tmp/GROUP_usa
cleartool mklbtype -c "Label for Release 4" LABEL4
 
2.    Attach a label of the type LABEL4 to hello.c@@/main/LATEST.
cleartool mklabel LABEL4 hello.c@@/main/LATEST
 
3.    Export the update to your GROUP_europe replica.
multitool syncreplica -export -fship GROUP_europe
 
Set to the GROUP_europe_view
 
4.    Import the update packet.
multitool syncreplica -import -receive
 
5.    Use lsreplica to display a list of replicas, specifying the -long option to show more detail.
cd /tmp/GROUP_europe
multitool lsreplica -l
 
6.    List the history of the GROUP_europe replica to show imports.
cleartool lshistory replica:GROUP_europe
 
7.    Use describe replica:GROUP_europe to see how replica information is reported.
cleartool describe replica:GROUP_europe
 
8.    Use describe vob:vob-tag to show VOB information.
cleartool describe vob:/tmp/GROUP_europe
 
9.    Use describe on element hello.c to see metadata information.
cleartool describe -l hello.c
 
10.Create an attribute called bugnum whose valid values are integers.
cleartool mkattype -c "attribute to hold bug number" -vtype integer bugnum
 
11.Create an update packet, using the -out option to place the packet in a file in your home directory: ~/GROUP_packet
multitool syncreplica -export -out ~/GROUP_packet GROUP_usa
 
12.Use lspacket to show information about the packet, specifying the -long option to show more detail.
multitool lspacket -l
 
13.Use mkorder to create a shipping order for ~/GROUP_packet.
  • The packet is being sent to the PRIMARY host
  • Use the -ship option, placing the shipping order in the outgoing storage bay
Use the -copy option.
/opt/rational/clearcase/etc/mkorder -data ~/GROUP_packet -ship -copy host1
 
14.Ship the packet to the GROUP_usa replica.
/opt/rational/clearcase/etc/shipping_server -poll
 
Set to the GROUP_usa_view
 
15.At the GROUP_usa replica, import the update, specifying the packet file.
multitool syncreplica -import
/opt/rational/clearcase/shipping/ms_ship/incoming/GROUP_packet
 
16.List the attribute type created at the GROUP_europe replica.
cleartool lstype -kind attype
 
17.Create a text file in your home directory called status_report.
touch ~/status_report
 
18.Create a custom shipping order that immediately sends a copy of the status report to GROUP_europe_view.
/opt/rational/clearcase/etc/mkorder -data ~/status_report -fship -copy host2
 
Set to the GROUP_europe_view
 
19.Check the default storage bays to make sure the status report arrived. If you do not know where the default storage bays are, look for that information in the shipping config file in: /var/adm/rational/clearcase/config/shipping.conf
ls /opt/rational/clearcase/shipping/ms_ship/incoming
cat /var/adm/rational/clearcase/config/shipping.conf
 Exercise 3 Solution
Recovering Lost Packets
 
Set to the GROUP_europe_view
 
1.    At your second replica, list the epoch numbers for the replica. These numbers represent operations seen from GROUP_europe’s point of view. Write those numbers in the following table:
multitool lsepoch
 
 
VOB operations originating at GROUP_usa
VOB operations originating at GROUP_europe
GROUP_europe’s record of its own state
19
9
GROUP_europe’s estimate of GROUP_usa's state
19
9
 
 
 
Set to the GROUP_usa_view
 
2.    At the GROUP_usa replica, from its point of view, list the epoch numbers for the GROUP_usa and second replicas. Are they the same as in step 1?
multitool lsepoch
(The epoch numbers between replicas are currently in sync.)
 
3.    Create a branch type called branch_test.
cleartool mkbrtype -c "branch for testing" branch_test
 
4.    Export the update to GROUP_europe replica. Use the -out option to put the packet in a file in your home directory: ~/GROUP_packet2.
multitool syncreplica -export -out ~/GROUP_packet2 GROUP_europe
 
5.    Now list the epoch numbers for the GROUP_usa VOB. What happened?
multitool lsepoch
(The epoch numbers have changed to reflect the export of the latest update packet.)
 

 
 
VOB operations
originating at
GROUP_usa
VOB operations
originating at
GROUP_europe
GROUP_usa’s record of its own state
 
 
GROUP_usa’s estimate of GROUP_europe's state
 
 
 
 
6.    To simulate a packet getting lost in transit, remove the packet.
~/GROUP_packet2.
rm -rf ~/GROUP_packet2
 
Set to the GROUP_europe_view
 
7.    List the epoch numbers to see the status of the GROUP_europe replica. Since no updates have been applied, these should be the same as seen in your table above. These numbers will be used to "turn back the clock" in GROUP_usa replica.
multitool lsepoch
 
Set to the GROUP_usa_view
 
8.    Using the output from the previous step, change the epoch numbers in the GROUP_usa replica.
multitool chepoch GROUP_europe GROUP_usa=19
 
9.    Confirm the change by listing the epoch table again.
multitool lsepoch
 
10.Export the update to GROUP_europe, using the -fship option.
multitool syncreplica -export -fship GROUP_europe
 
Set to the GROUP_europe_view
 
11.Import and apply the update packet to GROUP_europe.
multitool syncreplica -import -receive
 
12.List the branch types to make sure that your earlier change has been propagated to this replica.
cleartool lstype -kind brtype
 
13.The epoch tables in both replicas should match. Do they?
multitool lsepoch (Yes. The epoch numbers are now in sync.)
Exercise 4 Solution
Managing Replicas
 
Set to the GROUP_usa_view
 
1.    Make a third replica according to the following specifications:
·         Working directory: /tmp/work_dir
·         Replica host: lab host machine
·         Replica name: GROUP_asia
·         Create with the -fship option
Note: Creating multiple replicas in the same region is not a recommended practice and is used only for the purposes of these exercises.
multitool mkreplica -export -workdir /tmp/work_dir -fship host1:GROUP_asia
 
2.    Use lsreplica to confirm the creation of the new replica.
multitool lsreplica
 
3.    To inform the GROUP_europe replica that the GROUP_asia replica has been created, export the update packet to the GROUP_europe replica using the
-fship option.
multitool syncreplica -export -fship GROUP_Europe
 
Set to the GROUP_europe_view
 
4.    At your second replica, use lsreplica to see which replicas it knows about.
multitool lsreplica
 
5.    Import the synchronization update using -receive option.
multitool syncreplica –import -receive
 
6.    Confirm the existence of the GROUP_asia replica using lsreplica.
multitool lsreplica
 
Set to the GROUP_usa_view
 
7.    Although you exported the VOB in step 1, you still need to create the GROUP_asia replica. Process the incoming packets.
multitool syncreplica -import -receive
 
8.    Invoke mail to read the message indicating where the packet resides. (Remember, replica-creation packets must be processed manually).
Invoke mail server(Packet is in /opt/rational/clearcase/shipping/ms_ship/incoming)
 
9.    Use lsreplica to confirm the creation of the new replica.
multitool lsreplica
 
10.Using the packet that has arrived, create this replica according to the following specifications:
·         Working directory: /tmp/work_dir
·         VOB-tag: /tmp/GROUP_asia
·         VOB storage directory: ~/GROUP_asia.vbs
Create as an ownership-preserving replica
multitool mkreplica -import -workdir /tmp/work_dir –tag \ /tmp/GROUP_asia -vob ~/GROUP_asia.vbs –preserve \
/opt/rational/clearcase/shipping/ms_ship/incoming/repl_GROUP_usa*
 
11.Create the VOB mount point and mount the GROUP_asia replica.
mkdir /tmp/GROUP_asia
cleartool mount /tmp/GROUP_asia
 
12.Delete the replication packet from the storage bay.
rm -rf /opt/rational/clearcase/shipping/ms_ship/incoming/repl_GROUP_usa*
 
Set to the GROUP_europe_view
 
Back up your replica—
 
13. to the directory that holds the VOB physical storage. If you have forgotten where the physical storage for this VOB is located, use cleartool describe vob: or lsvob.cd
cleartool describe vob:/tmp/GROUP_europe
cd ~
 
14.Back up the GROUP_europe replica to a backup file, using tar, for example:
tar -cvpf vob_backup GROUP_europe.vbs
 
Modify the replica—
 
15.cd back into your VOB mount point (/tmp/GROUP_europe) and create a new label type called AFTERBACKUP.
cd /tmp/GROUP_europe
cleartool mklbtype -nc AFTERBACKUP
 
16.Export the update to GROUP_usa, using the -fship option.
multitool syncreplica -export -fship GROUP_usa GROUP_asia
 
Set to the GROUP_usa_view
 
17.Import the update packet to GROUP_usa and GROUP_asia.
multitool syncreplica -import -receive
(Packet is applied to both first and third replicas.)
 
18.cd to /tmp/GROUP_usa. List the label types to make sure the change was propagated.
cleartool lstype -kind lbtype
 
Set to the GROUP_europe_view
 
Simulate a crash and restore at the GROUP_europe replica:
 
su to root
 
19.Find and kill the GROUP_europe replica’s server process.
ps -ef | grep GROUP_europe.vbs
kill ....
 
20.cdto ~and move the VOB physical storage area from ~/GROUP_europe.vbs to ~/GROUP_europe.vbs.moved
cd ~
mv ~/GROUP_europe.vbs ~/GROUP_europe.vbs.moved
 
管理员在2009年8月13日编辑了该文章文章。 -->
阅读(1322) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~