# --- allow multicast $ firewall-cmd --permanent --direct --add-rule ipv4 filter INPUT 0 -m pkttype --pkt-type multicast -j ACCEPT $ firewall-cmd --permanent --direct --add-rule ipv6 filter INPUT 0 -m pkttype --pkt-type multicast -j ACCEPT # --- registry service $ firewall-cmd --permanent --add-port=1500/udp # --- L1 blocks registry $ firewall-cmd --permanent --add-port=1501/udp # --- RESTful interface $ firewall-cmd --permanent --add-port=1500/tcp $ firewall-cmd --reload
qid
:
$ qid -h usage: egothor.qid.rest.Starter [-a <URI>] [-b <URI>] [-d <DIR>] [-h] [-l <IPADDR>] [-m <IPADDR>] [-p <NUM>] [-t] -a,--auth-base <URI> remote AccessService URI or local base config URI -b,--base-uri <URI> base URI [http://0.0.0.0] -d,--l1-directory <DIR> start L1 manager in the directory -h print this message -l,--l1-mcast-registry <IPADDR> L1 multicast registry (ipv4/6 supported) [224.0.0.101] -m,--mcast-registry <IPADDR> main multicast registry (ipv4/6 supported) [224.0.0.100] -p,--port <NUM> port [1500] -t enable tracing supportMain multicast registry se startuje vždy. L1 multicast registry pouze spolu s L1 manager. L1 manager se startuje pouze při vymezení diskového adresáře, pomocí přepínače
-d
.
-a
obsahuje příslušné URI pod protokolem http
-a
obsahuje název souboru s bází uživatelů a skupin jako URI pod protokolem file
-a
, tak je přístupová služba zavedena bez znalosti jakýchkoliv uživatelských účtů a skupin
Reálný start pak vypadá typicky takto
$ qid -d ~/tmp/qid May 15, 2018 3:48:10 PM egothor.qid.rest.Starter main INFO: constructing mcast-registry at 224.0.0.100:1500 May 15, 2018 3:48:10 PM egothor.qid.net.MulticastManager register INFO: binding to enp0s31f6/224.0.0.100:1500 with write-op to enp0s31f6/224.0.0.100:1500 May 15, 2018 3:48:10 PM egothor.qid.rest.Starter main INFO: access base undefined, only default accounts are active May 15, 2018 3:48:10 PM egothor.qid.rest.GlobalAccessVerifier initialize INFO: logins exported via http://192.168.0.70:1500/auth go to f86bab87-80b6-4aa8-94df-b677777de001 locally May 15, 2018 3:48:10 PM egothor.qid.rest.Starter main INFO: registered egothor.qid.rest.AccessGateway f86bab87-80b6-4aa8-94df-b677777de001 http://192.168.0.70:1500/auth May 15, 2018 3:48:10 PM egothor.qid.io.struct.RevolverStorage initialize INFO: initialization, directory=/home/galambos/tmp/qid May 15, 2018 3:48:10 PM egothor.qid.io.struct.RevolverStorage load INFO: empty storage started in /home/galambos/tmp/qid May 15, 2018 3:48:10 PM egothor.qid.rest.Starter main INFO: registered egothor.qid.rest.L1Gateway cbc39b7c-a13b-441f-943a-7c7099919344 http://192.168.0.70:1500/io/l1 May 15, 2018 3:48:10 PM egothor.qid.rest.Starter main INFO: constructing mcast-l1blockregistry at 224.0.0.101:1501 May 15, 2018 3:48:10 PM egothor.qid.net.MulticastManager register INFO: binding to enp0s31f6/224.0.0.101:1501 with write-op to enp0s31f6/224.0.0.101:1501 May 15, 2018 3:48:10 PM org.glassfish.grizzly.http.server.NetworkListener start INFO: Started listener bound to [0.0.0.0:1500] May 15, 2018 3:48:10 PM org.glassfish.grizzly.http.server.HttpServer start INFO: [HttpServer] Started. Application started on http://0.0.0.0:1500 WADL descriptor http://0.0.0.0:1500/application.wadl Stop the application using CTRL+C
Z výpisu je patrné, ze je v této instanci Access service dostupná pod REST adresou http://192.168.0.70:1500/auth (192.168.0.70 je egress/adresa stroje, na kterém bylo jádro spuštěno).
Báze uživatelů obsahuje uživatelské jméno, plain-text heslo, a seznam skupin, do kterých uživatel patří:
user:password:l1,manager,user
Aktivace s touto bází je možná takto:
$ qid -d ~/tmp/qid -a file:$PWD/passwd.qid May 15, 2018 4:14:57 PM egothor.qid.rest.Starter main INFO: constructing mcast-registry at 224.0.0.100:1500 May 15, 2018 4:14:57 PM egothor.qid.net.MulticastManager register INFO: binding to enp0s31f6/224.0.0.100:1500 with write-op to enp0s31f6/224.0.0.100:1500 May 15, 2018 4:14:57 PM egothor.qid.rest.Starter main INFO: loading static access service base file:/home/galambos/tmp/qid/passwd.qid May 15, 2018 4:14:57 PM egothor.qid.rest.GlobalAccessVerifier initialize INFO: logins exported via http://192.168.0.70:1500/auth go to dc15b987-7515-4561-bd6a-1afee8558fac locally May 15, 2018 4:14:57 PM egothor.qid.rest.Starter main INFO: registered egothor.qid.rest.AccessGateway dc15b987-7515-4561-bd6a-1afee8558fac http://192.168.0.70:1500/auth May 15, 2018 4:14:57 PM egothor.qid.io.struct.RevolverStorage initialize INFO: initialization, directory=/home/galambos/tmp/qid May 15, 2018 4:14:57 PM egothor.qid.io.struct.RevolverStorage load INFO: empty storage started in /home/galambos/tmp/qid May 15, 2018 4:14:57 PM egothor.qid.rest.Starter main INFO: registered egothor.qid.rest.L1Gateway 288fda06-6a8c-4925-a7c4-b6832fb2e0ad http://192.168.0.70:1500/io/l1 May 15, 2018 4:14:57 PM egothor.qid.rest.Starter main INFO: constructing mcast-l1blockregistry at 224.0.0.101:1501 May 15, 2018 4:14:57 PM egothor.qid.net.MulticastManager register INFO: binding to enp0s31f6/224.0.0.101:1501 with write-op to enp0s31f6/224.0.0.101:1501 May 15, 2018 4:14:58 PM org.glassfish.grizzly.http.server.NetworkListener start INFO: Started listener bound to [0.0.0.0:1500] May 15, 2018 4:14:58 PM org.glassfish.grizzly.http.server.HttpServer start INFO: [HttpServer] Started. Application started on http://0.0.0.0:1500 WADL descriptor http://0.0.0.0:1500/application.wadl Stop the application using CTRL+C
http://egress-addresa:1500/auth
Forwarder pak vyžaduje parametr, na jakou službu se má obracet - tento parametr je bez
koncového segmentu "auth". V případě forwardingu do http://192.168.0.70:1500/auth, je správným parametrem http://192.168.0.70:1500/
qid-client
:
$ qid-client usage: egothor.qid.fs.Tool [-A <NUM>] -a <URI> | -s <LOCALFN> [--add-mount <PATH,CONTENT,SEGMENTS>] [-B <NUM>] [-l <IPADDR>] [-m <IPADDR>] -u <USER> -w <PASSWORD> --concatenate <FILE1,FILE2,...,PRODUCT> | --list-all <PATH> | --lookup <PATH> | --print <FILENAME> | --read <OFFSET:UUID> | --remove <PATH> | --rename <SRC DST> | --save <LOCALFN FILENAME> | --write <FILENAME> -A,--registry-port <NUM> port [1500] -a,--auth-base <URI> remote AccessService URI or local base config URI --add-mount <PATH,CONTENT,SEGMENTS> add mount point -B,--l1-registry-port <NUM> port [1501] --concatenate <FILE1,FILE2,...,PRODUCT> concatenate files -l,--l1-mcast-registry <IPADDR> L1 multicast registry (ipv4/6 supported) [224.0.0.101] --list-all <PATH> list all objects --lookup <PATH> describe a directory element -m,--mcast-registry <IPADDR> main multicast registry (ipv4/6 supported) [224.0.0.100] --print <FILENAME> print the file --read <OFFSET:UUID> read several blocks --remove <PATH> remove a file --rename <SRC DST> rename/move a file -s,--local-storage <LOCALFN> local storage --save <LOCALFN FILENAME> save local file -u,--username <USER> user name -w,--password <PASSWORD> user password --write <FILENAME> write file into blocks
$ qid-cp -a http://192.168.0.70:1500 -u user -w password --write hs_err_pid5960.log : : May 15, 2018 4:38:37 PM egothor.qid.fs.Tool write INFO: write finished May 15, 2018 4:38:37 PM egothor.qid.fs.Tool write INFO: === hs_err_pid5960.log allocation table === May 15, 2018 4:38:37 PM egothor.qid.fs.storage.SegmentFileOutputStream dumpSegments INFO: SegmentFileElement{ref=f34904fc-35a5-4fee-ab1b-c92a5293b2bb, minTuple=[], maxTuple=[], global_offset=0, local_offset=0, length=16384, type=Block} May 15, 2018 4:38:37 PM egothor.qid.fs.storage.SegmentFileOutputStream dumpSegments INFO: SegmentFileElement{ref=b2567164-14d8-4de0-b3b7-eaa3669ab3da, minTuple=[], maxTuple=[], global_offset=16384, local_offset=0, length=16384, type=Block} May 15, 2018 4:38:37 PM egothor.qid.fs.storage.SegmentFileOutputStream dumpSegments INFO: SegmentFileElement{ref=3aa5a5c1-b94f-457a-9639-923043256eeb, minTuple=[], maxTuple=[], global_offset=32768, local_offset=0, length=16384, type=Block} May 15, 2018 4:38:37 PM egothor.qid.fs.storage.SegmentFileOutputStream dumpSegments INFO: SegmentFileElement{ref=a229de1d-ba72-4f08-8896-42471c815752, minTuple=[], maxTuple=[], global_offset=49152, local_offset=0, length=12417, type=Block} May 15, 2018 4:38:37 PM egothor.qid.fs.Tool write INFO: === total length: 61,569 ===Zpětné získání datového proudu se pak provede takto:
$ qid-client -a http://192.168.0.70:1500 -u user -w password --read 0:f34904fc-35a5-4fee-ab1b-c92a5293b2bb --read 16384:b2567164-14d8-4de0-b3b7-eaa3669ab3da \ --read 32768:3aa5a5c1-b94f-457a-9639-923043256eeb --read 49152:a229de1d-ba72-4f08-8896-42471c815752
--add-mount
.
$ qid-client -a http://192.168.0.70:1500 -u user -w password --add-mount /,qid-root.cnt,qid-root.blk --save ~/hs_err_pid5960.log /home/user/data.log : : May 15, 2018 5:21:45 PM egothor.qid.fs.Filesystem put INFO: created /home/user/data.log (84a3fcf1-0a6c-46c1-87a9-d85aa6f0c2ef) May 15, 2018 5:21:45 PM egothor.qid.fs.Tool save INFO: /home/galambos/hs_err_pid5960.log saved as /home/user/data.log, length=61,569 May 15, 2018 5:21:45 PM egothor.qid.fs.Filesystem commit INFO: mount point commit / to qid-root.cnt, qid-root.blk
$ qid-client -a http://192.168.0.70:1500 -u user -w password --add-mount /,qid-root.cnt,qid-root.blk --print /home/user/data.log
$ qid-client -a http://192.168.0.70:1500 -u user -w password --add-mount /,qid-root.cnt,qid-root.blk --rename /home/user/data.log /home/user/err.log : : May 18, 2018 12:34:22 PM egothor.qid.fs.Tool rename INFO: /home/user/data.log --> /home/user/err.log, result=true
$ qid-client -a http://192.168.0.70:1500 -u user -w password --add-mount /,qid-root.cnt,qid-root.blk --list-all / : : /home/user/err.log --> DirectoryElement{ref=c8d58a88-efdc-4820-80e4-47c6e40c9c0e, mtime=1526639256023, ctime=1526639256023, atime=1526639256023, length=61569, signature=, type=SegmentedFile}
$ qid-client -a http://192.168.0.70:1500 -u user -w password --add-mount /,qid-root.cnt,qid-root.blk --remove /home/user/err.log : : May 23, 2018 12:44:30 PM egothor.qid.fs.DirectoryStruct delete INFO: removed element home/user/err.log points to UUID ref c8d58a88-efdc-4820-80e4-47c6e40c9c0e May 23, 2018 12:44:30 PM egothor.qid.fs.DirectoryStruct delete INFO: SegmentFileElement{ref=4b596618-8516-4af9-9080-ea6362770de9, minTuple=[], maxTuple=[], global_offset=0, local_offset=0, length=61569, type=Block} just released, gc can check it for possible removal May 23, 2018 12:44:30 PM egothor.qid.fs.Tool remove INFO: removed /home/user/err.log, result=true
$ qid-client -a http://192.168.0.70:1500 -u user -w password --add-mount /,qid-root.cnt,qid-root.blk --concatenate /home/user/data01.log,/home/user/data02.log,/home/user/data03.log,/home/user/data-result : : May 23, 2018 5:54:13 PM egothor.qid.fs.DirectoryStruct <init> INFO: home/user/data01.log points to DirectoryElement{ref=1c1df1cb-c5f6-4276-8464-bfe16db0a5f4, mtime=1527090800878, ctime=1527090800878, atime=1527090800878, length=61569, signature=, type=SegmentedFile} May 23, 2018 5:54:13 PM egothor.qid.fs.DirectoryStruct <init> INFO: home/user/data02.log points to DirectoryElement{ref=2b13c274-ca66-435f-9393-01816942958c, mtime=1527090805311, ctime=1527090805311, atime=1527090805311, length=61569, signature=, type=SegmentedFile} May 23, 2018 5:54:13 PM egothor.qid.fs.DirectoryStruct <init> INFO: home/user/data03.log points to DirectoryElement{ref=8b005fe3-397e-4fc2-9711-4b9cf1e5db0b, mtime=1527090816225, ctime=1527090816225, atime=1527090816225, length=61569, signature=, type=SegmentedFile} : : May 23, 2018 5:54:13 PM egothor.qid.fs.Filesystem concatenate INFO: created /home/user/data-result (b47eb37b-4bad-40d2-b8bd-7b4e125e4b4d) #blocks=3
V předchozím kroku jsme vytvořili soubor, který vlastně tvoří tři jiné soubory. Seznam těchto oddělených částí lze nahlédnout takto:
$ qid-client -a http://192.168.0.70:1500 -u user -w password --add-mount /,qid-root.cnt,qid-root.blk --lookup /home/user/data-result : : /home/user/data-result segments=3 SegmentFileElement{ref=f1c49af7-ab0a-4e13-8dcd-e6daf94215ee, minTuple=[], maxTuple=[], global_offset=0, local_offset=0, length=61569, type=Block} SegmentFileElement{ref=619062df-0e22-40e5-8f05-04eb66d7c63b, minTuple=[], maxTuple=[], global_offset=61569, local_offset=0, length=61569, type=Block} SegmentFileElement{ref=e93e5368-2b57-4ed1-ba29-4c347887af33, minTuple=[], maxTuple=[], global_offset=123138, local_offset=0, length=61569, type=Block}