Project

General

Profile

NetDRMS Installation » History » Version 294

Herve Ballans, 10/06/2016 14:52

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