Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
docker_management [2020/01/10 11:08] andonovjdocker_management [2020/01/10 19:24] (current) – external edit 127.0.0.1
Line 90: Line 90:
  
 > >
 +</sxh>
 +
 +
 +Export of the database, as said again, is done with the standard utils:
 +<sxh bash>
 +root@8385665052a3:/# mongoexport --db=incident --collection=procedures --query='{"game_type":"BAC"}' --out=bac_procedures.json -u "root" -p "password" --authenticationDatabase admin
 +2020-01-10T10:54:55.975+0000    connected to: localhost
 +2020-01-10T10:54:55.986+0000    exported 71 records
 +root@8385665052a3:/# exit
 +</sxh>
 +
 +And then we can copy it to the main machine:
 +
 +<sxh bash>
 +root@8385665052a3:/# exit
 +[root@tpb-mts-stdkr1 ~]#
 +[root@tpb-mts-stdkr1 ~]#
 +[root@tpb-mts-stdkr1 ~]# docker cp 8385665052a3:bac_procedures.json bac_procedures.json
 +[root@tpb-mts-stdkr1 ~]# ls -lart
 +total 784672
 +-rw-r--r--.  1 root root       129 Dec 29  2013 .tcshrc
 +-rw-r--r--.  1 root root       100 Dec 29  2013 .cshrc
 +-rw-r--r--.  1 root root       176 Dec 29  2013 .bash_profile
 +-rw-r--r--.  1 root root        18 Dec 29  2013 .bash_logout
 +drwxr-----.  3 root root        19 Aug 27  2018 .pki
 +drwx------.  2 root root        26 Aug 27  2018 .docker
 +drwx------.  3 root root        18 Dec  4  2018 .config
 +-rw-r--r--.  1 root root      2162 Jan 14  2019 star.amazinggaming.com.crt
 +-rw-r--r--.  1 root root      1674 Jan 14  2019 star.amazinggaming.com.key
 +-rw-r--r--.  1 root root       176 Mar 22  2019 .bashrc
 +dr-xr-xr-x. 18 root root       239 Jun 19  2019 ..
 +drwxr-xr-x.  3 root root       192 Jul  4  2019 pit.configurator
 +drw-r--r--.  7 root root      4096 Jul 22 08:39 incident.frontend
 +drwxr-xr-x.  5 root root       131 Aug 12 05:07 recording.tool
 +-rw-r--r--.  1 root root      1894 Aug 12 05:20 production.json
 +drwxr-xr-x. 11 root root      4096 Aug 21 13:25 net.box
 +-rw-r--r--.  1 root root 299124736 Nov 15 08:35 incident.backend.tar
 +drwxr-xr-x.  3 root root        31 Nov 15 08:36 backup
 +drw-r--r--.  8 root root       244 Nov 18 06:56 incident.backend
 +drwxr-xr-x.  2 root root       196 Nov 20 14:44 nginx
 +-rw-r--r--.  1 root root 106871452 Jan  9 08:23 logs_bacnkend.txt
 +-rw-r--r--.  1 root root 365611371 Jan  9 08:28 logs_mango.txt
 +drwx------.  2 root root        48 Jan 10 10:01 .ssh
 +-rw-------.  1 root root     26656 Jan 10 10:51 .bash_history
 +-rwxr-xr-x.  1 root root  31719936 Jan 10 10:51 incident.frontend.tar
 +-rw-r--r--.  1 root root     92587 Jan 10 10:54 bac_procedures.json
 +</sxh>
 +
 +
 +We can also perform couple operations like, exchange the BAC -> DT
 +<sxh bash>
 +sed 's/BAC/DT/g' bac_procedures.json | tee dt_procedures.json
 +</sxh>
 +
 +We can also remove the _id column as follows:
 +
 +<sxh bash>
 +sed -i '/"_id":/s/"_id":[^,]*,//' dt_procedures.json
 +</sxh>
 +
 +And we can take it back:
 +<sxh bash>
 +docker cp dt_procedures.json 8385665052a3:dt_procedures.json 
 </sxh> </sxh>
  • docker_management.1578654509.txt.gz
  • Last modified: 2020/01/10 19:08
  • (external edit)