This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
mongoroc_doc [2020/01/09 08:01] acqilc |
mongoroc_doc [2021/07/10 23:21] (current) |
||
---|---|---|---|
Line 14: | Line 14: | ||
=== Creation des utilisateurs === | === Creation des utilisateurs === | ||
- | Pour la base '''cool_db''' | ||
+ | Pour la base '''MaBase''' | ||
- | use cool_db | + | |
+ | use MaBase | ||
db.createUser({ | db.createUser({ | ||
- | user: 'ian', | + | user: 'monId', |
pwd: 'secretPassword', | pwd: 'secretPassword', | ||
- | roles: [{ role: 'readWrite', db:'cool_db'}] | + | roles: [{ role: 'readWrite', db:'MaBase'}] |
}) | }) | ||
Line 35: | Line 36: | ||
authorization: 'enabled' | authorization: 'enabled' | ||
- | On peut ainsi acceder a la base cool_db a distance | + | On peut ainsi acceder a la base MaBase a distance |
- | mongo -u ian -p secretPassword MONPC/cool_db | + | mongo -u monId -p secretPassword MONPC/MaBase |
=== Creation de la base === | === Creation de la base === | ||
Line 52: | Line 53: | ||
Les tables sont creees par insertion par le script python | Les tables sont creees par insertion par le script python | ||
+ | |||
+ | |||
+ | ==== Backup ==== | ||
+ | |||
+ | Pour sauvegAarder sur un PC distant | ||
+ | |||
+ | mongodump --forceTableScan --host monPC --port 27017 --username monId --password monPwd --db MaBase --out /data/local/mgbackup17/ | ||
+ | |||
+ | |||
+ | Pour restaurer sur un autre monPC1 | ||
+ | |||
+ | * Installer mongodb sur monPC1 | ||
+ | * creer l'utilisateur monID | ||
+ | * copier le repertoire mgbackup17 | ||
+ | |||
+ | mongorestore mgbackup17/ | ||
+ | |||
+ | et c'est fini. | ||
+ | |||
+ | |||
+ | |||
==== Client ==== | ==== Client ==== | ||
Du cote client, seul l'acces au base mongodb est necessaire a travers des scripts python. Sur les distributions basees sur debian il suffit d'installer | Du cote client, seul l'acces au base mongodb est necessaire a travers des scripts python. Sur les distributions basees sur debian il suffit d'installer | ||
- | le paquet ''python-pymongo'' | + | le paquet ''python-pymongo'' en python2 |
sudo apt-get install python-pymongo | sudo apt-get install python-pymongo | ||
+ | | ||
+ | | ||
+ | === Addendum === | ||
+ | |||
+ | L'access se fait maintenant par defaut avec python3 | ||
+ | |||
+ | sudo apt-get install python3-pip | ||
+ | sudo pip3 install pymongo | ||
===== Acces et modification des configurations des ASICs ===== | ===== Acces et modification des configurations des ASICs ===== | ||
Line 207: | Line 237: | ||
- PARAMETER, un objet JSON pour acceder aux parametres de l'application (format libre) | - PARAMETER, un objet JSON pour acceder aux parametres de l'application (format libre) | ||
+ | La description JSON des differents processus se trouve dans [[Liste_processus_json| Liste des descriptions de processus]] | ||
- | [[Liste_processus_json| Liste des descriptions de processus]] | + | ==== La classe MongoJob ==== |
- | === Liste des processus === | + | La classe //MongoJob// est decrite dans le fichier {{ :pdf:mongojob.pdf |}} |
- | == SDCC == | + | Un objet //MongoJob// permet l'acces a la base MongoDB par le meme mecanisme de varaible d'environnement MGDBLOGIN. Il permet en outre |
- | { | + | * d'inserer une fichier de configuration associe a un nom et une version |
- | "ARGS": [], | + | * de lister les configurations enregistrees |
- | "ENV": [ | + | * de telecharger dans // /dev/shm/mgjob/ // une configuration |
- | "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", | + | * de reccuperer un nouveau numero de run pour un setup de prise de donnee et de commenter ce run |
- | "LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:/opt/dhcal/lib:$LD_LIBRARY_PATH", | + | * de lister l'ensemble des runs effectues |
- | "WEBPORT=41000" | + | |
- | ], | + | |
- | "NAME": "CCCSERVER", | + | |
- | "PARAMETER": { | + | |
- | "device": "DCCCCC01" <=== FTDI name | + | |
- | }, | + | |
- | "PROGRAM": "/opt/dhcal/bin/lydaq_daemon_Sdcc" | + | |
- | } | + | |
- | + | ||
- | == MDCC == | + | |
- | + | ||
- | { | + | |
- | "ARGS": [], | + | |
- | "ENV": [ | + | |
- | "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", | + | |
- | "DIM_DNS_NODE=lyosdhcal10", | + | |
- | "LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:/opt/dhcal/levbdim/lib:/opt/dhcal/lib:/opt/dhcal/DQM4HEP/lib:/opt/dhcal/dim/linux:/opt/dhcal/DQM4HEP/lib:/opt/dhcal/root/lib::/opt/dhcal/lcio/v02-00/lib/:$LD_LIBRARY_PATH", | + | |
- | "WEBPORT=42000" | + | |
- | ], | + | |
- | "NAME": "MDCCSERVER", | + | |
- | "PARAMETER": { | + | |
- | "device": "MDCC01", <== FTDI name | + | |
- | "spilloff": 1000000, <== Spill parameters | + | |
- | "spillon": 20000, | + | |
- | "spillregister": 64 | + | |
- | }, | + | |
- | "PROGRAM": "/opt/dhcal/bin/lydaq_daemon_Mdcc" | + | |
- | } | + | |
- | + | ||
- | == FEB Server == | + | |
- | + | ||
- | { | + | |
- | "ARGS": [], | + | |
- | "ENV": [ | + | |
- | "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", | + | |
- | "LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:/opt/dhcal/levbdim/lib:/opt/dhcal/lib:/opt/dhcal/DQM4HEP/lib:/opt/dhcal/dim/linux:/opt/dhcal/DQM4HEP/lib:/opt/dhcal/root/lib::/opt/dhcal/lcio/v02-00/lib/:$LD_LIBRARY_PATH", | + | |
- | "CONFDB_WEB=cmsLyon/RPC_2008@ilcconfdb.ipnl.in2p3.fr", | + | |
- | "WEBPORT=40000" | + | |
- | ], | + | |
- | "NAME": "TDCSERVER", | + | |
- | "PARAMETER": { | + | |
- | "publish": "tcp://lyosdhcal11:5556", <== data publication stream | + | |
- | "tdc": { | + | |
- | "db": { <== DB description | + | |
- | "mode": "WEB", | + | |
- | "state": "FEB_2B_1415_25" | + | |
- | }, | + | |
- | "network": "192.168.10." <== FEB network path | + | |
- | } | + | |
- | }, | + | |
- | "PROGRAM": "/opt/dhcal/bin/lydaq_daemon_FebCms" | + | |
- | } | + | |
- | + | ||
- | == DIFManager == | + | |
- | + | ||
- | { | + | |
- | "ARGS": [], | + | |
- | "ENV": [ | + | |
- | "PATH=/opt/dhcal/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", | + | |
- | "LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:/opt/dhcal/lib:$LD_LIBRARY_PATH", | + | |
- | "PYTHONPATH=/opt/dhcal/script/:$PYTHONPATH", | + | |
- | "CONFDB_WEB=cmsLyon/RPC_2008@ilcconfdb.ipnl.in2p3.fr", | + | |
- | "WEBPORT=40000", | + | |
- | "INSTANCE=0" | + | |
- | ], | + | |
- | "NAME": "DIFMANAGER", | + | |
- | "PARAMETER": { | + | |
- | "detectorId": 100, <== Event builder detector id | + | |
- | "dif": { | + | |
- | "db": { <== DB access description | + | |
- | "mode": "mongo", | + | |
- | "state": "DIFTEST_DOME", | + | |
- | "version": 3 | + | |
- | } | + | |
- | }, | + | |
- | "publish": "tcp://lyosdhcal9:5556" <== data publication port | + | |
- | }, | + | |
- | "PROGRAM": "/opt/dhcal/bin/lydaq_daemon_DIF" | + | |
- | } | + | |
- | + | ||
- | == DIF Server == | + | |
- | + | ||
- | { | + | |
- | "ARGS": [], | + | |
- | "ENV": [ | + | |
- | "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin", | + | |
- | "LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:/opt/dhcal/lib:$LD_LIBRARY_PATH", | + | |
- | "WEBPORT=40000", | + | |
- | "INSTANCE=0" | + | |
- | ], | + | |
- | "NAME": "DIFSERVER", | + | |
- | "PARAMETER": { | + | |
- | "builderAddress": "tcp://lyosdhcal10:5556", <== data collection stream | + | |
- | "dbcache": "tcp://lyosdhcal10:5555", <== DB cache (Oracle) address | + | |
- | "detectorId": 100 | + | |
- | }, | + | |
- | "PROGRAM": "/opt/dhcal/bin/lydaq_daemon_Dif" | + | |
- | } | + | |
- | + | ||
- | + | ||
- | + | ||
- | == DAQ control == | + | |
- | + | ||
- | { | + | |
- | "ARGS": [], | + | |
- | "ENV": [ | + | |
- | "LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:/opt/dhcal/lib:$LD_LIBRARY_PATH", | + | |
- | "WEBPORT=45000" | + | |
- | ], | + | |
- | "NAME": "FDAQ", | + | |
- | "PARAMETER": { <== Slow control publication information | + | |
- | "TCPPort": 5500, | + | |
- | "location": "DOME_ALGECO_FEB2019", <== Compulsary for run start | + | |
- | "period": 30, | + | |
- | "s_ctrlreg": "0x815A1B00" | + | |
- | }, | + | |
- | "PROGRAM": "/opt/dhcal/bin/lydaq_daemon_Control" | + | |
- | } | + | |
- | + | ||
- | == Event Builder == | + | |
- | { | + | |
- | "ARGS": [], | + | |
- | "ENV": [ | + | |
- | "LD_LIBRARY_PATH=/opt/dhcal/root/lib:/usr/lib:/usr/local/lib:/opt/dhcal/lib:$LD_LIBRARY_PATH", | + | |
- | "WEBPORT=46000" | + | |
- | ], | + | |
- | "NAME": "WRITER", | + | |
- | "PARAMETER": { | + | |
- | "dif": 1, | + | |
- | "directory": "/data/NAS/TEST_BAKELITE", <== data writing directory | + | |
- | "processor": [ <== List of data processor | + | |
- | "binarywriter", | + | |
- | "lydaq_pluggins_monitor", | + | |
- | "lydaq_pluggins_rootwriter", | + | |
- | "lydaq_pluggins_lciowriter" | + | |
- | ], | + | |
- | "shmpath": "/dev/shm/monitor", <== Monitoring storage directory | + | |
- | "stream": [ <== Liste of listening ports | + | |
- | "tcp://*:5556" | + | |
- | ] | + | |
- | }, | + | |
- | "PROGRAM": "/opt/dhcal/bin/lydaq_daemon_Builder" | + | |
- | } | + | |
- | == Oracle Database Cache == | + | ==== Le script mgjob ==== |
- | { | + | Le script est une interface en ligne de commande du module //MongoJob// |
- | "ARGS": [], | + | |
- | "ENV": [ | + | |
- | "LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:/opt/dhcal/lib:$LD_LIBRARY_PATH", | + | |
- | "CONFDB=...", <= See /etc/ljc.conf for value | + | |
- | "CONFDB_WEB=cmsLyon/RPC_2008@ilcconfdb.ipnl.in2p3.fr", | + | |
- | "WEBPORT=44000" | + | |
- | ], | + | |
- | "NAME": "DBSERVER", | + | |
- | "PARAMETER": { | + | |
- | "mode": "DB", | + | |
- | "path": "/dev/shm/", | + | |
- | "publish": "tcp://*:5555", <= publication port to DIF server application | + | |
- | "state": "Dome_42chambres_Reference_v4_241" | + | |
- | }, | + | |
- | "PROGRAM": "/opt/dhcal/bin/lydaq_daemon_ConfigurationDB" | + | |
- | } | + | |
- | == Zup == | + | usage: mgjob [-h] |
+ | [--upload-config | --configurations | --download | --runs | --new-run] | ||
+ | [--version VERSION] [--name NAME] [--comment COMMENT] | ||
+ | [--location LOCATION] [--file FILE] | ||
+ | optional arguments: | ||
+ | -h, --help show this help message and exit | ||
+ | --upload-config Upload new config with --name=NAME --file=FILE and | ||
+ | optional --comment=xxx and --version=num | ||
+ | --configurations List all the available configurations | ||
+ | --download download the configuration specified in --name=config | ||
+ | name --version=version | ||
+ | --runs List all the taken runs | ||
+ | --new-run Find last run of a given setup (--location setup) and | ||
+ | fill the lastrun.sjon with the next runid Optional: | ||
+ | --comment=xxxx | ||
+ | --version VERSION DB configuration version | ||
+ | --name NAME Configuration name | ||
+ | --comment COMMENT Comment | ||
+ | --location LOCATION Setup name | ||
+ | --file FILE Configuration file | ||
- | { | ||
- | "ARGS": [], | ||
- | "ENV": [ | ||
- | "LD_LIBRARY_PATH=/opt/dhcal/root/lib:/usr/lib:/usr/local/lib:/opt/dhcal/lib:$LD_LIBRARY_PATH", | ||
- | "WEBPORT=31000" | ||
- | ], | ||
- | "NAME": "ZUP", | ||
- | "PARAMETER": { | ||
- | "TCPPort": 5500, <= Slow control publication port | ||
- | "location": "SDHCAL_H2SEPT2017", | ||
- | "device": "/dev/ttyUSB0", <= USB port | ||
- | "port": 1 <= ZUP address | ||
- | } | ||
- | | ||
- | == BMP == | ||
- | { | ||
- | "ARGS": [], | ||
- | "ENV": [ | ||
- | "LD_LIBRARY_PATH=/opt/dhcal/root/lib:/usr/lib:/usr/local/lib:/opt/dhcal/lib:$LD_LIBRARY_PATH", | ||
- | "WEBPORT=32000" | ||
- | ], | ||
- | "NAME": "BMP", | ||
- | "PARAMETER": { | ||
- | "TCPPort": 5600, <= slow control publication port | ||
- | "location": "SDHCAL_H2SEPT2017" | ||
- | }, | ||
- | "PROGRAM": "/opt/dhcal/bin/lydaq_daemon_Bmp" | ||
- | } | ||
- | == WIENER == | ||
- | { | ||
- | "ARGS": [], | ||
- | "ENV": [ | ||
- | "LD_LIBRARY_PATH=/opt/dhcal/root/lib:/usr/lib:/usr/local/lib:/opt/dhcal/lib:$LD_LIBRARY_PATH", | ||
- | "WEBPORT=31000" | ||
- | ], | ||
- | "NAME": "ISEG", | ||
- | "PARAMETER": { | ||
- | "TCPPort": 5600, <== Slow control publication port | ||
- | "address": "lyoilchv01", <== Crate address | ||
- | "first": 0, <== First and last channel | ||
- | "last": 55, | ||
- | "location": "SDHCAL_H2SEPT2017" | ||
- | }, | ||
- | "PROGRAM": "/opt/dhcal/bin/lydaq_daemon_Wiener" | ||
- | } | ||