Project

General

Profile

NetDRMS Installation » History » Version 339

Pablo Alingery, 15/06/2016 15:54

1 50 Herve Ballans
{{toc}}
2 1 Herve Ballans
3 322 Pablo Alingery
h1. NetDRMS 8.11 Installation
4 1 Herve Ballans
5 276 Herve Ballans
h2. Preliminary note
6 275 Herve Ballans
7 275 Herve Ballans
In the following sections, when there is a command line :
8 324 Herve Ballans
<pre>#</pre>means that command is executed into _root_ user
9 324 Herve Ballans
<pre>$</pre>means that command is executed into _production_ user
10 275 Herve Ballans
11 333 Herve Ballans
h2. Environment
12 333 Herve Ballans
13 1 Herve Ballans
h2. Requirements
14 1 Herve Ballans
15 47 Pablo Alingery
h3. Configuring production environment
16 1 Herve Ballans
17 284 Herve Ballans
Adding user production
18 47 Pablo Alingery
19 1 Herve Ballans
<pre>
20 1 Herve Ballans
# adduser production
21 1 Herve Ballans
# addgroup ias
22 1 Herve Ballans
# adduser production ias
23 1 Herve Ballans
</pre>
24 1 Herve Ballans
25 49 Herve Ballans
h3. Configure /home/production/.profile
26 1 Herve Ballans
27 49 Herve Ballans
Adding environment variables
28 1 Herve Ballans
29 1 Herve Ballans
<pre>
30 122 Herve Ballans
#Modif Herve.B Pablo.A 12/05/2016
31 122 Herve Ballans
32 1 Herve Ballans
PATH="/usr/local/netdrms_current/bin/linux_x86_64:$PATH"
33 49 Herve Ballans
PATH="/usr/local/netdrms_current/scripts:$PATH"
34 122 Herve Ballans
PATH="/usr/local/jmd/bin:$PATH"
35 122 Herve Ballans
PATH="/usr/local/jmd/scripts:$PATH"
36 141 Pablo Alingery
#The following is not needed as installed with 'apt-get install' 
37 141 Pablo Alingery
#PATH="/usr/local/pgsql/bin:$PATH"
38 122 Herve Ballans
PATH="/usr/local/netdrms-tools/scripts:$PATH"
39 49 Herve Ballans
#2014-12-17 Avec Herve et Pablo on pense que la ligne suivante est intutile as it is f.. install in /usr/local/lib
40 140 Pablo Alingery
PATH="/usr/local/cfitsio:$PATH"
41 1 Herve Ballans
#Done
42 49 Herve Ballans
43 122 Herve Ballans
DERBY_HOME=/usr/local/jmd/databases/derby/derbyBD
44 49 Herve Ballans
export DERBY_HOME
45 49 Herve Ballans
46 49 Herve Ballans
export CVSROOT=:pserver:anonymous@solarch.tuc.noao.edu:2401/vtarc1/vso/cvsroot
47 49 Herve Ballans
</pre>
48 49 Herve Ballans
49 162 Pablo Alingery
h3. Configure /varl/lib/postgres/.profile
50 161 Pablo Alingery
51 163 Pablo Alingery
Add to $PATH so postgres can exeute command like initdb
52 161 Pablo Alingery
53 161 Pablo Alingery
<pre>
54 161 Pablo Alingery
#Modif Herve.B Pablo.A 19/05/2016
55 161 Pablo Alingery
PATH="/usr/lib/postgresql/9.4/bin:$PATH"
56 161 Pablo Alingery
</pre>
57 161 Pablo Alingery
58 125 Pablo Alingery
h3. Setting privileges for SUMS_MANAGER
59 87 Herve Ballans
60 126 Pablo Alingery
Please modify file /etc/sudoers so user 'production' will be able to execute  'sum_chown' that we will locate in the dir : /usr/local/bin . See below
61 125 Pablo Alingery
Add to /etc/sudoers the following line :
62 1 Herve Ballans
	production host=NOPASSWD:/usr/local/bin/sum_chmown
63 1 Herve Ballans
64 127 Pablo Alingery
h3. Set passwords file for db postgres 
65 1 Herve Ballans
66 127 Pablo Alingery
Please create file .pgpass with the following information for user 'production" so he will be able to connect without password as 'production' or 'postgres' to 2 db that we will create later ias_sdo and ias_sdo_sums.
67 1 Herve Ballans
68 1 Herve Ballans
69 1 Herve Ballans
.pgpass content :
70 1 Herve Ballans
<pre>
71 128 Pablo Alingery
	#hostname:5432:ias_sdo:production: 
72 128 Pablo Alingery
	#hostname:5434:ias_sdo_sums:production: 
73 128 Pablo Alingery
	#hostname:5432:ias_sdo:postgres: 
74 128 Pablo Alingery
	#hostname:5434:ias_sdo_sums:postgres
75 1 Herve Ballans
</pre>
76 128 Pablo Alingery
77 129 Pablo Alingery
where #hostname is the name of your server
78 129 Pablo Alingery
79 129 Pablo Alingery
80 131 Pablo Alingery
%{color:red}WARNING : change hostname when migrate sdo-new to sdo%
81 1 Herve Ballans
82 133 Pablo Alingery
h3. Install missing libraries 
83 1 Herve Ballans
84 293 Herve Ballans
* libreadline-dev (but already installed with postgresql)
85 293 Herve Ballans
* libssl-dev 
86 293 Herve Ballans
* libpam0g-dev 
87 293 Herve Ballans
* libperl-dev 
88 293 Herve Ballans
* libnet-ssh-perl
89 293 Herve Ballans
* libstring-shellquote-perl
90 296 Herve Ballans
* libdbi-perl 
91 296 Herve Ballans
* libdbd-pg-perl
92 1 Herve Ballans
93 133 Pablo Alingery
NB : Already done in Debian 8.4 Jessy
94 1 Herve Ballans
<pre>
95 1 Herve Ballans
# apt-get install $library_name
96 1 Herve Ballans
</pre> 
97 1 Herve Ballans
where
98 1 Herve Ballans
	_$library_name_ is the name of library
