| 1 | This is a how-to for installing distcc to run on a Tycoon cluster. |
|---|
| 2 | |
|---|
| 3 | distcc is a free, distributed C compiler available at distcc.samba.org. |
|---|
| 4 | |
|---|
| 5 | In this guide the "client" is the machine directing the compilation, |
|---|
| 6 | probably your local machine, and the "servers" are the machines to |
|---|
| 7 | which the jobs are distributed. Of course distcc can also use the |
|---|
| 8 | client to do some of the work. |
|---|
| 9 | |
|---|
| 10 | It is assumed that the user has established accounts on several machines and |
|---|
| 11 | has downloaded the distcc tarball from distcc.samba.org. |
|---|
| 12 | |
|---|
| 13 | This guide first shows how to install distcc on the client, then on one |
|---|
| 14 | server at a time, and finally on multiple servers at once. |
|---|
| 15 | After the installation steps is a brief guide to getting distcc up and running. |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | INSTALLATION ON CLIENT |
|---|
| 19 | |
|---|
| 20 | 1. Install gcc on client machine if you don't have it: |
|---|
| 21 | #yum -y install gcc. |
|---|
| 22 | |
|---|
| 23 | 2. Install distcc. |
|---|
| 24 | a. Unzip and untar distcc tarball. |
|---|
| 25 | b. Go into the distcc directory and install it with |
|---|
| 26 | $./configure |
|---|
| 27 | $make |
|---|
| 28 | #make install |
|---|
| 29 | |
|---|
| 30 | |
|---|
| 31 | INSTALLATION ON ONE SERVER AT A TIME |
|---|
| 32 | |
|---|
| 33 | In this section {} represents the place where you type in the IP address of |
|---|
| 34 | the server. |
|---|
| 35 | |
|---|
| 36 | 1. Run the following command to open port 3632 on the server: |
|---|
| 37 | $tycoon host bid {} 1000000000 "{ ('TCPv4Port', '3632'): 1}" |
|---|
| 38 | |
|---|
| 39 | Here {} is the IP address of the machine you will be connecting to. |
|---|
| 40 | This command is necessary to enable distcc to communicate with the server. |
|---|
| 41 | |
|---|
| 42 | 2. Install distcc on the server |
|---|
| 43 | |
|---|
| 44 | a. Copy distcc tarball to server: |
|---|
| 45 | $tycoon_scp distcc-2.18.3.tar.bz2 {}: |
|---|
| 46 | |
|---|
| 47 | Don't forget the colon at the end of the copy command. |
|---|
| 48 | |
|---|
| 49 | b. ssh into machine with |
|---|
| 50 | $tycoon_ssh {} |
|---|
| 51 | |
|---|
| 52 | c. Follow the steps above (in INSTALLATION TO CLIENT) to install distcc. |
|---|
| 53 | |
|---|
| 54 | The root password on tycoon virtual machines is rootroot. |
|---|
| 55 | |
|---|
| 56 | 3. Start the distcc daemon on the server with |
|---|
| 57 | $distccd --daemon -a {client IP address} --log-file log --log-level info |
|---|
| 58 | |
|---|
| 59 | The log file name (I used "log" above) is your choice. |
|---|
| 60 | I find that "info" is a useful log-level; for others see the man page. |
|---|
| 61 | |
|---|
| 62 | |
|---|
| 63 | INSTALLATION ON MULTIPLE SERVERS AT ONCE |
|---|
| 64 | |
|---|
| 65 | To save time you can use use vxargs to execute commands on multiple |
|---|
| 66 | remote machines at once. vxargs is a python script available online. |
|---|
| 67 | vxargs reads a text file to get the IP address of the machines to connect to. |
|---|
| 68 | This file must have the machine addresses by themselves on separate lines. |
|---|
| 69 | |
|---|
| 70 | In vxargs commands, you type in {} literally to tell vxargs where |
|---|
| 71 | to put the remote machine's IP address. This may be confusing in light of |
|---|
| 72 | my previous notation. So: you must literally include the characters "{}" in |
|---|
| 73 | a vxargs command where the IP address would normally go. |
|---|
| 74 | |
|---|
| 75 | 1. Install gcc on the servers: |
|---|
| 76 | $vxargs -a iplist.txt -o vxargs_log tycoon_ssh root@{} yum -y install gcc |
|---|
| 77 | |
|---|
| 78 | In this command "iplist.txt" is a file and "vxargs_log" a directory. |
|---|
| 79 | You do not have to use these exact names. |
|---|
| 80 | iplist.txt is the list of addresses of the remote machines (as |
|---|
| 81 | described above). |
|---|
| 82 | vxargs_log is a directory containing the log files where |
|---|
| 83 | vxargs will write the output of your commands (stdout, stdin, stderr). |
|---|
| 84 | |
|---|
| 85 | Again, you must literally include the "{}". |
|---|
| 86 | |
|---|
| 87 | 2. Open port 3632 on the servers: |
|---|
| 88 | |
|---|
| 89 | $vxargs -a iplist.txt -o vxargs_log tycoon host bid {} 1000000000 "{ ('TCPv4Port', '3632'): 1}" |
|---|
| 90 | |
|---|
| 91 | 3. Copy in the installed distcc directory from your home machine: |
|---|
| 92 | $vxargs -a iplist.txt -o vxargs_log tycoon_scp -r distcc-2.18.8 {}: |
|---|
| 93 | |
|---|
| 94 | This is far simpler than trying to install distcc directly |
|---|
| 95 | on each server using vxargs. There is a technical difficulty with the |
|---|
| 96 | command syntax of tycoon_ssh which makes a remote distcc install difficult. |
|---|
| 97 | Using ssh -p 47277 instead of tycoon_ssh in the remote install is possible |
|---|
| 98 | but you would have to establish all the servers as known hosts before |
|---|
| 99 | running vxargs because you can't input while vxargs is running. |
|---|
| 100 | |
|---|
| 101 | 4. Start the distcc daemon on the servers: |
|---|
| 102 | |
|---|
| 103 | $vxargs -a iplist.txt -o vxargs_log tycoon_ssh {} ./distcc-2.18.8/distccd --daemon -a {client IP address} --log-file log --log-level info |
|---|
| 104 | |
|---|
| 105 | Because distcc was not directly installed, the path will not be updated |
|---|
| 106 | on the servers and you have to include the path in the command |
|---|
| 107 | to start the daemon. |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | RUNNING DISTCC |
|---|
| 111 | |
|---|
| 112 | This is a brief guide to how to issue a distcc command. For more information |
|---|
| 113 | see the man page. |
|---|
| 114 | |
|---|
| 115 | Once distcc is installed on the client and servers, you have opened port |
|---|
| 116 | 3632 on the servers and started the daemons there, there is one thing left |
|---|
| 117 | to do. On the client, do an |
|---|
| 118 | |
|---|
| 119 | $export DISTCC_HOSTS='{server 1 IP address} {server 2 IP address} ...' |
|---|
| 120 | |
|---|
| 121 | This variable tells distcc where to send the jobs. You can include |
|---|
| 122 | "localhost" in this list and jobs will be compiled on the client too. |
|---|
| 123 | The order of the servers in the DISTCC_HOSTS variable determines the |
|---|
| 124 | priority, so put the fastest machines first for best results. |
|---|
| 125 | |
|---|
| 126 | The man pages include a list of other options for this command, as well |
|---|
| 127 | as other shell variables distcc can use. |
|---|
| 128 | |
|---|
| 129 | |
|---|
| 130 | Finally, to compile using distcc, just type |
|---|
| 131 | |
|---|
| 132 | $make -j # CC=distcc {whatever}. |
|---|
| 133 | |
|---|
| 134 | Here # indicates the number of jobs to run at once. This must be |
|---|
| 135 | at least as large as the number of servers if you want to use them all. |
|---|
| 136 | You can experiment with increasing this number, which may |
|---|
| 137 | improve the performance. |
|---|
| 138 | |
|---|
| 139 | There are other ways to send the make command to distcc; |
|---|
| 140 | for example, you can set distcc to be the default compiler. See man pages. |
|---|