Posts

Redis install and run

My platform is Red Hat Enterprise Linux Server release 7.3 (Maipo) download redhat-release rpm [root@msdlvd-dsnavl02 /]# rpm -Uvh https://download.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm Install redis using yum [root@msdlvd-dsnavl02 /]# yum install redis -y Loaded plugins: langpacks, product-id, rhnplugin, search-disabled-repos, subscription-manager This system is receiving updates from RHN Classic or Red Hat Satellite. epel/x86_64/metalink                                                                                                                                                    ...

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 \ // -...

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",       ...

MongoDB tips: using explainable object

This is just to quickly document an alternative way to run explain plan assuming this is the query we want to run explain plan 2019-10-12T06:10:44.366-0400 I COMMAND [conn25251540] command device-event-store.events command: find { find: "events", filter: { $and: [ { aggregateId: { identifier: "990003494014489" } }, { version: { $gte: 0 } } ] }, sort: { version: 1 }, $db: "device-event-store", $clusterTime: { clusterTime: Timestamp(1570875044, 17), signature: { hash: BinData(0, 502D14059FA04824080CA91DAB899D434CFA3E87), keyId: 6727232173650214920 } }, lsid: { id: UUID("91bed447-28f5-4211-b3f8-58821d04060d") } } planSummary: COLLSCAN keysExamined:0 docsExamined:56299 hasSortStage:1 cursorExhausted:1 numYields:441 nreturned:78 reslen:44800 locks:{ Global: { acquireCount: { r: 884 } }, Database: { acquireCount: { r: 442 } }, Collection: { acquireCount: { r: 442 } } } protocol:op_msg 232ms first let's create an explainable object with execut...

MongoDB tips: Performance Tuning, Index creation order matters

I am hoping this post will be obsolete and noone will needs to find this. Continue from my previous post about choosing the best index for the job, that certain should still holds true as when I created the index with 1, -1 for two different date field, it's less efficient than -1, -1. Anyway, so luckily I found out about this before rolling this into production as I was planning on the production release. Under lower environment, I realized a less efficient index was used... from my previous post . I now believe it's a bug that should be fixed, in my experiments, the newer index is always preferred even when a better index is present. MongoDB query optimizer looks to be looking into only the first selective field I chose and no further. So if the latest index created matches the field this index is created, so in order for my query to serve the high frequency query, I have to make sure the best index is created last.