99 19 Pablo Alingery
100 1 Herve Ballans
Then to update path on libraries, please type :
101 1 Herve Ballans
<pre>
102 19 Pablo Alingery
# ldconfig
103 1 Herve Ballans
</pre>
104 1 Herve Ballans
105 1 Herve Ballans
h3. Reconfigure locale
106 1 Herve Ballans
107 1 Herve Ballans
<pre>
108 1 Herve Ballans
# dpkg-reconfigure locales
109 1 Herve Ballans
</pre>
110 1 Herve Ballans
111 1 Herve Ballans
select fr_FR.UTF8 UTF8 and unselect en_US.UTF-8
112 1 Herve Ballans
113 1 Herve Ballans
localedef -i en_US -f UTF-8 en_US.UTF-8
114 1 Herve Ballans
115 1 Herve Ballans
(see here : [[http://www.thomas-krenn.com/en/wiki/Perl_warning_Setting_locale_failed_in_Debian]])
116 1 Herve Ballans
117 134 Pablo Alingery
h3. Install gfortran packages
118 1 Herve Ballans
119 1 Herve Ballans
<pre>
120 1 Herve Ballans
# apt-get install gfortran swig
121 1 Herve Ballans
</pre>
122 1 Herve Ballans
123 1 Herve Ballans
h3. Installation of cfitsio library
124 1 Herve Ballans
125 135 Pablo Alingery
In /usr/local dir
126 135 Pablo Alingery
127 135 Pablo Alingery
Version 3.39 (currently on sdo : 3.24)
128 1 Herve Ballans
<pre>
129 135 Pablo Alingery
# wget ftp://heasarc.gsfc.nasa.gov/software/fitsio/c/cfitsio3390.tar.gz
130 1 Herve Ballans
</pre>
131 137 Pablo Alingery
Untar and  decompression
132 1 Herve Ballans
<pre>
133 136 Pablo Alingery
# tar -xzvf cfitsio3390.tar.gz
134 1 Herve Ballans
</pre> 
135 1 Herve Ballans
136 139 Pablo Alingery
Go into /usr/local and type
137 1 Herve Ballans
138 1 Herve Ballans
su - root and :
139 1 Herve Ballans
<pre>
140 1 Herve Ballans
# ./configure --prefix=/usr/local
141 1 Herve Ballans
# make 
142 1 Herve Ballans
# make install
143 135 Pablo Alingery
</pre>
144 118 Pablo Alingery
145 237 Herve Ballans
h3. Installation des libraries libtar-dev, libcurl3-dev et libecpg-dev
146 237 Herve Ballans
147 237 Herve Ballans
<pre>
148 237 Herve Ballans
apt-get install libtar libtar-dev
149 237 Herve Ballans
</pre>
150 237 Herve Ballans
151 238 Pablo Alingery
Note, selecting 'libcurl4-openssl-dev' instead of 'libcurl3-dev'
152 238 Pablo Alingery
libcurl4-openssl-dev is already the newest version
153 237 Herve Ballans
<pre>
154 237 Herve Ballans
apt-get install libcurl3-dev
155 237 Herve Ballans
</pre>
156 237 Herve Ballans
157 237 Herve Ballans
<pre>
158 237 Herve Ballans
apt-get install libecpg-dev
159 237 Herve Ballans
</pre>
160 237 Herve Ballans
161 144 Pablo Alingery
h3. Installation of apache2 and lib perl
162 118 Pablo Alingery
163 118 Pablo Alingery
<pre>
164 118 Pablo Alingery
# apt-get install apache2
165 118 Pablo Alingery
166 118 Pablo Alingery
# apt-get install libjson-perl
167 118 Pablo Alingery
168 118 Pablo Alingery
# apt-get install libapache2-mod-perl2
169 118 Pablo Alingery
</pre>
170 1 Herve Ballans
171 183 Herve Ballans
h3. Installation of postgresql
172 1 Herve Ballans
173 145 Pablo Alingery
Into 'root'
174 145 Pablo Alingery
 
175 145 Pablo Alingery
<pre>
176 147 Pablo Alingery
apt-get install postgresql-9.4 postgresql-client-9.4 
177 145 Pablo Alingery
</pre>
178 145 Pablo Alingery
179 213 Herve Ballans
h3. Installation of python3
180 209 Pablo Alingery
181 209 Pablo Alingery
Into 'root'
182 209 Pablo Alingery
 
183 209 Pablo Alingery
<pre>
184 209 Pablo Alingery
apt-get install python3 
185 1 Herve Ballans
</pre>
186 210 Pablo Alingery
187 211 Pablo Alingery
Add some modules psycopg2 (postgres connector) and pySmartDL (Download manager) 
188 210 Pablo Alingery
189 210 Pablo Alingery
<pre>
190 210 Pablo Alingery
apt-get install python3-psycopg2
191 210 Pablo Alingery
</pre>
192 210 Pablo Alingery
193 210 Pablo Alingery
<pre>
194 210 Pablo Alingery
apt-get install python3-psycopg2
195 210 Pablo Alingery
</pre>
196 210 Pablo Alingery
197 210 Pablo Alingery
Add python3-pip for modules within python3
198 210 Pablo Alingery
199 210 Pablo Alingery
<pre>
200 210 Pablo Alingery
apt-get install python3-pip
201 1 Herve Ballans
</pre>
202 212 Pablo Alingery
203 212 Pablo Alingery
<pre>
204 212 Pablo Alingery
pip3 install pySmartDL
205 212 Pablo Alingery
</pre>
206 1 Herve Ballans
207 213 Herve Ballans
Both python2.7 and 3.4 versions are installed on the system.
208 213 Herve Ballans
By default, the python2.7 is used.
209 213 Herve Ballans
In order to change in 3.4 by default, type :
210 213 Herve Ballans
<pre>
211 213 Herve Ballans
update-alternatives --config python
212 213 Herve Ballans
</pre>
213 209 Pablo Alingery
214 1 Herve Ballans
h3. Installation of sdo_scripts
215 218 Pablo Alingery
216 219 Pablo Alingery
Install monitoring scripts for sdo
217 218 Pablo Alingery
218 218 Pablo Alingery
<pre>
219 268 Pablo Alingery
rsync -av scripts production@sdo-new:/home/production/netdrms-tools/
220 218 Pablo Alingery
</pre>
221 218 Pablo Alingery
222 1 Herve Ballans
h2. NetDRMS databases
223 1 Herve Ballans
224 156 Pablo Alingery
into /var/lib/postgresql  (hard mount point separated,  7 disks 15000 tr/min in raid5 in order to distribute read and write) 
225 1 Herve Ballans
226 1 Herve Ballans
<pre>
227 158 Pablo Alingery
# cd /var/lib/postgresql
228 157 Pablo Alingery
# mkdir data  data_sums data_monitor
229 157 Pablo Alingery
# chown -R postgres:postgres * 
230 1 Herve Ballans
</pre>
231 1 Herve Ballans
232 160 Pablo Alingery
h3. Initialize 3 servers data,  data_sums, data_monitor
233 1 Herve Ballans
234 159 Pablo Alingery
Into postgres
235 1 Herve Ballans
<pre>
236 1 Herve Ballans
# su - postgres
237 1 Herve Ballans
238 1 Herve Ballans
$ initdb --locale=C -D data -A md5 -W
239 1 Herve Ballans
(no password)
240 2 Herve Ballans
241 2 Herve Ballans
Success. You can now start the database server using:
242 2 Herve Ballans
243 2 Herve Ballans
    postgres -D data
244 2 Herve Ballans
or
245 2 Herve Ballans
    pg_ctl -D data -l logfile start
246 2 Herve Ballans
247 1 Herve Ballans
248 1 Herve Ballans
$ initdb --locale=C -D data_sums -A md5 -W
249 2 Herve Ballans
(no password)
250 2 Herve Ballans
251 2 Herve Ballans
Success. You can now start the database server using:
252 2 Herve Ballans
253 2 Herve Ballans
    postgres -D data_sums
254 2 Herve Ballans
or
255 2 Herve Ballans
    pg_ctl -D data_sums -l logfile start
256 8 Pablo Alingery
257 8 Pablo Alingery
$ initdb --locale=C -D data_monitor -A md5 -W
258 8 Pablo Alingery
(no password)
259 8 Pablo Alingery
260 8 Pablo Alingery
Success. You can now start the database server using:
261 8 Pablo Alingery
262 8 Pablo Alingery
    postgres -D data_monitor
263 8 Pablo Alingery
or
264 8 Pablo Alingery
    pg_ctl -D data_monitor -l logfile start
265 2 Herve Ballans
</pre>
266 2 Herve Ballans
267 1 Herve Ballans
268 1 Herve Ballans
269 1 Herve Ballans
Edition des fichiers postgresql.conf pour configurer les bons ports d'écoute :
270 1 Herve Ballans
listen_addresses = '*'
271 1 Herve Ballans
data -> port 5432
272 10 Pablo Alingery
data_sums -> port 5434
273 1 Herve Ballans
data_monitor -> port 5436
274 10 Pablo Alingery
275 165 Pablo Alingery
Edit files data*/pg_hba.conf : replace 'md5' by 'trust'
276 1 Herve Ballans
<pre>
277 1 Herve Ballans
#"local"
278 1 Herve Ballans
local   all             all                                     trust
279 1 Herve Ballans
#"IPv4"
280 1 Herve Ballans
host   all             all                                     trust
281 1 Herve Ballans
</pre>
282 166 Pablo Alingery
283 166 Pablo Alingery
h3. Tunning postgres 
284 166 Pablo Alingery
285 166 Pablo Alingery
In file postgres.conf ( according to https://www.qwant.com/?q=Tunning+postgres+server+9.4+&client=firefox  )
286 166 Pablo Alingery
287 168 Pablo Alingery
shared_buffer=4096MB %{color:red}So 1/12 of the total RAM memory available%
288 1 Herve Ballans
289 169 Pablo Alingery
work_mem = 24MB
290 168 Pablo Alingery
291 168 Pablo Alingery
maintenance_work_mem = 4096MB
292 1 Herve Ballans
293 169 Pablo Alingery
wal_buffers = 16MB
294 169 Pablo Alingery
295 169 Pablo Alingery
checkpoint_segments = 32
296 169 Pablo Alingery
297 169 Pablo Alingery
checkpoint_completion_target = 0.9
298 169 Pablo Alingery
299 169 Pablo Alingery
random_page_cost = 1.0
300 169 Pablo Alingery
301 169 Pablo Alingery
effective_cache_size = 16384MB so 1/4 of the max memory 
302 169 Pablo Alingery
303 170 Pablo Alingery
304 170 Pablo Alingery
305 170 Pablo Alingery
#log
306 169 Pablo Alingery
logging_collector = on 
307 169 Pablo Alingery
log_directory = 'pg_log' 
308 169 Pablo Alingery
log_filename = 'postgresql-%Y-%m-%d_%H%M%S.log' # log file name pattern,
309 169 Pablo Alingery
log_truncate_on_rotation = on           # If on, an existing log file with the
310 169 Pablo Alingery
log_rotation_age = 1d                   # Automatic rotation of logfiles will
311 170 Pablo Alingery
client_min_messages = error
312 170 Pablo Alingery
log_min_messages = error 
313 170 Pablo Alingery
log_min_duration_statement = 0
314 170 Pablo Alingery
315 170 Pablo Alingery
log_connections = on
316 170 Pablo Alingery
log_disconnections = on
317 170 Pablo Alingery
log_duration = off
318 170 Pablo Alingery
log_hostname = on
319 170 Pablo Alingery
log_line_prefix = '%t [%p]: %u@%h - %d :'  
320 170 Pablo Alingery
321 170 Pablo Alingery
track_counts = on
322 170 Pablo Alingery
autovacuum = on 
323 170 Pablo Alingery
324 170 Pablo Alingery
extra_float_digits = 3
325 170 Pablo Alingery
326 177 Pablo Alingery
h3. Start the 3 databases :
327 1 Herve Ballans
328 1 Herve Ballans
<pre>
329 1 Herve Ballans
# su - postgres
330 196 Herve Ballans
$ cd /var/lib/postgresql
331 172 Pablo Alingery
$ pg_ctl -D data  start
332 172 Pablo Alingery
$ pg_ctl -D data_sums start
333 172 Pablo Alingery
$ pg_ctl -D data_monitor start
334 1 Herve Ballans
</pre>
335 174 Pablo Alingery
336 1 Herve Ballans
h3. Create the 3 databases :
337 181 Pablo Alingery
338 178 Pablo Alingery
Into user 'postgres'
339 1 Herve Ballans
340 179 Pablo Alingery
* createdb --locale C -E LATIN1 -T template0 ias_sdo
341 179 Pablo Alingery
* createdb --locale C -E LATIN1 -T template0 -p 5434 ias_sdo_sums
342 179 Pablo Alingery
* createdb --locale C -E LATIN1 -T template0 -p 5436 ias_sdo_monitor
343 54 Herve Ballans
344 182 Herve Ballans
h3. Automatic startup
345 182 Herve Ballans
346 182 Herve Ballans
Add following lines in the /etc/rc.local file :
347 182 Herve Ballans
348 182 Herve Ballans
<pre>
349 197 Herve Ballans
su -l -c "/usr/lib/postgresql/9.4/bin/pg_ctl -D /var/lib/postgresql/data start" postgres
350 197 Herve Ballans
su -l -c "/usr/lib/postgresql/9.4/bin/pg_ctl -D /var/lib/postgresql/data_sums start" postgres
351 197 Herve Ballans
su -l -c "/usr/lib/postgresql/9.4/bin/pg_ctl -D /var/lib/postgresql/data_monitor start" postgres
352 182 Herve Ballans
</pre>
353 182 Herve Ballans
354 325 Pablo Alingery
h3. Install additional modules
355 327 Pablo Alingery
356 326 Pablo Alingery
We need dblink for triggers between db so let's install postgresql-contrib-9.4 
357 325 Pablo Alingery
358 325 Pablo Alingery
<pre>
359 326 Pablo Alingery
root@sdo-new:~# apt-get install postgresql-contrib-9.4
360 325 Pablo Alingery
</pre>
361 325 Pablo Alingery
362 328 Pablo Alingery
Create extension dblink for each db 
363 328 Pablo Alingery
ias_sdo
364 325 Pablo Alingery
<pre>
365 328 Pablo Alingery
root@sdo-new:$ psql ias_sdo -p5432 -U postgres
366 328 Pablo Alingery
psql (9.4.6)
367 325 Pablo Alingery
Type "help" for help.
368 1 Herve Ballans
369 328 Pablo Alingery
ias_sdo=# CREATE EXTENSION dblink ;
370 1 Herve Ballans
CREATE EXTENSION
371 328 Pablo Alingery
</pre>
372 1 Herve Ballans
373 328 Pablo Alingery
ias_sdo_sums 
374 328 Pablo Alingery
<pre>
375 328 Pablo Alingery
root@sdo-new:$ psql ias_sdo -p5434 -U postgres
376 328 Pablo Alingery
psql (9.4.6)
377 328 Pablo Alingery
Type "help" for help.
378 328 Pablo Alingery
379 328 Pablo Alingery
ias_sdo=# CREATE EXTENSION dblink ;
380 328 Pablo Alingery
CREATE EXTENSION
381 328 Pablo Alingery
</pre>
382 328 Pablo Alingery
383 328 Pablo Alingery
ias_sdo_monitor
384 328 Pablo Alingery
<pre>
385 328 Pablo Alingery
root@sdo-new:$ psql ias_sdo -p5436 -U postgres
386 328 Pablo Alingery
psql (9.4.6)
387 328 Pablo Alingery
Type "help" for help.
388 328 Pablo Alingery
389 328 Pablo Alingery
ias_sdo=# CREATE EXTENSION dblink ;
390 328 Pablo Alingery
CREATE EXTENSION
391 325 Pablo Alingery
</pre>
392 325 Pablo Alingery
393 330 Pablo Alingery
To check the list of installed extensions type :
394 330 Pablo Alingery
 <pre>
395 330 Pablo Alingery
ias_sdo=\dx
396 332 Herve Ballans
                                 List of installed extensions
397 332 Herve Ballans
  Name   | Version |   Schema   |                         Description                          
398 332 Herve Ballans
---------+---------+------------+--------------------------------------------------------------
399 332 Herve Ballans
 dblink  | 1.1     | public     | connect to other PostgreSQL databases from within a database
400 332 Herve Ballans
 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
401 332 Herve Ballans
(2 rows)
402 330 Pablo Alingery
403 330 Pablo Alingery
</pre>
404 332 Herve Ballans
405 332 Herve Ballans
406 325 Pablo Alingery
407 184 Herve Ballans
h2. System tuning
408 1 Herve Ballans
409 187 Herve Ballans
Current configuration :
410 185 Herve Ballans
<pre>
411 185 Herve Ballans
# sysctl -a
412 185 Herve Ballans
</pre>
413 1 Herve Ballans
414 187 Herve Ballans
In the following file :
415 185 Herve Ballans
<pre>
416 185 Herve Ballans
# vi /etc/sysctl.conf
417 185 Herve Ballans
</pre>
418 1 Herve Ballans
419 188 Herve Ballans
we change some values (default values are commented with '#')
420 194 Herve Ballans
421 195 Herve Ballans
(resources links [[Links|here]])
422 194 Herve Ballans
423 185 Herve Ballans
<pre>
424 191 Herve Ballans
# Semaphore is a object that is used to control utilization of a particular process.
425 191 Herve Ballans
# kernel.sem = SEMMSL SEMMNS SEMOPM SEMMNI
426 191 Herve Ballans
# SEMMSL        maximum number of semaphores per array  (min 128)
427 191 Herve Ballans
# SEMMNS        maximum semaphores system-wide  
428 191 Herve Ballans
# SEMOPM        maximum operations per semop call       
429 191 Herve Ballans
# SEMMNI        maximum arrays 
430 191 Herve Ballans
#semop incresed from 32 (default value)operation to 100 (3rd value )
431 191 Herve Ballans
# kernel.sem = 250      32000   32      128
432 191 Herve Ballans
kernel.sem = 250 32000 100 128
433 191 Herve Ballans
434 191 Herve Ballans
In order to  apply changes :#This sets the  OS receive buffer size for all types of connections (default value 212992)
435 191 Herve Ballans
#net.core.rmem_default = 212992
436 191 Herve Ballans
#net.core.rmem_max = 212992
437 191 Herve Ballans
net.core.rmem_default = 33554432
438 191 Herve Ballans
net.core.rmem_max = 33554432
439 191 Herve Ballans
440 191 Herve Ballans
#This is the OS send buffer size for all types of connections (212992 default value) 
441 191 Herve Ballans
#net.core.wmem_default = 212992
442 191 Herve Ballans
#net.core.wmem_max = 212992
443 191 Herve Ballans
net.core.wmem_default = 33554432
444 191 Herve Ballans
net.core.wmem_max = 33554432
445 191 Herve Ballans
446 193 Pablo Alingery
#TCP Autotuning setting. "The first value tells the kernel the minimum receive buffer for each TCP connection, and this buffer is always
447 193 Pablo Alingery
# allocated to a TCP socket, even under high pressure on the system. ... The second value specified tells the kernel the default receive
448 193 Pablo Alingery
# buffer allocated for each TCP socket. This value overrides the /proc/sys/net/core/rmem_default value used by other protocols. ...
449 192 Pablo Alingery
# The third and last value specified in this variable specifies the maximum receive buffer that can be allocated for a TCP socket."
450 1 Herve Ballans
#net.ipv4.tcp_rmem = 4096       87380   6291456
451 1 Herve Ballans
net.ipv4.tcp_rmem = 10240 87380 33554432
452 1 Herve Ballans
453 193 Pablo Alingery
#TCP Autotuning setting. "This variable takes 3 different values which holds information on how much TCP sendbuffer memory space
454 193 Pablo Alingery
# each TCP socket has to use. Every TCP socket has this much buffer space to use before the buffer is filled up. Each of the three 
455 193 Pablo Alingery
#values are used under different conditions. ... The first value in this variable tells the minimum TCP send buffer space available
456 193 Pablo Alingery
# for a single TCP socket. ... The second value in the variable tells us the default buffer space allowed for a single TCP socket to use. ... 
457 193 Pablo Alingery
#The third value tells the kernel the maximum TCP send buffer space." 
458 191 Herve Ballans
#net.ipv4.tcp_wmem = 4096       16384   4194304
459 191 Herve Ballans
net.ipv4.tcp_wmem = 10240 87380 33554432
460 191 Herve Ballans
461 191 Herve Ballans
#Disable cache metrics so the initial conditions of the closed connections will not be saved to be used in near future connections
462 191 Herve Ballans
#net.ipv4.tcp_no_metrics_save = 0
463 191 Herve Ballans
net.ipv4.tcp_no_metrics_save = 1
464 191 Herve Ballans
465 1 Herve Ballans
# Increase number of incoming connections backlog
466 1 Herve Ballans
# net.core.netdev_max_backlog = 1000
467 1 Herve Ballans
net.core.netdev_max_backlog = 5000
468 1 Herve Ballans
469 1 Herve Ballans
# The tcp_mem variable defines how the TCP stack should behave when it comes to memory usage. ... 
470 192 Pablo Alingery
#The first value specified in the tcp_mem variable tells the kernel the low threshold. 
471 192 Pablo Alingery
#Below this point, the TCP stack do not bother at all about putting any pressure on the memory usage by different TCP sockets. ... 
472 193 Pablo Alingery
#The second value tells the kernel at which point to start pressuring memory usage down. ... The final value tells the kernel how many
473 193 Pablo Alingery
# memory pages it may use maximally
474 1 Herve Ballans
# net.ipv4.tcp_mem = 1543347    2057796 3086694
475 191 Herve Ballans
net.ipv4.tcp_mem = 786432 1048576 26777216
476 191 Herve Ballans
477 192 Pablo Alingery
# local port range that is used by TCP and UDP traffic to choose the local port. You will see in the parameters of this file two numbers:
478 192 Pablo Alingery
# The first number is the first local port allowed for TCP and UDP traffic on the server, the second is the last local port number.
479 191 Herve Ballans
# net.ipv4.ip_local_port_range = 32768  61000
480 191 Herve Ballans
net.ipv4.ip_local_port_range = 1024 65535
481 191 Herve Ballans
482 191 Herve Ballans
# maximum number of sockets in TIME-WAIT to be held simultaneously.
483 191 Herve Ballans
# net.ipv4.tcp_max_tw_buckets = 262144
484 191 Herve Ballans
net.ipv4.tcp_max_tw_buckets = 360000
485 1 Herve Ballans
</pre>
486 185 Herve Ballans
487 191 Herve Ballans
Then we run the following command to make our change take effect:
488 191 Herve Ballans
489 185 Herve Ballans
<pre>
490 185 Herve Ballans
# sysctl -p
491 185 Herve Ballans
</pre>
492 176 Pablo Alingery
493 216 Pablo Alingery
h2. JMD Installation 
494 215 Herve Ballans
495 217 Pablo Alingery
Download new JMD package build by Niles Oien 2016-04-07 following thoses actions :
496 215 Herve Ballans
497 215 Herve Ballans
<pre>
498 215 Herve Ballans
cd /urs/local
499 215 Herve Ballans
500 215 Herve Ballans
[oien@spsc-nso19-12 ~]$ ftp gong2.nso.edu
501 215 Herve Ballans
Name (gong2.nso.edu:oien): anonymous
502 215 Herve Ballans
Password: <---------------- use your email as the password
503 215 Herve Ballans
ftp> cd outgoing/oien
504 215 Herve Ballans
ftp> get pablo_jmd.tar.gz
505 215 Herve Ballans
ftp> quit
506 215 Herve Ballans
</pre>
507 215 Herve Ballans
508 215 Herve Ballans
Install new JMD package following thoses actions 
509 215 Herve Ballans
510 215 Herve Ballans
<pre>
511 215 Herve Ballans
[oien@spsc-nso19-12 ~]$ gunzip -vf pablo_jmd.tar.gz
512 215 Herve Ballans
pablo_jmd.tar.gz:      8.3% -- replaced with pablo_jmd.tar
513 215 Herve Ballans
[oien@spsc-nso19-12 ~]$ tar xf pablo_jmd.tar
514 215 Herve Ballans
[oien@spsc-nso19-12 ~]$ cd pablo_jmd
515 338 Pablo Alingery
[oien@spsc-nso19-12 pablo_jmd]$ less README.txt
516 215 Herve Ballans
cd ..
517 215 Herve Ballans
mv jmd jmd_old
518 215 Herve Ballans
mv pablo_jmd jmd 
519 215 Herve Ballans
</pre>
520 215 Herve Ballans
521 339 Pablo Alingery
url provided by jsoc to download last JMD version http://vso.tuc.noao.edu/VSO/downloads/JMD/1.6/
522 339 Pablo Alingery
523 266 Herve Ballans
h2. Apache Configuration for JMD
524 215 Herve Ballans
525 215 Herve Ballans
Configure webserver  to request jsoc_fetch
526 215 Herve Ballans
(following the mail from nilesoien@gmail.com)
527 215 Herve Ballans
528 222 Pablo Alingery
%{color:red}WARNING : change hostname when migrate sdo-new to sdo%
529 222 Pablo Alingery
530 220 Pablo Alingery
config d 'apache2 fichier sdo-new.ias.u-psud.fr 
531 215 Herve Ballans
<pre>
532 215 Herve Ballans
533 215 Herve Ballans
<VirtualHost *:80>
534 220 Pablo Alingery
        ServerName sdo-new.ias.u-psud.fr
535 215 Herve Ballans
        ServerAdmin pablo.alingery@ias.u-psud.fr
536 215 Herve Ballans
        #ErrorLog /var/log/apache2/error.log
537 215 Herve Ballans
        DocumentRoot /var/www
538 215 Herve Ballans
539 215 Herve Ballans
        # Possible values include: debug, info, notice, warn, error, crit,
540 215 Herve Ballans
        # alert, emerg.
541 215 Herve Ballans
        LogLevel debug
542 215 Herve Ballans
543 215 Herve Ballans
        #CustomLog /var/log/apache2/VSO/access.log combined
544 215 Herve Ballans
545 215 Herve Ballans
        Alias /VSO/DRMS/cgi-bin/ "/home/production/netdrms-tools/scripts/cgi-bin/"
546 215 Herve Ballans
547 215 Herve Ballans
        <Location /VSO/DRMS/cgi-bin>
548 215 Herve Ballans
                SetHandler perl-script
549 215 Herve Ballans
                PerlResponseHandler ModPerl::Registry
550 215 Herve Ballans
                PerlOptions +ParseHeaders
551 215 Herve Ballans
                Options +ExecCGI
552 215 Herve Ballans
                Order allow,deny
553 215 Herve Ballans
                Allow from all
554 215 Herve Ballans
        </Location>
555 215 Herve Ballans
</VirtualHost>
556 215 Herve Ballans
557 215 Herve Ballans
</pre>
558 215 Herve Ballans
559 223 Herve Ballans
Activate the new virtualhost and disable the default one :
560 223 Herve Ballans
<pre>
561 225 Herve Ballans
# a2ensite sdo-new.ias.u-psud.fr.conf
562 225 Herve Ballans
# a2dissite 000-default.conf
563 225 Herve Ballans
# service apache2 restart
564 225 Herve Ballans
</pre>
565 225 Herve Ballans
566 225 Herve Ballans
Allow symlink for the cgi scripts dierctory in apache2.conf :
567 225 Herve Ballans
<pre>
568 225 Herve Ballans
<Directory /home/production/netdrms-tools/scripts/>
569 225 Herve Ballans
        Options FollowSymLinks
570 225 Herve Ballans
        AllowOverride None
571 225 Herve Ballans
        Require all granted
572 225 Herve Ballans
</Directory>
573 225 Herve Ballans
</pre>
574 225 Herve Ballans
575 225 Herve Ballans
<pre>
576 225 Herve Ballans
# service apache2 restart
577 223 Herve Ballans
</pre>
578 223 Herve Ballans
 
579 226 Pablo Alingery
%{color:red}To be  added futher to test cgi%
580 1 Herve Ballans
Execution test cgi with URL :
581 226 Pablo Alingery
582 226 Pablo Alingery
make sure my $hostname=in the cgi file vso_jsoc_fetch.cgi is correct and test
583 224 Pablo Alingery
http://sdo-new.ias.u-psud.fr/VSO/DRMS/cgi-bin/vso_jsoc_fetch.cgi
584 215 Herve Ballans
585 215 Herve Ballans
expected result  :
586 215 Herve Ballans
<pre>
587 215 Herve Ballans
{
588 215 Herve Ballans
   "wait" : 0,
589 215 Herve Ballans
   "requestid" : "",
590 215 Herve Ballans
   "data" : {},
591 215 Herve Ballans
   "method" : "url_quick",
592 215 Herve Ballans
   "size" : 0,
593 215 Herve Ballans
   "errormsg" : "Empty query",
594 215 Herve Ballans
   "protocol" : "as-is",
595 215 Herve Ballans
   "status" : 1,
596 215 Herve Ballans
   "space_ratio" : 0.1,
597 215 Herve Ballans
   "load_ratio" : 0.066875,
598 215 Herve Ballans
   "dir" : "",
599 215 Herve Ballans
   "count" : 0
600 215 Herve Ballans
}
601 215 Herve Ballans
</pre>
602 215 Herve Ballans
603 267 Herve Ballans
h2. JMD configuration
604 267 Herve Ballans
605 291 Herve Ballans
Modify the file [[/usr/local/jmd/cfg/JMD.cfg]]
606 267 Herve Ballans
607 267 Herve Ballans
608 271 Herve Ballans
%{color:red}Warning : when migrate production server, change _sdo-new_ by _sdo_%
609 271 Herve Ballans
610 1 Herve Ballans
h2. NetDRMS tool Install
611 23 Pablo Alingery
612 199 Pablo Alingery
The following installed is based on : [[http://inf-redmine.ias.u-psud.fr/redmine/attachments/download/114/Netdrms_First_Install.odt]]
613 1 Herve Ballans
614 207 Pablo Alingery
The sources are in : http://jsoc.stanford.edu/netdrms/dist/ 
615 207 Pablo Alingery
Locally on sdo-new in  : /home/production/sources
616 1 Herve Ballans
617 199 Pablo Alingery
Symbolic link created 'netdrms_current' that corresponds to the last release
618 227 Pablo Alingery
ln -s netdrms_8.11/ netdrms_current 
619 1 Herve Ballans
620 199 Pablo Alingery
Edit file config.local
621 27 Pablo Alingery
<pre>
622 27 Pablo Alingery
cp config.local.template config.local
623 1 Herve Ballans
</pre>
624 29 Pablo Alingery
625 203 Pablo Alingery
%{color:red}Warning WEB_DBUSER      apache  We think that it should value www maybe , to be checked testing the cgi%
626 208 Pablo Alingery
%{color:red}So check the cgi to figure out which user is used to connect to bd%
627 32 Herve Ballans
628 199 Pablo Alingery
Create 2 followings dirs : 
629 1 Herve Ballans
<pre>
630 227 Pablo Alingery
mkdir /usr/local/netdrms_8.11/logs/SUM
631 227 Pablo Alingery
mkdir /usr/local/netdrms_8.11/logs/slony
632 27 Pablo Alingery
</pre>
633 1 Herve Ballans
634 205 Pablo Alingery
%{color:red}Warning config.local from line 150 =>222 Remote config to provide data, series to externals%
635 205 Pablo Alingery
%{color:red}To be checked for PLATO%
636 1 Herve Ballans
637 1 Herve Ballans
Création d'un alias netdrms dans /root/.bashrc
638 27 Pablo Alingery
<pre>
639 1 Herve Ballans
alias netdrms='cd /usr/local/netdrms_current'
640 1 Herve Ballans
</pre>
641 31 Pablo Alingery
642 1 Herve Ballans
h3. Prepare compiling
643 1 Herve Ballans
644 252 Herve Ballans
Into _production_ profile
645 252 Herve Ballans
646 246 Herve Ballans
<pre>
647 252 Herve Ballans
$ ./configure
648 246 Herve Ballans
</pre>
649 246 Herve Ballans
650 113 Pablo Alingery
h3. Compilation
651 113 Pablo Alingery
652 249 Herve Ballans
Creating lib64 link (lib64 does not exist on debian 8)
653 113 Pablo Alingery
<pre>
654 249 Herve Ballans
# cd /usr
655 249 Herve Ballans
# ln -s lib/ lib64
656 249 Herve Ballans
</pre>
657 249 Herve Ballans
658 249 Herve Ballans
<pre>
659 253 Herve Ballans
$ make
660 253 Herve Ballans
$ make sums
661 113 Pablo Alingery
</pre>
662 113 Pablo Alingery
663 255 Herve Ballans
h2. SSH-HPN install 
664 255 Herve Ballans
665 258 Herve Ballans
Intallation de openssh 7.2p2 car le dernier patch hpn dispo est 7.2hpn14.V10 
666 255 Herve Ballans
667 258 Herve Ballans
web site for open ssh : http://ftp2.fr.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-7.2p2.tar.gz
668 258 Herve Ballans
patch hpn : https://sourceforge.net/projects/hpnssh/files/HPN-SSH%2014v10%207.2p2/openssh-7_2_P2-hpn-14.10.diff
669 255 Herve Ballans
670 256 Pablo Alingery
In the dir /home/production/sources into  'root'
671 255 Herve Ballans
672 255 Herve Ballans
<pre>
673 258 Herve Ballans
# tar -xzvf openssh-7.2p2.tar.gz
674 258 Herve Ballans
# cd openssh-7.2p2/
675 258 Herve Ballans
# cat ../openssh-7_2_P2-hpn-14.10.diff |patch -p1
676 255 Herve Ballans
# ./configure --prefix=/usr/local/hpn-ssh --with-pam --with-md5-passwords --without-zlib-version-check --with-tcp-wrappers
677 255 Herve Ballans
# make
678 255 Herve Ballans
# make install
679 255 Herve Ballans
</pre>
680 255 Herve Ballans
681 255 Herve Ballans
Depuis sdo :
682 255 Herve Ballans
<pre>
683 255 Herve Ballans
# cd /usr/local/hpn-ssh/etc/
684 259 Herve Ballans
# rsync -av *key* production@sdo-new:/home/production/
685 255 Herve Ballans
</pre>
686 255 Herve Ballans
687 273 Herve Ballans
Following the link : http://vso.stanford.edu/netdrms/rmtsums.html
688 1 Herve Ballans
<pre>
689 274 Herve Ballans
$ cd /home/production/
690 273 Herve Ballans
$ ssh-agent -c > ~/.ssh-agent_rs
691 285 Pablo Alingery
</pre>
692 286 Pablo Alingery
NB : correct file   ~/.ssh-agent_rs it should look like :
693 285 Pablo Alingery
<pre>
694 285 Pablo Alingery
#!/bin/csh
695 285 Pablo Alingery
export SSH_AUTH_SOCK=/tmp/ssh-9POrTXobhLR4/agent.74272;
696 285 Pablo Alingery
export SSH_AGENT_PID=74273;
697 285 Pablo Alingery
echo Agent pid 74273;
698 285 Pablo Alingery
</pre>
699 285 Pablo Alingery
700 285 Pablo Alingery
<pre>
701 273 Herve Ballans
$ source ~/.ssh-agent_rs
702 273 Herve Ballans
$ ssh-add ~/.ssh/id_rsa
703 269 Herve Ballans
</pre>
704 269 Herve Ballans
705 259 Herve Ballans
Sur sdo-new :
706 255 Herve Ballans
<pre>
707 260 Herve Ballans
# mv /home/production/*key* /usr/local/hpn-ssh/etc/
708 255 Herve Ballans
</pre>
709 255 Herve Ballans
710 255 Herve Ballans
We have to configure the port number to 55000
711 255 Herve Ballans
<pre>
712 255 Herve Ballans
# vi ssh_config
713 255 Herve Ballans
</pre>
714 255 Herve Ballans
715 255 Herve Ballans
and add :
716 255 Herve Ballans
<pre>
717 255 Herve Ballans
#Port 22
718 255 Herve Ballans
Port 55000
719 255 Herve Ballans
</pre>
720 255 Herve Ballans
721 255 Herve Ballans
We configure also the server hpn (even we don't use it yet)
722 255 Herve Ballans
<pre>
723 255 Herve Ballans
# vi sshd_config
724 255 Herve Ballans
</pre>
725 255 Herve Ballans
726 255 Herve Ballans
and add :
727 255 Herve Ballans
<pre>
728 255 Herve Ballans
#Port 22
729 255 Herve Ballans
Port 55000
730 255 Herve Ballans
731 255 Herve Ballans
#PidFile /var/run/sshd.pid
732 255 Herve Ballans
PidFile /var/run/sshd.55000.pid
733 255 Herve Ballans
734 255 Herve Ballans
# allow the use of the none cipher
735 255 Herve Ballans
#NoneEnabled no
736 255 Herve Ballans
NoneEnabled yes
737 255 Herve Ballans
</pre>
738 255 Herve Ballans
739 265 Herve Ballans
In order to force the use of SSH-hpn by JMD :
740 265 Herve Ballans
741 265 Herve Ballans
<pre>
742 265 Herve Ballans
$ vi /usr/local/jmd/cfg/JMD.cfg
743 265 Herve Ballans
</pre>
744 265 Herve Ballans
745 265 Herve Ballans
and replace the path of scp binary :
746 265 Herve Ballans
747 265 Herve Ballans
<pre>
748 265 Herve Ballans
SCPCommand=/usr/local/hpn-ssh/bin/scp -o NoneSwitch=yes -o NoneEnabled=yes
749 265 Herve Ballans
</pre>
750 265 Herve Ballans
751 262 Herve Ballans
h2. Private key Public key generation 
752 262 Herve Ballans
753 262 Herve Ballans
JSOC need your public key to directly connect to your netdrms server. In order to generate your RSA public/private key pair :
754 262 Herve Ballans
755 262 Herve Ballans
<pre>
756 262 Herve Ballans
$ ssh-keygen -t rsa
757 262 Herve Ballans
</pre>
758 262 Herve Ballans
759 263 Pablo Alingery
Not necessary in our case cause we recover the ssh keys of the current server 'sdo'.
760 262 Herve Ballans
761 262 Herve Ballans
However, we have to retrieve the private key of production account on sdo-new
762 262 Herve Ballans
763 262 Herve Ballans
From sdo :
764 262 Herve Ballans
<pre>
765 262 Herve Ballans
rsync -av id_rsa production@sdo-new:/home/production/.ssh/
766 262 Herve Ballans
</pre>
767 262 Herve Ballans
768 300 Herve Ballans
In order to test the connection :
769 300 Herve Ballans
<pre>
770 300 Herve Ballans
$ ssh jsocexp@jsocport.stanford.edu -p55000
771 300 Herve Ballans
</pre>
772 300 Herve Ballans
773 301 Herve Ballans
Note : the IP of the server has to be declared to the jsoc
774 301 Herve Ballans
775 299 Pablo Alingery
h2. NetDRMS Replication Config
776 112 Herve Ballans
777 319 Herve Ballans
%{color:red}To be check if we keep that here or not%
778 311 Pablo Alingery
To prevent from deleting files 
779 307 Pablo Alingery
<pre>
780 307 Pablo Alingery
cd logs/SUM ; scp production@sdo:/usr/local/netdrms/install-config-files/sum_rm.cfg .
781 112 Herve Ballans
</pre>
782 1 Herve Ballans
783 1 Herve Ballans
Create tmp dir in netdrms working directory (/usr/local/netdrms_current)
784 112 Herve Ballans
<pre>
785 315 Herve Ballans
$ mkdir tmp
786 112 Herve Ballans
</pre>
787 112 Herve Ballans
788 308 Pablo Alingery
Create config file from template 
789 112 Herve Ballans
<pre>
790 315 Herve Ballans
$ cd base/drms/replication/etc
791 313 Pablo Alingery
cp repclient.template.cfg ias.repclient.cfg
792 307 Pablo Alingery
</pre>
793 91 Herve Ballans
794 316 Herve Ballans
Define node in file : [[/usr/local/netdrms_current/base/drms/replication/etc/ias.repclient.cfg]]
795 1 Herve Ballans
796 309 Pablo Alingery
In our case :
797 94 Herve Ballans
<pre>
798 1 Herve Ballans
node=IASprod
799 319 Herve Ballans
</pre>
800 319 Herve Ballans
801 337 Herve Ballans
There are 4 new fileds in the new version of repclient (see Art mail June 11, 2016)
802 335 Herve Ballans
803 319 Herve Ballans
<pre>
804 320 Herve Ballans
#kRSBaseURL=<base URL for all Slony services>
805 334 Herve Ballans
kRSBaseURL=http://jsoc.stanford.edu/cgi-bin/ajax
806 320 Herve Ballans
#kSubService=<URL of the subscription service>
807 334 Herve Ballans
kSubService=${kRSBaseURL}/request-subs.py
808 320 Herve Ballans
#kPubListService=<URL of the publication-list service>
809 334 Herve Ballans
kPubListService=${kRSBaseURL}/publist.py
810 320 Herve Ballans
#kSubXfer=<URL of the file transfer directory>
811 334 Herve Ballans
kSubXfer=http://jsoc.stanford.edu/subscription
812 106 Pablo Alingery
</pre>
813 321 Pablo Alingery
814 321 Pablo Alingery
h2. NetDRMS Subsribe list Config
815 321 Pablo Alingery
816 321 Pablo Alingery
Create config subscribe file from template 
817 321 Pablo Alingery
<pre>
818 321 Pablo Alingery
$ cd base/drms/replication/etc
819 321 Pablo Alingery
cp subscribe_list.template.cfg ias.subscribe_list.cfg
820 321 Pablo Alingery
</pre>
821 321 Pablo Alingery
822 321 Pablo Alingery
823 292 Pablo Alingery
h2. TO BE DONE BEFORE MIGRATION
824 108 Pablo Alingery
825 107 Pablo Alingery
826 152 Pablo Alingery
%{color:red} configure sytem nbr de fichier ouvert en meme temps%
827 1 Herve Ballans
828 152 Pablo Alingery
%{color:red} configure sytem taille  buffer%
829 152 Pablo Alingery
830 155 Pablo Alingery
%{color:red} swap désactivé ? discussion Stephane et Gilles%
831 1 Herve Ballans
832 1 Herve Ballans
%{color:red}Test ssh connection to JSOC , NSO CFA before subcription and just after name sdo-new into sdo%
833 317 Pablo Alingery
%{color:red}Take old counter and place it in the same dir before migration%