Project

General

Profile

NetDRMS Installation » History » Version 292

Pablo Alingery, 10/06/2016 14:47

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