Posts

Showing posts from November, 2019

Docker Tip: Quick reference of commonly used docker command

// start a container with latest python docker run  // once container shuts down, just remove the container docker --rm // mount host directory to a directly inside of container docker -v ${host_dir}:/dir_inside_container // interactive, basically allow us to interact with something inside the container docker -it i.e. // start a python container and enter python interpreter docker run \ --rm \ -it \ python:latest \ python // -p host_port:container_port takes host_port and forward to container_port // -d run container in background, if not specified, it will run in foreground start container in background if -d is specified // if a container is issued to be run in background, we can stop it by first figuring out the container name then issue docker stop <container name> // check running containers, this will display container id, image, created, status, ports, and names docker ps docker container ls // docker build command docker build \ // -t is

Linux Tips: 3 quick interesting tip

//Redo last command as Sudo sudo !! //Create a super fast RAM disk  👍 [root@msdlvd-dsnavl02 ~]# mkdir -p /mnt/ram [root@msdlvd-dsnavl02 ~]# mount -t tmpfs tmpfs /mnt/ram -o size=1024M [root@msdlvd-dsnavl02 ~]# mkdir /data/ram [root@msdlvd-dsnavl02 ~]# cd /data/ram [root@msdlvd-dsnavl02 ram]# dd if=/dev/zero of=test.iso bs=1M count=1000 1000+0 records in 1000+0 records out 1048576000 bytes (1.0 GB) copied, 3.00793 s, 349 MB/s [root@msdlvd-dsnavl02 ram]# rm test.iso rm: remove regular file ‘test.iso’? y [root@msdlvd-dsnavl02 ram]# cd /mnt/ram [root@msdlvd-dsnavl02 ram]# dd if=/dev/zero of=test.iso bs=1M count=1000 1000+0 records in 1000+0 records out 1048576000 bytes (1.0 GB) copied, 0.594687 s, 1.8 GB/s //not in history, don't add your previously ran command in history, leave a leading space before command  ls -al

Rancher Server Deployment

Make sure you have a clean host with docker daemon installed, then simply run [root@msdlva-dsnsmt43 tmp]# docker run -d --restart=unless-stopped -p 80:80 -p 443:443 -v /opt/rancher:/var/lib/rancher rancher/rancher:latest Unable to find image 'rancher/rancher:latest' locally latest: Pulling from rancher/rancher 22e816666fd6: Pull complete 079b6d2a1e53: Pull complete 11048ebae908: Pull complete c58094023a2e: Pull complete 8a37a3d9d32f: Pull complete e403b6985877: Pull complete 9acf582a7992: Pull complete bed4e005ec0d: Pull complete 74a2e9817745: Pull complete 322f0c253a60: Pull complete 883600f5c6cf: Pull complete ff331cbe510b: Pull complete e1d7887879ba: Pull complete 5a5441e6019b: Pull complete Digest: sha256:f8751258c145cfa8cfb5e67d9784863c67937be3587c133288234a077ea386f4 Status: Downloaded newer image for rancher/rancher:latest bc28ec5b6222709ec27d03b3c9c1b720d6381431925d5ffa2596ba974671d1bb [root@msdlva-dsnsmt43 tmp]# docker logs --tail 10 -f bc2 2019/

MongoDB tips: get config information

db._adminCommand( {getCmdLineOpts: 1}) db._adminCommand({getParameter:"*"}) rs0:PRIMARY> db._adminCommand( {getCmdLineOpts: 1}) {         "argv" : [                 "mongod",                 "--config=/data/configdb/mongod.conf",                 "--dbpath=/data/db",                 "--replSet=rs0",                 "--port=27017",                 "--bind_ip=0.0.0.0",                 "--auth",                 "--keyFile=/data/configdb/key.txt"         ],         "parsed" : {                 "config" : "/data/configdb/mongod.conf",                 "net" : {                         "bindIp" : "0.0.0.0",                         "port" : 27017                 },                 "replication" : {                         "replSet" : "rs0"                 },