Wiki » History » Version 12
« Previous -
Version 12/14
(diff) -
Next » -
Current version
Pablo Alingery, 03/04/2018 16:05
NetDrms2.4 => Netdrms 9.1.1¶
Posgres 9.4.13¶
Install additional modules¶
We need dblink for triggers between db
root@sdo1:~# cd /usr/share/postgresql/9.4/extension root@sdo1:/usr/share/postgresql/9.4/extension# ls -al dblink--1.1.sql -rw-r--r-- 1 root root 5831 Aug 10 14:53 dblink--1.1.sql
ias_sdo¶
root@sdo1:/usr/share/postgresql/9.4/extension# psql ias_sdo -p5432 -U postgres < dblink--1.1.sql Use "CREATE EXTENSION dblink" to load this file. root@sdo1:/usr/share/postgresql/9.4/extension# root@sdo1:/usr/share/postgresql/9.4/extension# root@sdo1:/usr/share/postgresql/9.4/extension# root@sdo1:/usr/share/postgresql/9.4/extension# psql ias_sdo -U postgres psql (9.4.13) Type "help" for help. ias_sdo=# CREATE EXTENSION dblink ; ERROR: extension "dblink" already exists ias_sdo=# \q
Seems ok !
ias_sdo_sums¶
root@sdo1:/usr/share/postgresql/9.4/extension# psql ias_sdo_sums -p5434 -U postgres < dblink--1.1.sql Use "CREATE EXTENSION dblink" to load this file. root@sdo1:/usr/share/postgresql/9.4/extension# psql ias_sdo_sums -p5434 -U postgres psql (9.4.13) Type "help" for help. ias_sdo_sums=# CREATE EXTENSION dblink ; ERROR: extension "dblink" already exists ias_sdo_sums=# \q
Seems ok too !
ias_sdo_monitor¶
root@sdo1:/usr/share/postgresql/9.4/extension# psql ias_sdo_monitor -p5436 -U postgres < dblink--1.1.sql Use "CREATE EXTENSION dblink" to load this file. root@sdo1:/usr/share/postgresql/9.4/extension# psql ias_sdo_monitor -p5436 -U postgres psql (9.4.13) Type "help" for help. ias_sdo_monitor=# CREATE EXTENSION dblink ; ERROR: extension "dblink" already exists
Ok too!
Ingest last dumps from sdo1¶
postgres@sdo1:~/dumps$ gunzip < ias_sdo_sums_2017-09-28.gz | psql ias_sdo_sums -p5434 -U postgres postgres@sdo1:~/dumps$ gunzip < ias_sdo_2017-09-28.gz | psql ias_sdo -p5432 -U postgres postgres@sdo1:~/dumps$ gunzip < ias_sdo_monitor_2017-09-28.gz | psql ias_sdo_monitor -p5436 -U postgres
Creation of missing tables & functions¶
TABLE drms.ingested_sunums
--When a client ingests a Slony log, each SUNUM of each data series record is copied
-- into this table. The client can use this table of SUNUMs to prefetch SUs from the
-- providing site. This SQL is ingested as the pg_user database user, the same
-- user that will be ingesting Slony logs and prefetching SUs, so permissions on
-- this table will be correct without having to execute a GRANT statement.
--
-- The namespace drms is required, and is created by NetDRMS.sql during the
-- NetDRMS installation process.
--
DROP TABLE IF EXISTS drms.ingested_sunums; CREATE TABLE drms.ingested_sunums (sunum bigint PRIMARY KEY, starttime timestamp with time zone NOT NULL); CREATE INDEX ingested_sunums_starttime ON drms.ingested_sunums(starttime);
FUNCTION drms.capturesunum
--
-- For each table under replication, a trigger is created that calls this function, which
-- then copies SUNUMs into the underlying table, drms.ingested_sunums.
--
-- drms.ingested_sunums may not exist (older NetDRMSs did not receive the SQL to create
-- this table). If this table does not exist, then this function is a no-op.
--
CREATE OR REPLACE FUNCTION drms.capturesunum() RETURNS TRIGGER AS $capturesunumtrig$ BEGIN IF EXISTS (SELECT n.nspname, c.relname FROM pg_class c JOIN pg_namespace n ON n.oid = c.relnamespace WHERE n.nspname = 'drms' AND c.relname = 'ingested_sunums') THEN IF (TG_OP='INSERT' AND new.sunum > 0) THEN IF EXISTS (SELECT 1 FROM drms.ingested_sunums WHERE sunum = new.sunum) THEN RETURN NULL; END IF; INSERT INTO drms.ingested_sunums (sunum, starttime) VALUES (new.sunum, clock_timestamp()); END IF; END IF; RETURN NEW; END $capturesunumtrig$ LANGUAGE plpgsql;
Add a trigger on every hmi table like this to use the function:
CREATE TRIGGER capturesunumtrig AFTER INSERT ON hmi.bharp_720s FOR EACH ROW EXECUTE PROCEDURE drms.capturesunum();
NOT for aia.lev1 series because we are taking 1/5 data we don't want everything
Create shadow & speed up the usage of aia.lev1 table¶
postgresql-plperl¶
In order to run createshadow we need postgresql-plperl
apt-get install postgresql-plperl
Install language plperl¶
Install plperl within postgres
createlang -p5432 -U postgres plperlu ias_sdo
Create function updateshadow()¶
Create function updateshadow()
psql ias_sdo -p5432 -f /usr/local/netdrms_current/base/drms/libs/pg/updateshadow.sql
So now we are able to launch createshadow()
createshadow series=aia.lev1
Get data from JSOC¶
Create readonly user¶
production@sdo1:/usr/local/netdrms_current$ psql ias_sdo_sums -p5434 -U postgres psql (9.4.13) Type "help" for help. ias_sdo_sums=# CREATE USER readonlyuser; CREATE ROLE ias_sdo_sums=# GRANT CONNECT ON DATABASE ias_sdo_sums To readonlyuser ; GRANT
Installation Netdrms_9.1.1¶
Create netdrms directory¶
Create the directory to untar netdrms_9.1.1 from http://jsoc.stanford.edu/~arta/for-pablo/netdrms-9.1.1.tar.gz
mkdir /usr/local/netdrms_9.1.1
Change owner for production:ias
chown -R production:ias netdrms_9.1.1
Configuration file¶
cp config.local.template config.local
Warning : Config has done for remote sum, indeed jmd is not used anymore
Modification file 'configure'¶
In file /usr/local/netdrms_current/configure
Replace all " $? !=0 " by " $status !=0 " in file configure then tape
see https://git.ias.u-psud.fr/palinger/netdrms_9.1.1/commit/0fb3fa60d2b6124500739087c8edeaba91559449
Modiffication file jsoc_machine.csh¶
In file /usr/local/netdrms_current/build/jsoc_machine.csh (Same issue in NetDrms 8.11 , NetDrms 9.0)
ligne 28 :
case "x86_64": echo linux_x86_64 breaksw
see https://git.ias.u-psud.fr/palinger/netdrms_9.1.1/commit/e75212b1bc8ab493ae15ef3f8b50ebfbad065bc8
File make_basic.mk¶
In file make_basic.mk line 223
look for "GCC_LF_ALL ="
add "-lcrypto"
Execution configure¶
./configure
Build¶
As we are going to use new remote sums (written in python)
we only need to do the following
make show_info make show_series
Checking the modif on Db from NetDrms 2.4 we have figured out that some index where added
The other modif are for sum_rm use ...
Not needed at IAS
On sdo and sdo3 modification in the DB ( index addition)
production@sdo:~$ psql ias_sdo_sums -p5434 ias_sdo_sums=# CREATE INDEX sum_partn_alloc_wd_idx ON public.sum_partn_alloc(wd) ;
Start NetDrms¶
Launch sums.py¶
sumsd.py --loglevel=debug &
Launch rsumsd-.py¶
rsumsd.py --loglevel=debug &
Launch rsums-clientd.py¶
rsums-clientd.py --loglevel=debug &
Stop NetDrms¶
list processes and their pid¶
ps aux | grep python
Stop rsums-clientd.py¶
kill -2 #rsums-clientd.py_pid
Stop rsumsd-.py¶
kill -2 #rsumsd.py_pid
Stop sums.py¶
kill -2 #sums.py_pid
NetDrms 9.1.1 FAQ¶
rsumsd.py keep crashing¶
Error message :
If you 've got sthg like in rslog_20171204.txt (for exemple)
2017-12-04 14:35:56 - DEBUG - rsumsd.py:423 - Exiting TerminationHandler. 2017-12-04 14:35:56 - ERROR - rsumsd.py:441 - (get) No SU-table record exists for SU 995061214. 2017-12-04 14:35:56 - INFO - rsumsd.py:429 - Exiting with return status 15.
Workaround :
1) Delete from ingested_sunums table
ias_sdo=# select * from drms.ingested_sunums where sunum=995061214;
sunum | starttime
-----------+-------------------------------
995061214 | 2017-11-30 18:02:18.085994+01
(1 row)
ias_sdo=# delete from drms.ingested_sunums where sunum=995061214;
DELETE 1
2)Delete from rs.requests
ias_sdo=# select * from drms.rs_requests where sunums like '%995061214%' ; ias_sdo=# delete from drms.rs_requests where sunums like '%995061214%' ; DELETE 132
3) Restart daemons sumsd.py , rsumsd.py, rsums-clientd.py as production
sumsd.py & rsums.py & rsums-clientd.py &